Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: fpdfsdk/cpdfsdk_annothandlermgr.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/cpdfsdk_annothandlermgr.h ('k') | fpdfsdk/cpdfsdk_baannot.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/cpdfsdk_annothandlermgr.h" 7 #include "fpdfsdk/cpdfsdk_annothandlermgr.h"
8 8
9 #include "core/fpdfdoc/cpdf_annot.h" 9 #include "core/fpdfdoc/cpdf_annot.h"
10 #include "fpdfsdk/cba_annotiterator.h" 10 #include "fpdfsdk/cba_annotiterator.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, 92 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView,
93 CPDFSDK_Annot* pAnnot, 93 CPDFSDK_Annot* pAnnot,
94 CFX_RenderDevice* pDevice, 94 CFX_RenderDevice* pDevice,
95 CFX_Matrix* pUser2Device, 95 CFX_Matrix* pUser2Device,
96 bool bDrawAnnots) { 96 bool bDrawAnnots) {
97 ASSERT(pAnnot); 97 ASSERT(pAnnot);
98 GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, 98 GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, pUser2Device,
99 bDrawAnnots); 99 bDrawAnnots);
100 } 100 }
101 101
102 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( 102 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(
103 CPDFSDK_PageView* pPageView, 103 CPDFSDK_PageView* pPageView,
104 CPDFSDK_Annot::ObservedPtr* pAnnot, 104 CPDFSDK_Annot::ObservedPtr* pAnnot,
105 uint32_t nFlags, 105 uint32_t nFlags,
106 const CFX_FloatPoint& point) { 106 const CFX_FloatPoint& point) {
107 ASSERT(*pAnnot); 107 ASSERT(*pAnnot);
108 return GetAnnotHandler(pAnnot->Get()) 108 return GetAnnotHandler(pAnnot->Get())
109 ->OnLButtonDown(pPageView, pAnnot, nFlags, point); 109 ->OnLButtonDown(pPageView, pAnnot, nFlags, point);
110 } 110 }
111 111
112 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp( 112 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(
113 CPDFSDK_PageView* pPageView, 113 CPDFSDK_PageView* pPageView,
114 CPDFSDK_Annot::ObservedPtr* pAnnot, 114 CPDFSDK_Annot::ObservedPtr* pAnnot,
115 uint32_t nFlags, 115 uint32_t nFlags,
116 const CFX_FloatPoint& point) { 116 const CFX_FloatPoint& point) {
117 ASSERT(*pAnnot); 117 ASSERT(*pAnnot);
118 return GetAnnotHandler(pAnnot->Get()) 118 return GetAnnotHandler(pAnnot->Get())
119 ->OnLButtonUp(pPageView, pAnnot, nFlags, point); 119 ->OnLButtonUp(pPageView, pAnnot, nFlags, point);
120 } 120 }
121 121
122 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( 122 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(
123 CPDFSDK_PageView* pPageView, 123 CPDFSDK_PageView* pPageView,
124 CPDFSDK_Annot::ObservedPtr* pAnnot, 124 CPDFSDK_Annot::ObservedPtr* pAnnot,
125 uint32_t nFlags, 125 uint32_t nFlags,
126 const CFX_FloatPoint& point) { 126 const CFX_FloatPoint& point) {
127 ASSERT(*pAnnot); 127 ASSERT(*pAnnot);
128 return GetAnnotHandler(pAnnot->Get()) 128 return GetAnnotHandler(pAnnot->Get())
129 ->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); 129 ->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
130 } 130 }
131 131
132 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove( 132 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(
133 CPDFSDK_PageView* pPageView, 133 CPDFSDK_PageView* pPageView,
134 CPDFSDK_Annot::ObservedPtr* pAnnot, 134 CPDFSDK_Annot::ObservedPtr* pAnnot,
135 uint32_t nFlags, 135 uint32_t nFlags,
136 const CFX_FloatPoint& point) { 136 const CFX_FloatPoint& point) {
137 ASSERT(*pAnnot); 137 ASSERT(*pAnnot);
138 return GetAnnotHandler(pAnnot->Get()) 138 return GetAnnotHandler(pAnnot->Get())
139 ->OnMouseMove(pPageView, pAnnot, nFlags, point); 139 ->OnMouseMove(pPageView, pAnnot, nFlags, point);
140 } 140 }
141 141
142 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel( 142 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(
143 CPDFSDK_PageView* pPageView, 143 CPDFSDK_PageView* pPageView,
144 CPDFSDK_Annot::ObservedPtr* pAnnot, 144 CPDFSDK_Annot::ObservedPtr* pAnnot,
145 uint32_t nFlags, 145 uint32_t nFlags,
146 short zDelta, 146 short zDelta,
147 const CFX_FloatPoint& point) { 147 const CFX_FloatPoint& point) {
148 ASSERT(*pAnnot); 148 ASSERT(*pAnnot);
149 return GetAnnotHandler(pAnnot->Get()) 149 return GetAnnotHandler(pAnnot->Get())
150 ->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); 150 ->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point);
151 } 151 }
152 152
153 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( 153 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(
154 CPDFSDK_PageView* pPageView, 154 CPDFSDK_PageView* pPageView,
155 CPDFSDK_Annot::ObservedPtr* pAnnot, 155 CPDFSDK_Annot::ObservedPtr* pAnnot,
156 uint32_t nFlags, 156 uint32_t nFlags,
157 const CFX_FloatPoint& point) { 157 const CFX_FloatPoint& point) {
158 ASSERT(*pAnnot); 158 ASSERT(*pAnnot);
159 return GetAnnotHandler(pAnnot->Get()) 159 return GetAnnotHandler(pAnnot->Get())
160 ->OnRButtonDown(pPageView, pAnnot, nFlags, point); 160 ->OnRButtonDown(pPageView, pAnnot, nFlags, point);
161 } 161 }
162 162
163 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp( 163 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(
164 CPDFSDK_PageView* pPageView, 164 CPDFSDK_PageView* pPageView,
165 CPDFSDK_Annot::ObservedPtr* pAnnot, 165 CPDFSDK_Annot::ObservedPtr* pAnnot,
166 uint32_t nFlags, 166 uint32_t nFlags,
167 const CFX_FloatPoint& point) { 167 const CFX_FloatPoint& point) {
168 ASSERT(*pAnnot); 168 ASSERT(*pAnnot);
169 return GetAnnotHandler(pAnnot->Get()) 169 return GetAnnotHandler(pAnnot->Get())
170 ->OnRButtonUp(pPageView, pAnnot, nFlags, point); 170 ->OnRButtonUp(pPageView, pAnnot, nFlags, point);
171 } 171 }
172 172
173 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter( 173 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(
174 CPDFSDK_PageView* pPageView, 174 CPDFSDK_PageView* pPageView,
175 CPDFSDK_Annot::ObservedPtr* pAnnot, 175 CPDFSDK_Annot::ObservedPtr* pAnnot,
176 uint32_t nFlag) { 176 uint32_t nFlag) {
177 ASSERT(*pAnnot); 177 ASSERT(*pAnnot);
178 GetAnnotHandler(pAnnot->Get())->OnMouseEnter(pPageView, pAnnot, nFlag); 178 GetAnnotHandler(pAnnot->Get())->OnMouseEnter(pPageView, pAnnot, nFlag);
179 } 179 }
180 180
181 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit( 181 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(
182 CPDFSDK_PageView* pPageView, 182 CPDFSDK_PageView* pPageView,
183 CPDFSDK_Annot::ObservedPtr* pAnnot, 183 CPDFSDK_Annot::ObservedPtr* pAnnot,
184 uint32_t nFlag) { 184 uint32_t nFlag) {
185 ASSERT(*pAnnot); 185 ASSERT(*pAnnot);
186 GetAnnotHandler(pAnnot->Get())->OnMouseExit(pPageView, pAnnot, nFlag); 186 GetAnnotHandler(pAnnot->Get())->OnMouseExit(pPageView, pAnnot, nFlag);
187 } 187 }
188 188
189 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, 189 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot,
190 uint32_t nChar, 190 uint32_t nChar,
191 uint32_t nFlags) { 191 uint32_t nFlags) {
192 return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags); 192 return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags);
193 } 193 }
194 194
195 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, 195 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot,
196 int nKeyCode, 196 int nKeyCode,
197 int nFlag) { 197 int nFlag) {
198 if (m_pFormFillEnv->IsCTRLKeyDown(nFlag) || 198 if (m_pFormFillEnv->IsCTRLKeyDown(nFlag) ||
199 m_pFormFillEnv->IsALTKeyDown(nFlag)) 199 m_pFormFillEnv->IsALTKeyDown(nFlag))
200 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); 200 return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag);
201 201
202 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); 202 CPDFSDK_PageView* pPage = pAnnot->GetPageView();
203 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); 203 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot();
204 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) { 204 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) {
205 CPDFSDK_Annot::ObservedPtr pNext( 205 CPDFSDK_Annot::ObservedPtr pNext(
206 GetNextAnnot(pFocusAnnot, !m_pFormFillEnv->IsSHIFTKeyDown(nFlag))); 206 GetNextAnnot(pFocusAnnot, !m_pFormFillEnv->IsSHIFTKeyDown(nFlag)));
207 if (pNext && pNext.Get() != pFocusAnnot) { 207 if (pNext && pNext.Get() != pFocusAnnot) {
208 pPage->GetFormFillEnv()->SetFocusAnnot(&pNext); 208 pPage->GetFormFillEnv()->SetFocusAnnot(&pNext);
209 return TRUE; 209 return true;
210 } 210 }
211 } 211 }
212 212
213 return FALSE; 213 return false;
214 } 214 }
215 215
216 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, 216 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot,
217 int nKeyCode, 217 int nKeyCode,
218 int nFlag) { 218 int nFlag) {
219 return FALSE; 219 return false;
220 } 220 }
221 221
222 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus( 222 bool CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(
223 CPDFSDK_Annot::ObservedPtr* pAnnot, 223 CPDFSDK_Annot::ObservedPtr* pAnnot,
224 uint32_t nFlag) { 224 uint32_t nFlag) {
225 ASSERT(*pAnnot); 225 ASSERT(*pAnnot);
226 return GetAnnotHandler(pAnnot->Get())->OnSetFocus(pAnnot, nFlag); 226 return GetAnnotHandler(pAnnot->Get())->OnSetFocus(pAnnot, nFlag);
227 } 227 }
228 228
229 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus( 229 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(
230 CPDFSDK_Annot::ObservedPtr* pAnnot, 230 CPDFSDK_Annot::ObservedPtr* pAnnot,
231 uint32_t nFlag) { 231 uint32_t nFlag) {
232 ASSERT(*pAnnot); 232 ASSERT(*pAnnot);
233 return GetAnnotHandler(pAnnot->Get())->OnKillFocus(pAnnot, nFlag); 233 return GetAnnotHandler(pAnnot->Get())->OnKillFocus(pAnnot, nFlag);
234 } 234 }
235 235
236 #ifdef PDF_ENABLE_XFA 236 #ifdef PDF_ENABLE_XFA
237 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( 237 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus(
238 CPDFSDK_Annot::ObservedPtr* pSetAnnot, 238 CPDFSDK_Annot::ObservedPtr* pSetAnnot,
239 CPDFSDK_Annot::ObservedPtr* pKillAnnot) { 239 CPDFSDK_Annot::ObservedPtr* pKillAnnot) {
240 FX_BOOL bXFA = (*pSetAnnot && (*pSetAnnot)->GetXFAWidget()) || 240 bool bXFA = (*pSetAnnot && (*pSetAnnot)->GetXFAWidget()) ||
241 (*pKillAnnot && (*pKillAnnot)->GetXFAWidget()); 241 (*pKillAnnot && (*pKillAnnot)->GetXFAWidget());
242 242
243 if (bXFA) { 243 if (bXFA) {
244 if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = 244 if (IPDFSDK_AnnotHandler* pXFAAnnotHandler =
245 GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET)) 245 GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET))
246 return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); 246 return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot);
247 } 247 }
248 248
249 return TRUE; 249 return true;
250 } 250 }
251 #endif // PDF_ENABLE_XFA 251 #endif // PDF_ENABLE_XFA
252 252
253 CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox( 253 CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(
254 CPDFSDK_PageView* pPageView, 254 CPDFSDK_PageView* pPageView,
255 CPDFSDK_Annot* pAnnot) { 255 CPDFSDK_Annot* pAnnot) {
256 ASSERT(pAnnot); 256 ASSERT(pAnnot);
257 return GetAnnotHandler(pAnnot)->GetViewBBox(pPageView, pAnnot); 257 return GetAnnotHandler(pAnnot)->GetViewBBox(pPageView, pAnnot);
258 } 258 }
259 259
260 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView, 260 bool CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView,
261 CPDFSDK_Annot* pAnnot, 261 CPDFSDK_Annot* pAnnot,
262 const CFX_FloatPoint& point) { 262 const CFX_FloatPoint& point) {
263 ASSERT(pAnnot); 263 ASSERT(pAnnot);
264 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); 264 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot);
265 if (pAnnotHandler->CanAnswer(pAnnot)) 265 if (pAnnotHandler->CanAnswer(pAnnot))
266 return pAnnotHandler->HitTest(pPageView, pAnnot, point); 266 return pAnnotHandler->HitTest(pPageView, pAnnot, point);
267 267
268 return FALSE; 268 return false;
269 } 269 }
270 270
271 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, 271 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,
272 FX_BOOL bNext) { 272 bool bNext) {
273 #ifdef PDF_ENABLE_XFA 273 #ifdef PDF_ENABLE_XFA
274 CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView(); 274 CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView();
275 CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage(); 275 CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage();
276 if (!pPage) 276 if (!pPage)
277 return nullptr; 277 return nullptr;
278 if (pPage->GetPDFPage()) { // for pdf annots. 278 if (pPage->GetPDFPage()) { // for pdf annots.
279 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), 279 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(),
280 pSDKAnnot->GetAnnotSubtype()); 280 pSDKAnnot->GetAnnotSubtype());
281 CPDFSDK_Annot* pNext = 281 CPDFSDK_Annot* pNext =
282 bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); 282 bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot);
(...skipping 13 matching lines...) Expand all
296 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); 296 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious();
297 if (!hNextFocus && pSDKAnnot) 297 if (!hNextFocus && pSDKAnnot)
298 hNextFocus = pWidgetIterator->MoveToFirst(); 298 hNextFocus = pWidgetIterator->MoveToFirst();
299 299
300 return pPageView->GetAnnotByXFAWidget(hNextFocus); 300 return pPageView->GetAnnotByXFAWidget(hNextFocus);
301 #else // PDF_ENABLE_XFA 301 #else // PDF_ENABLE_XFA
302 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); 302 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET);
303 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); 303 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot);
304 #endif // PDF_ENABLE_XFA 304 #endif // PDF_ENABLE_XFA
305 } 305 }
OLDNEW
« no previous file with comments | « fpdfsdk/cpdfsdk_annothandlermgr.h ('k') | fpdfsdk/cpdfsdk_baannot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698