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

Side by Side Diff: fpdfsdk/src/fsdk_annothandler.cpp

Issue 1529553003: Merge to XFA: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" 9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
10 #include "fpdfsdk/include/fsdk_annothandler.h" 10 #include "fpdfsdk/include/fsdk_annothandler.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 for (int i = 0, sz = m_Handlers.GetSize(); i < sz; i++) { 52 for (int i = 0, sz = m_Handlers.GetSize(); i < sz; i++) {
53 if (m_Handlers.GetAt(i) == pAnnotHandler) { 53 if (m_Handlers.GetAt(i) == pAnnotHandler) {
54 m_Handlers.RemoveAt(i); 54 m_Handlers.RemoveAt(i);
55 break; 55 break;
56 } 56 }
57 } 57 }
58 } 58 }
59 59
60 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, 60 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot,
61 CPDFSDK_PageView* pPageView) { 61 CPDFSDK_PageView* pPageView) {
62 ASSERT(pAnnot != NULL); 62 ASSERT(pPageView);
63 ASSERT(pPageView != NULL);
64 63
65 if (IPDFSDK_AnnotHandler* pAnnotHandler = 64 if (IPDFSDK_AnnotHandler* pAnnotHandler =
66 GetAnnotHandler(pAnnot->GetSubType())) { 65 GetAnnotHandler(pAnnot->GetSubType())) {
67 return pAnnotHandler->NewAnnot(pAnnot, pPageView); 66 return pAnnotHandler->NewAnnot(pAnnot, pPageView);
68 } 67 }
69 68
70 return new CPDFSDK_BAAnnot(pAnnot, pPageView); 69 return new CPDFSDK_BAAnnot(pAnnot, pPageView);
71 } 70 }
72 71
73 #ifdef PDF_ENABLE_XFA 72 #ifdef PDF_ENABLE_XFA
74 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot, 73 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot,
75 CPDFSDK_PageView* pPageView) { 74 CPDFSDK_PageView* pPageView) {
76 ASSERT(pAnnot != NULL); 75 ASSERT(pAnnot != NULL);
77 ASSERT(pPageView != NULL); 76 ASSERT(pPageView != NULL);
78 77
79 if (IPDFSDK_AnnotHandler* pAnnotHandler = 78 if (IPDFSDK_AnnotHandler* pAnnotHandler =
80 GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) { 79 GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) {
81 return pAnnotHandler->NewAnnot(pAnnot, pPageView); 80 return pAnnotHandler->NewAnnot(pAnnot, pPageView);
82 } 81 }
83 82
84 return NULL; 83 return NULL;
85 } 84 }
86 #endif // PDF_ENABLE_XFA 85 #endif // PDF_ENABLE_XFA
87 86
88 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { 87 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
89 ASSERT(pAnnot != NULL);
90
91 pAnnot->GetPDFPage(); 88 pAnnot->GetPDFPage();
92 89
93 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 90 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
94 pAnnotHandler->OnRelease(pAnnot); 91 pAnnotHandler->OnRelease(pAnnot);
95 pAnnotHandler->ReleaseAnnot(pAnnot); 92 pAnnotHandler->ReleaseAnnot(pAnnot);
96 } else { 93 } else {
97 delete (CPDFSDK_Annot*)pAnnot; 94 delete (CPDFSDK_Annot*)pAnnot;
98 } 95 }
99 } 96 }
100 97
101 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { 98 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) {
102 ASSERT(pAnnot != NULL);
103
104 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 99 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
105 100
106 CPDFSDK_DateTime curTime; 101 CPDFSDK_DateTime curTime;
107 pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString()); 102 pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString());
108 pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); 103 pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0);
109 104
110 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 105 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
111 pAnnotHandler->OnCreate(pAnnot); 106 pAnnotHandler->OnCreate(pAnnot);
112 } 107 }
113 } 108 }
114 109
115 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { 110 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) {
116 ASSERT(pAnnot != NULL); 111 ASSERT(pAnnot);
117 112
118 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 113 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
119 pAnnotHandler->OnLoad(pAnnot); 114 pAnnotHandler->OnLoad(pAnnot);
120 } 115 }
121 } 116 }
122 117
123 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( 118 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
124 CPDFSDK_Annot* pAnnot) const { 119 CPDFSDK_Annot* pAnnot) const {
125 ASSERT(pAnnot != NULL);
126
127 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 120 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
Lei Zhang 2015/12/15 02:27:18 Conflict here We simplified the master version to
128 if (pPDFAnnot) 121 if (pPDFAnnot)
129 return GetAnnotHandler(pPDFAnnot->GetSubType()); 122 return GetAnnotHandler(pPDFAnnot->GetSubType());
130 #ifdef PDF_ENABLE_XFA 123 #ifdef PDF_ENABLE_XFA
131 if (pAnnot->GetXFAWidget()) 124 if (pAnnot->GetXFAWidget())
132 return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME); 125 return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME);
133 #endif // PDF_ENABLE_XFA 126 #endif // PDF_ENABLE_XFA
134 return nullptr; 127 return nullptr;
135 } 128 }
136 129
137 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( 130 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
(...skipping 19 matching lines...) Expand all
157 static_cast<CPDFSDK_BAAnnot*>(pAnnot) 150 static_cast<CPDFSDK_BAAnnot*>(pAnnot)
158 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); 151 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
159 } 152 }
160 } 153 }
161 154
162 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( 155 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(
163 CPDFSDK_PageView* pPageView, 156 CPDFSDK_PageView* pPageView,
164 CPDFSDK_Annot* pAnnot, 157 CPDFSDK_Annot* pAnnot,
165 FX_DWORD nFlags, 158 FX_DWORD nFlags,
166 const CPDF_Point& point) { 159 const CPDF_Point& point) {
167 ASSERT(pAnnot != NULL); 160 ASSERT(pAnnot);
168 161
169 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 162 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
170 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); 163 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point);
171 } 164 }
172 return FALSE; 165 return FALSE;
173 } 166 }
174 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView* pPageView, 167 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView* pPageView,
175 CPDFSDK_Annot* pAnnot, 168 CPDFSDK_Annot* pAnnot,
176 FX_DWORD nFlags, 169 FX_DWORD nFlags,
177 const CPDF_Point& point) { 170 const CPDF_Point& point) {
178 ASSERT(pAnnot != NULL); 171 ASSERT(pAnnot);
179 172
180 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 173 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
181 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point); 174 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point);
182 } 175 }
183 return FALSE; 176 return FALSE;
184 } 177 }
185 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( 178 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(
186 CPDFSDK_PageView* pPageView, 179 CPDFSDK_PageView* pPageView,
187 CPDFSDK_Annot* pAnnot, 180 CPDFSDK_Annot* pAnnot,
188 FX_DWORD nFlags, 181 FX_DWORD nFlags,
189 const CPDF_Point& point) { 182 const CPDF_Point& point) {
190 ASSERT(pAnnot != NULL); 183 ASSERT(pAnnot);
191 184
192 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 185 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
193 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); 186 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
194 } 187 }
195 return FALSE; 188 return FALSE;
196 } 189 }
197 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView* pPageView, 190 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView* pPageView,
198 CPDFSDK_Annot* pAnnot, 191 CPDFSDK_Annot* pAnnot,
199 FX_DWORD nFlags, 192 FX_DWORD nFlags,
200 const CPDF_Point& point) { 193 const CPDF_Point& point) {
201 ASSERT(pAnnot != NULL); 194 ASSERT(pAnnot);
202 195
203 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 196 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
204 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); 197 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point);
205 } 198 }
206 return FALSE; 199 return FALSE;
207 } 200 }
208 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, 201 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView* pPageView,
209 CPDFSDK_Annot* pAnnot, 202 CPDFSDK_Annot* pAnnot,
210 FX_DWORD nFlags, 203 FX_DWORD nFlags,
211 short zDelta, 204 short zDelta,
212 const CPDF_Point& point) { 205 const CPDF_Point& point) {
213 ASSERT(pAnnot != NULL); 206 ASSERT(pAnnot);
214 207
215 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 208 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
216 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, 209 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,
217 point); 210 point);
218 } 211 }
219 return FALSE; 212 return FALSE;
220 } 213 }
221 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( 214 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(
222 CPDFSDK_PageView* pPageView, 215 CPDFSDK_PageView* pPageView,
223 CPDFSDK_Annot* pAnnot, 216 CPDFSDK_Annot* pAnnot,
224 FX_DWORD nFlags, 217 FX_DWORD nFlags,
225 const CPDF_Point& point) { 218 const CPDF_Point& point) {
226 ASSERT(pAnnot != NULL); 219 ASSERT(pAnnot);
227 220
228 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 221 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
229 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); 222 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point);
230 } 223 }
231 return FALSE; 224 return FALSE;
232 } 225 }
233 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, 226 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView,
234 CPDFSDK_Annot* pAnnot, 227 CPDFSDK_Annot* pAnnot,
235 FX_DWORD nFlags, 228 FX_DWORD nFlags,
236 const CPDF_Point& point) { 229 const CPDF_Point& point) {
237 ASSERT(pAnnot != NULL); 230 ASSERT(pAnnot);
238 231
239 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 232 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
240 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); 233 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point);
241 } 234 }
242 return FALSE; 235 return FALSE;
243 } 236 }
244 237
245 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, 238 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView,
246 CPDFSDK_Annot* pAnnot, 239 CPDFSDK_Annot* pAnnot,
247 FX_DWORD nFlag) { 240 FX_DWORD nFlag) {
248 ASSERT(pAnnot != NULL); 241 ASSERT(pAnnot);
249 242
250 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 243 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
251 pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); 244 pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag);
252 } 245 }
253 return; 246 return;
254 } 247 }
255 248
256 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView* pPageView, 249 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView* pPageView,
257 CPDFSDK_Annot* pAnnot, 250 CPDFSDK_Annot* pAnnot,
258 FX_DWORD nFlag) { 251 FX_DWORD nFlag) {
259 ASSERT(pAnnot != NULL); 252 ASSERT(pAnnot);
260 253
261 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 254 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
262 pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); 255 pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag);
263 } 256 }
264 return; 257 return;
265 } 258 }
266 259
267 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, 260 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot,
268 FX_DWORD nChar, 261 FX_DWORD nChar,
269 FX_DWORD nFlags) { 262 FX_DWORD nFlags) {
(...skipping 27 matching lines...) Expand all
297 return FALSE; 290 return FALSE;
298 } 291 }
299 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, 292 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot,
300 int nKeyCode, 293 int nKeyCode,
301 int nFlag) { 294 int nFlag) {
302 return FALSE; 295 return FALSE;
303 } 296 }
304 297
305 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, 298 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot,
306 FX_DWORD nFlag) { 299 FX_DWORD nFlag) {
307 ASSERT(pAnnot != NULL); 300 ASSERT(pAnnot);
308 301
309 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 302 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
310 if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) { 303 if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) {
311 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); 304 CPDFSDK_PageView* pPage = pAnnot->GetPageView();
312 pPage->GetSDKDocument(); 305 pPage->GetSDKDocument();
313 return TRUE; 306 return TRUE;
314 } 307 }
315 } 308 }
316 return FALSE; 309 return FALSE;
317 } 310 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 435 }
443 436
444 #ifdef PDF_ENABLE_XFA 437 #ifdef PDF_ENABLE_XFA
445 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(IXFA_Widget* hWidget, 438 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(IXFA_Widget* hWidget,
446 CPDFSDK_PageView* pPage) { 439 CPDFSDK_PageView* pPage) {
447 return NULL; 440 return NULL;
448 } 441 }
449 #endif // PDF_ENABLE_XFA 442 #endif // PDF_ENABLE_XFA
450 443
451 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { 444 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
452 ASSERT(pAnnot != NULL); 445 ASSERT(pAnnot);
453 446
454 if (m_pFormFiller) 447 if (m_pFormFiller)
455 m_pFormFiller->OnDelete(pAnnot); 448 m_pFormFiller->OnDelete(pAnnot);
456 449
457 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 450 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
458 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); 451 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
459 ASSERT(pInterForm != NULL);
460
461 CPDF_FormControl* pCtrol = pWidget->GetFormControl(); 452 CPDF_FormControl* pCtrol = pWidget->GetFormControl();
462 pInterForm->RemoveMap(pCtrol); 453 pInterForm->RemoveMap(pCtrol);
463 454
464 delete pWidget; 455 delete pWidget;
465 } 456 }
466 457
467 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, 458 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
468 CPDFSDK_Annot* pAnnot, 459 CPDFSDK_Annot* pAnnot,
469 CFX_RenderDevice* pDevice, 460 CFX_RenderDevice* pDevice,
470 CFX_Matrix* pUser2Device, 461 CFX_Matrix* pUser2Device,
471 FX_DWORD dwFlags) { 462 FX_DWORD dwFlags) {
472 CFX_ByteString sSubType = pAnnot->GetSubType(); 463 CFX_ByteString sSubType = pAnnot->GetSubType();
473 464
474 if (sSubType == BFFT_SIGNATURE) { 465 if (sSubType == BFFT_SIGNATURE) {
475 static_cast<CPDFSDK_BAAnnot*>(pAnnot) 466 static_cast<CPDFSDK_BAAnnot*>(pAnnot)
476 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); 467 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
477 } else { 468 } else {
478 if (m_pFormFiller) { 469 if (m_pFormFiller) {
479 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); 470 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
480 } 471 }
481 } 472 }
482 } 473 }
483 474
484 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, 475 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
485 CPDFSDK_Annot* pAnnot, 476 CPDFSDK_Annot* pAnnot,
486 FX_DWORD nFlag) { 477 FX_DWORD nFlag) {
487 ASSERT(pAnnot != NULL);
488 CFX_ByteString sSubType = pAnnot->GetSubType(); 478 CFX_ByteString sSubType = pAnnot->GetSubType();
489 479
490 if (sSubType == BFFT_SIGNATURE) { 480 if (sSubType == BFFT_SIGNATURE) {
491 } else { 481 } else {
492 if (m_pFormFiller) 482 if (m_pFormFiller)
493 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); 483 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag);
494 } 484 }
495 } 485 }
496 void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, 486 void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
497 CPDFSDK_Annot* pAnnot, 487 CPDFSDK_Annot* pAnnot,
498 FX_DWORD nFlag) { 488 FX_DWORD nFlag) {
499 ASSERT(pAnnot != NULL);
500 CFX_ByteString sSubType = pAnnot->GetSubType(); 489 CFX_ByteString sSubType = pAnnot->GetSubType();
501 490
502 if (sSubType == BFFT_SIGNATURE) { 491 if (sSubType == BFFT_SIGNATURE) {
503 } else { 492 } else {
504 if (m_pFormFiller) 493 if (m_pFormFiller)
505 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); 494 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag);
506 } 495 }
507 } 496 }
508 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, 497 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
509 CPDFSDK_Annot* pAnnot, 498 CPDFSDK_Annot* pAnnot,
510 FX_DWORD nFlags, 499 FX_DWORD nFlags,
511 const CPDF_Point& point) { 500 const CPDF_Point& point) {
512 ASSERT(pAnnot != NULL);
513 CFX_ByteString sSubType = pAnnot->GetSubType(); 501 CFX_ByteString sSubType = pAnnot->GetSubType();
514 502
515 if (sSubType == BFFT_SIGNATURE) { 503 if (sSubType == BFFT_SIGNATURE) {
516 } else { 504 } else {
517 if (m_pFormFiller) 505 if (m_pFormFiller)
518 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); 506 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
519 } 507 }
520 508
521 return FALSE; 509 return FALSE;
522 } 510 }
523 511
524 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, 512 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
525 CPDFSDK_Annot* pAnnot, 513 CPDFSDK_Annot* pAnnot,
526 FX_DWORD nFlags, 514 FX_DWORD nFlags,
527 const CPDF_Point& point) { 515 const CPDF_Point& point) {
528 ASSERT(pAnnot != NULL);
529 CFX_ByteString sSubType = pAnnot->GetSubType(); 516 CFX_ByteString sSubType = pAnnot->GetSubType();
530 517
531 if (sSubType == BFFT_SIGNATURE) { 518 if (sSubType == BFFT_SIGNATURE) {
532 } else { 519 } else {
533 if (m_pFormFiller) 520 if (m_pFormFiller)
534 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); 521 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point);
535 } 522 }
536 523
537 return FALSE; 524 return FALSE;
538 } 525 }
539 526
540 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, 527 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
541 CPDFSDK_Annot* pAnnot, 528 CPDFSDK_Annot* pAnnot,
542 FX_DWORD nFlags, 529 FX_DWORD nFlags,
543 const CPDF_Point& point) { 530 const CPDF_Point& point) {
544 ASSERT(pAnnot != NULL);
545 CFX_ByteString sSubType = pAnnot->GetSubType(); 531 CFX_ByteString sSubType = pAnnot->GetSubType();
546 532
547 if (sSubType == BFFT_SIGNATURE) { 533 if (sSubType == BFFT_SIGNATURE) {
548 } else { 534 } else {
549 if (m_pFormFiller) 535 if (m_pFormFiller)
550 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); 536 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
551 } 537 }
552 538
553 return FALSE; 539 return FALSE;
554 } 540 }
555 541
556 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, 542 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
557 CPDFSDK_Annot* pAnnot, 543 CPDFSDK_Annot* pAnnot,
558 FX_DWORD nFlags, 544 FX_DWORD nFlags,
559 const CPDF_Point& point) { 545 const CPDF_Point& point) {
560 ASSERT(pAnnot != NULL);
561 CFX_ByteString sSubType = pAnnot->GetSubType(); 546 CFX_ByteString sSubType = pAnnot->GetSubType();
562 547
563 if (sSubType == BFFT_SIGNATURE) { 548 if (sSubType == BFFT_SIGNATURE) {
564 } else { 549 } else {
565 if (m_pFormFiller) 550 if (m_pFormFiller)
566 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); 551 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
567 } 552 }
568 553
569 return FALSE; 554 return FALSE;
570 } 555 }
571 556
572 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, 557 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
573 CPDFSDK_Annot* pAnnot, 558 CPDFSDK_Annot* pAnnot,
574 FX_DWORD nFlags, 559 FX_DWORD nFlags,
575 short zDelta, 560 short zDelta,
576 const CPDF_Point& point) { 561 const CPDF_Point& point) {
577 ASSERT(pAnnot != NULL);
578 CFX_ByteString sSubType = pAnnot->GetSubType(); 562 CFX_ByteString sSubType = pAnnot->GetSubType();
579 563
580 if (sSubType == BFFT_SIGNATURE) { 564 if (sSubType == BFFT_SIGNATURE) {
581 } else { 565 } else {
582 if (m_pFormFiller) 566 if (m_pFormFiller)
583 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, 567 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,
584 point); 568 point);
585 } 569 }
586 570
587 return FALSE; 571 return FALSE;
588 } 572 }
589 573
590 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, 574 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
591 CPDFSDK_Annot* pAnnot, 575 CPDFSDK_Annot* pAnnot,
592 FX_DWORD nFlags, 576 FX_DWORD nFlags,
593 const CPDF_Point& point) { 577 const CPDF_Point& point) {
594 ASSERT(pAnnot != NULL);
595 CFX_ByteString sSubType = pAnnot->GetSubType(); 578 CFX_ByteString sSubType = pAnnot->GetSubType();
596 579
597 if (sSubType == BFFT_SIGNATURE) { 580 if (sSubType == BFFT_SIGNATURE) {
598 } else { 581 } else {
599 if (m_pFormFiller) 582 if (m_pFormFiller)
600 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); 583 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
601 } 584 }
602 585
603 return FALSE; 586 return FALSE;
604 } 587 }
605 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, 588 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
606 CPDFSDK_Annot* pAnnot, 589 CPDFSDK_Annot* pAnnot,
607 FX_DWORD nFlags, 590 FX_DWORD nFlags,
608 const CPDF_Point& point) { 591 const CPDF_Point& point) {
609 ASSERT(pAnnot != NULL);
610 CFX_ByteString sSubType = pAnnot->GetSubType(); 592 CFX_ByteString sSubType = pAnnot->GetSubType();
611 593
612 if (sSubType == BFFT_SIGNATURE) { 594 if (sSubType == BFFT_SIGNATURE) {
613 } else { 595 } else {
614 if (m_pFormFiller) 596 if (m_pFormFiller)
615 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); 597 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
616 } 598 }
617 599
618 return FALSE; 600 return FALSE;
619 } 601 }
620 602
621 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, 603 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
622 FX_DWORD nChar, 604 FX_DWORD nChar,
623 FX_DWORD nFlags) { 605 FX_DWORD nFlags) {
624 ASSERT(pAnnot != NULL);
625 CFX_ByteString sSubType = pAnnot->GetSubType(); 606 CFX_ByteString sSubType = pAnnot->GetSubType();
626 607
627 if (sSubType == BFFT_SIGNATURE) { 608 if (sSubType == BFFT_SIGNATURE) {
628 } else { 609 } else {
629 if (m_pFormFiller) 610 if (m_pFormFiller)
630 return m_pFormFiller->OnChar(pAnnot, nChar, nFlags); 611 return m_pFormFiller->OnChar(pAnnot, nChar, nFlags);
631 } 612 }
632 613
633 return FALSE; 614 return FALSE;
634 } 615 }
635 616
636 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, 617 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
637 int nKeyCode, 618 int nKeyCode,
638 int nFlag) { 619 int nFlag) {
639 ASSERT(pAnnot != NULL);
640 CFX_ByteString sSubType = pAnnot->GetSubType(); 620 CFX_ByteString sSubType = pAnnot->GetSubType();
641 621
642 if (sSubType == BFFT_SIGNATURE) { 622 if (sSubType == BFFT_SIGNATURE) {
643 } else { 623 } else {
644 if (m_pFormFiller) 624 if (m_pFormFiller)
645 return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag); 625 return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag);
646 } 626 }
647 627
648 return FALSE; 628 return FALSE;
649 } 629 }
650 630
651 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, 631 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
652 int nKeyCode, 632 int nKeyCode,
653 int nFlag) { 633 int nFlag) {
654 return FALSE; 634 return FALSE;
655 } 635 }
656 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) { 636 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {
657 ASSERT(pAnnot != NULL);
658 CFX_ByteString sSubType = pAnnot->GetSubType(); 637 CFX_ByteString sSubType = pAnnot->GetSubType();
659 638
660 if (sSubType == BFFT_SIGNATURE) { 639 if (sSubType == BFFT_SIGNATURE) {
661 } else { 640 } else {
662 if (m_pFormFiller) 641 if (m_pFormFiller)
663 m_pFormFiller->OnCreate(pAnnot); 642 m_pFormFiller->OnCreate(pAnnot);
664 } 643 }
665 } 644 }
666 645
667 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) { 646 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
(...skipping 21 matching lines...) Expand all
689 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) 668 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
690 pWidget->ResetAppearance(FALSE); 669 pWidget->ResetAppearance(FALSE);
691 } 670 }
692 #endif // PDF_ENABLE_XFA 671 #endif // PDF_ENABLE_XFA
693 if (m_pFormFiller) 672 if (m_pFormFiller)
694 m_pFormFiller->OnLoad(pAnnot); 673 m_pFormFiller->OnLoad(pAnnot);
695 } 674 }
696 675
697 FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, 676 FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
698 FX_DWORD nFlag) { 677 FX_DWORD nFlag) {
699 ASSERT(pAnnot != NULL);
700 CFX_ByteString sSubType = pAnnot->GetSubType(); 678 CFX_ByteString sSubType = pAnnot->GetSubType();
701 679
702 if (sSubType == BFFT_SIGNATURE) { 680 if (sSubType == BFFT_SIGNATURE) {
703 } else { 681 } else {
704 if (m_pFormFiller) 682 if (m_pFormFiller)
705 return m_pFormFiller->OnSetFocus(pAnnot, nFlag); 683 return m_pFormFiller->OnSetFocus(pAnnot, nFlag);
706 } 684 }
707 685
708 return TRUE; 686 return TRUE;
709 } 687 }
710 FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, 688 FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
711 FX_DWORD nFlag) { 689 FX_DWORD nFlag) {
712 ASSERT(pAnnot != NULL);
713 CFX_ByteString sSubType = pAnnot->GetSubType(); 690 CFX_ByteString sSubType = pAnnot->GetSubType();
714 691
715 if (sSubType == BFFT_SIGNATURE) { 692 if (sSubType == BFFT_SIGNATURE) {
716 } else { 693 } else {
717 if (m_pFormFiller) 694 if (m_pFormFiller)
718 return m_pFormFiller->OnKillFocus(pAnnot, nFlag); 695 return m_pFormFiller->OnKillFocus(pAnnot, nFlag);
719 } 696 }
720 697
721 return TRUE; 698 return TRUE;
722 } 699 }
723 700
724 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, 701 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
725 CPDFSDK_Annot* pAnnot) { 702 CPDFSDK_Annot* pAnnot) {
726 ASSERT(pAnnot != NULL);
727 CFX_ByteString sSubType = pAnnot->GetSubType(); 703 CFX_ByteString sSubType = pAnnot->GetSubType();
728 704
729 if (sSubType == BFFT_SIGNATURE) { 705 if (sSubType == BFFT_SIGNATURE) {
730 } else { 706 } else {
731 if (m_pFormFiller) 707 if (m_pFormFiller)
732 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); 708 return m_pFormFiller->GetViewBBox(pPageView, pAnnot);
733 } 709 }
734 710
735 return CPDF_Rect(0, 0, 0, 0); 711 return CPDF_Rect(0, 0, 0, 0);
736 } 712 }
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 1171
1196 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { 1172 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() {
1197 if (m_pos < m_iteratorAnnotList.size()) 1173 if (m_pos < m_iteratorAnnotList.size())
1198 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; 1174 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos];
1199 return nullptr; 1175 return nullptr;
1200 } 1176 }
1201 1177
1202 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { 1178 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() {
1203 return m_bReverse ? PrevAnnot() : NextAnnot(); 1179 return m_bReverse ? PrevAnnot() : NextAnnot();
1204 } 1180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698