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

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

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 for (int i = 0, sz = m_Handlers.GetSize(); i < sz; i++) { 42 for (int i = 0, sz = m_Handlers.GetSize(); i < sz; i++) {
43 if (m_Handlers.GetAt(i) == pAnnotHandler) { 43 if (m_Handlers.GetAt(i) == pAnnotHandler) {
44 m_Handlers.RemoveAt(i); 44 m_Handlers.RemoveAt(i);
45 break; 45 break;
46 } 46 }
47 } 47 }
48 } 48 }
49 49
50 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, 50 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot,
51 CPDFSDK_PageView* pPageView) { 51 CPDFSDK_PageView* pPageView) {
52 ASSERT(pAnnot != NULL); 52 ASSERT(pPageView);
53 ASSERT(pPageView != NULL);
54 53
55 if (IPDFSDK_AnnotHandler* pAnnotHandler = 54 if (IPDFSDK_AnnotHandler* pAnnotHandler =
56 GetAnnotHandler(pAnnot->GetSubType())) { 55 GetAnnotHandler(pAnnot->GetSubType())) {
57 return pAnnotHandler->NewAnnot(pAnnot, pPageView); 56 return pAnnotHandler->NewAnnot(pAnnot, pPageView);
58 } 57 }
59 58
60 return new CPDFSDK_BAAnnot(pAnnot, pPageView); 59 return new CPDFSDK_BAAnnot(pAnnot, pPageView);
61 } 60 }
62 61
63 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { 62 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
64 ASSERT(pAnnot != NULL); 63 ASSERT(pAnnot);
Tom Sepez 2015/12/14 19:14:11 nit: segv on next line.
Lei Zhang 2015/12/15 01:38:33 Done.
65 64
66 pAnnot->GetPDFPage(); 65 pAnnot->GetPDFPage();
67 66
68 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 67 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
69 pAnnotHandler->OnRelease(pAnnot); 68 pAnnotHandler->OnRelease(pAnnot);
70 pAnnotHandler->ReleaseAnnot(pAnnot); 69 pAnnotHandler->ReleaseAnnot(pAnnot);
71 } else { 70 } else {
72 delete (CPDFSDK_Annot*)pAnnot; 71 delete (CPDFSDK_Annot*)pAnnot;
73 } 72 }
74 } 73 }
75 74
76 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { 75 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) {
77 ASSERT(pAnnot != NULL);
78
79 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 76 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
80 77
81 CPDFSDK_DateTime curTime; 78 CPDFSDK_DateTime curTime;
82 pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString()); 79 pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString());
83 pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); 80 pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0);
84 81
85 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 82 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
86 pAnnotHandler->OnCreate(pAnnot); 83 pAnnotHandler->OnCreate(pAnnot);
87 } 84 }
88 } 85 }
89 86
90 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { 87 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) {
91 ASSERT(pAnnot != NULL); 88 ASSERT(pAnnot);
92 89
93 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 90 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
94 pAnnotHandler->OnLoad(pAnnot); 91 pAnnotHandler->OnLoad(pAnnot);
95 } 92 }
96 } 93 }
97 94
98 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( 95 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
99 CPDFSDK_Annot* pAnnot) const { 96 CPDFSDK_Annot* pAnnot) const {
100 ASSERT(pAnnot != NULL);
101
102 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 97 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
103 if (pPDFAnnot) 98 return pPDFAnnot ? GetAnnotHandler(pPDFAnnot->GetSubType()) : nullptr;
104 return GetAnnotHandler(pPDFAnnot->GetSubType());
105 return nullptr;
106 } 99 }
107 100
108 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( 101 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
109 const CFX_ByteString& sType) const { 102 const CFX_ByteString& sType) const {
110 auto it = m_mapType2Handler.find(sType); 103 auto it = m_mapType2Handler.find(sType);
111 return it != m_mapType2Handler.end() ? it->second : nullptr; 104 return it != m_mapType2Handler.end() ? it->second : nullptr;
112 } 105 }
113 106
114 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, 107 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView,
115 CPDFSDK_Annot* pAnnot, 108 CPDFSDK_Annot* pAnnot,
116 CFX_RenderDevice* pDevice, 109 CFX_RenderDevice* pDevice,
117 CPDF_Matrix* pUser2Device, 110 CPDF_Matrix* pUser2Device,
118 FX_DWORD dwFlags) { 111 FX_DWORD dwFlags) {
119 ASSERT(pAnnot); 112 ASSERT(pAnnot);
120 113
121 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 114 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
122 pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); 115 pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
123 } else { 116 } else {
124 static_cast<CPDFSDK_BAAnnot*>(pAnnot) 117 static_cast<CPDFSDK_BAAnnot*>(pAnnot)
125 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); 118 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
126 } 119 }
127 } 120 }
128 121
129 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( 122 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(
130 CPDFSDK_PageView* pPageView, 123 CPDFSDK_PageView* pPageView,
131 CPDFSDK_Annot* pAnnot, 124 CPDFSDK_Annot* pAnnot,
132 FX_DWORD nFlags, 125 FX_DWORD nFlags,
133 const CPDF_Point& point) { 126 const CPDF_Point& point) {
134 ASSERT(pAnnot != NULL); 127 ASSERT(pAnnot);
135 128
136 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 129 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
137 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); 130 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point);
138 } 131 }
139 return FALSE; 132 return FALSE;
140 } 133 }
141 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView* pPageView, 134 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView* pPageView,
142 CPDFSDK_Annot* pAnnot, 135 CPDFSDK_Annot* pAnnot,
143 FX_DWORD nFlags, 136 FX_DWORD nFlags,
144 const CPDF_Point& point) { 137 const CPDF_Point& point) {
145 ASSERT(pAnnot != NULL); 138 ASSERT(pAnnot);
146 139
147 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 140 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
148 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point); 141 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point);
149 } 142 }
150 return FALSE; 143 return FALSE;
151 } 144 }
152 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( 145 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(
153 CPDFSDK_PageView* pPageView, 146 CPDFSDK_PageView* pPageView,
154 CPDFSDK_Annot* pAnnot, 147 CPDFSDK_Annot* pAnnot,
155 FX_DWORD nFlags, 148 FX_DWORD nFlags,
156 const CPDF_Point& point) { 149 const CPDF_Point& point) {
157 ASSERT(pAnnot != NULL); 150 ASSERT(pAnnot);
158 151
159 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 152 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
160 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); 153 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
161 } 154 }
162 return FALSE; 155 return FALSE;
163 } 156 }
164 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView* pPageView, 157 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView* pPageView,
165 CPDFSDK_Annot* pAnnot, 158 CPDFSDK_Annot* pAnnot,
166 FX_DWORD nFlags, 159 FX_DWORD nFlags,
167 const CPDF_Point& point) { 160 const CPDF_Point& point) {
168 ASSERT(pAnnot != NULL); 161 ASSERT(pAnnot);
169 162
170 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 163 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
171 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); 164 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point);
172 } 165 }
173 return FALSE; 166 return FALSE;
174 } 167 }
175 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, 168 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView* pPageView,
176 CPDFSDK_Annot* pAnnot, 169 CPDFSDK_Annot* pAnnot,
177 FX_DWORD nFlags, 170 FX_DWORD nFlags,
178 short zDelta, 171 short zDelta,
179 const CPDF_Point& point) { 172 const CPDF_Point& point) {
180 ASSERT(pAnnot != NULL); 173 ASSERT(pAnnot);
181 174
182 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 175 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
183 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, 176 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,
184 point); 177 point);
185 } 178 }
186 return FALSE; 179 return FALSE;
187 } 180 }
188 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( 181 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(
189 CPDFSDK_PageView* pPageView, 182 CPDFSDK_PageView* pPageView,
190 CPDFSDK_Annot* pAnnot, 183 CPDFSDK_Annot* pAnnot,
191 FX_DWORD nFlags, 184 FX_DWORD nFlags,
192 const CPDF_Point& point) { 185 const CPDF_Point& point) {
193 ASSERT(pAnnot != NULL); 186 ASSERT(pAnnot);
194 187
195 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 188 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
196 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); 189 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point);
197 } 190 }
198 return FALSE; 191 return FALSE;
199 } 192 }
200 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, 193 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView,
201 CPDFSDK_Annot* pAnnot, 194 CPDFSDK_Annot* pAnnot,
202 FX_DWORD nFlags, 195 FX_DWORD nFlags,
203 const CPDF_Point& point) { 196 const CPDF_Point& point) {
204 ASSERT(pAnnot != NULL); 197 ASSERT(pAnnot);
205 198
206 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 199 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
207 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); 200 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point);
208 } 201 }
209 return FALSE; 202 return FALSE;
210 } 203 }
211 204
212 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, 205 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView,
213 CPDFSDK_Annot* pAnnot, 206 CPDFSDK_Annot* pAnnot,
214 FX_DWORD nFlag) { 207 FX_DWORD nFlag) {
215 ASSERT(pAnnot != NULL); 208 ASSERT(pAnnot);
216 209
217 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 210 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
218 pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); 211 pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag);
219 } 212 }
220 return; 213 return;
221 } 214 }
222 215
223 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView* pPageView, 216 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView* pPageView,
224 CPDFSDK_Annot* pAnnot, 217 CPDFSDK_Annot* pAnnot,
225 FX_DWORD nFlag) { 218 FX_DWORD nFlag) {
226 ASSERT(pAnnot != NULL); 219 ASSERT(pAnnot);
227 220
228 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 221 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
229 pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); 222 pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag);
230 } 223 }
231 return; 224 return;
232 } 225 }
233 226
234 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, 227 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot,
235 FX_DWORD nChar, 228 FX_DWORD nChar,
236 FX_DWORD nFlags) { 229 FX_DWORD nFlags) {
(...skipping 27 matching lines...) Expand all
264 return FALSE; 257 return FALSE;
265 } 258 }
266 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, 259 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot,
267 int nKeyCode, 260 int nKeyCode,
268 int nFlag) { 261 int nFlag) {
269 return FALSE; 262 return FALSE;
270 } 263 }
271 264
272 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, 265 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot,
273 FX_DWORD nFlag) { 266 FX_DWORD nFlag) {
274 ASSERT(pAnnot != NULL); 267 ASSERT(pAnnot);
275 268
276 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { 269 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) {
277 if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) { 270 if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) {
278 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); 271 CPDFSDK_PageView* pPage = pAnnot->GetPageView();
279 pPage->GetSDKDocument(); 272 pPage->GetSDKDocument();
280 return TRUE; 273 return TRUE;
281 } 274 }
282 } 275 }
283 return FALSE; 276 return FALSE;
284 } 277 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); 347 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm);
355 pInterForm->AddMap(pCtrl, pWidget); 348 pInterForm->AddMap(pCtrl, pWidget);
356 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); 349 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
357 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) 350 if (pPDFInterForm && pPDFInterForm->NeedConstructAP())
358 pWidget->ResetAppearance(nullptr, FALSE); 351 pWidget->ResetAppearance(nullptr, FALSE);
359 352
360 return pWidget; 353 return pWidget;
361 } 354 }
362 355
363 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { 356 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
364 ASSERT(pAnnot != NULL); 357 ASSERT(pAnnot);
365 358
366 if (m_pFormFiller) 359 if (m_pFormFiller)
367 m_pFormFiller->OnDelete(pAnnot); 360 m_pFormFiller->OnDelete(pAnnot);
368 361
369 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 362 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
370 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); 363 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
371 ASSERT(pInterForm != NULL);
372
373 CPDF_FormControl* pCtrol = pWidget->GetFormControl(); 364 CPDF_FormControl* pCtrol = pWidget->GetFormControl();
374 pInterForm->RemoveMap(pCtrol); 365 pInterForm->RemoveMap(pCtrol);
375 366
376 delete pWidget; 367 delete pWidget;
377 } 368 }
378 369
379 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, 370 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
380 CPDFSDK_Annot* pAnnot, 371 CPDFSDK_Annot* pAnnot,
381 CFX_RenderDevice* pDevice, 372 CFX_RenderDevice* pDevice,
382 CPDF_Matrix* pUser2Device, 373 CPDF_Matrix* pUser2Device,
383 FX_DWORD dwFlags) { 374 FX_DWORD dwFlags) {
384 CFX_ByteString sSubType = pAnnot->GetSubType(); 375 CFX_ByteString sSubType = pAnnot->GetSubType();
385 376
386 if (sSubType == BFFT_SIGNATURE) { 377 if (sSubType == BFFT_SIGNATURE) {
387 static_cast<CPDFSDK_BAAnnot*>(pAnnot) 378 static_cast<CPDFSDK_BAAnnot*>(pAnnot)
388 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); 379 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
389 } else { 380 } else {
390 if (m_pFormFiller) { 381 if (m_pFormFiller) {
391 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); 382 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
392 } 383 }
393 } 384 }
394 } 385 }
395 386
396 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, 387 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
397 CPDFSDK_Annot* pAnnot, 388 CPDFSDK_Annot* pAnnot,
398 FX_DWORD nFlag) { 389 FX_DWORD nFlag) {
399 ASSERT(pAnnot != NULL);
400 CFX_ByteString sSubType = pAnnot->GetSubType(); 390 CFX_ByteString sSubType = pAnnot->GetSubType();
401 391
402 if (sSubType == BFFT_SIGNATURE) { 392 if (sSubType == BFFT_SIGNATURE) {
403 } else { 393 } else {
404 if (m_pFormFiller) 394 if (m_pFormFiller)
405 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); 395 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag);
406 } 396 }
407 } 397 }
408 void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, 398 void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
409 CPDFSDK_Annot* pAnnot, 399 CPDFSDK_Annot* pAnnot,
410 FX_DWORD nFlag) { 400 FX_DWORD nFlag) {
411 ASSERT(pAnnot != NULL);
412 CFX_ByteString sSubType = pAnnot->GetSubType(); 401 CFX_ByteString sSubType = pAnnot->GetSubType();
413 402
414 if (sSubType == BFFT_SIGNATURE) { 403 if (sSubType == BFFT_SIGNATURE) {
415 } else { 404 } else {
416 if (m_pFormFiller) 405 if (m_pFormFiller)
417 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); 406 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag);
418 } 407 }
419 } 408 }
420 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, 409 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
421 CPDFSDK_Annot* pAnnot, 410 CPDFSDK_Annot* pAnnot,
422 FX_DWORD nFlags, 411 FX_DWORD nFlags,
423 const CPDF_Point& point) { 412 const CPDF_Point& point) {
424 ASSERT(pAnnot != NULL);
425 CFX_ByteString sSubType = pAnnot->GetSubType(); 413 CFX_ByteString sSubType = pAnnot->GetSubType();
426 414
427 if (sSubType == BFFT_SIGNATURE) { 415 if (sSubType == BFFT_SIGNATURE) {
428 } else { 416 } else {
429 if (m_pFormFiller) 417 if (m_pFormFiller)
430 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); 418 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
431 } 419 }
432 420
433 return FALSE; 421 return FALSE;
434 } 422 }
435 423
436 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, 424 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
437 CPDFSDK_Annot* pAnnot, 425 CPDFSDK_Annot* pAnnot,
438 FX_DWORD nFlags, 426 FX_DWORD nFlags,
439 const CPDF_Point& point) { 427 const CPDF_Point& point) {
440 ASSERT(pAnnot != NULL);
441 CFX_ByteString sSubType = pAnnot->GetSubType(); 428 CFX_ByteString sSubType = pAnnot->GetSubType();
442 429
443 if (sSubType == BFFT_SIGNATURE) { 430 if (sSubType == BFFT_SIGNATURE) {
444 } else { 431 } else {
445 if (m_pFormFiller) 432 if (m_pFormFiller)
446 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); 433 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point);
447 } 434 }
448 435
449 return FALSE; 436 return FALSE;
450 } 437 }
451 438
452 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, 439 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
453 CPDFSDK_Annot* pAnnot, 440 CPDFSDK_Annot* pAnnot,
454 FX_DWORD nFlags, 441 FX_DWORD nFlags,
455 const CPDF_Point& point) { 442 const CPDF_Point& point) {
456 ASSERT(pAnnot != NULL);
457 CFX_ByteString sSubType = pAnnot->GetSubType(); 443 CFX_ByteString sSubType = pAnnot->GetSubType();
458 444
459 if (sSubType == BFFT_SIGNATURE) { 445 if (sSubType == BFFT_SIGNATURE) {
460 } else { 446 } else {
461 if (m_pFormFiller) 447 if (m_pFormFiller)
462 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); 448 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
463 } 449 }
464 450
465 return FALSE; 451 return FALSE;
466 } 452 }
467 453
468 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, 454 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
469 CPDFSDK_Annot* pAnnot, 455 CPDFSDK_Annot* pAnnot,
470 FX_DWORD nFlags, 456 FX_DWORD nFlags,
471 const CPDF_Point& point) { 457 const CPDF_Point& point) {
472 ASSERT(pAnnot != NULL);
473 CFX_ByteString sSubType = pAnnot->GetSubType(); 458 CFX_ByteString sSubType = pAnnot->GetSubType();
474 459
475 if (sSubType == BFFT_SIGNATURE) { 460 if (sSubType == BFFT_SIGNATURE) {
476 } else { 461 } else {
477 if (m_pFormFiller) 462 if (m_pFormFiller)
478 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); 463 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
479 } 464 }
480 465
481 return FALSE; 466 return FALSE;
482 } 467 }
483 468
484 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, 469 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
485 CPDFSDK_Annot* pAnnot, 470 CPDFSDK_Annot* pAnnot,
486 FX_DWORD nFlags, 471 FX_DWORD nFlags,
487 short zDelta, 472 short zDelta,
488 const CPDF_Point& point) { 473 const CPDF_Point& point) {
489 ASSERT(pAnnot != NULL);
490 CFX_ByteString sSubType = pAnnot->GetSubType(); 474 CFX_ByteString sSubType = pAnnot->GetSubType();
491 475
492 if (sSubType == BFFT_SIGNATURE) { 476 if (sSubType == BFFT_SIGNATURE) {
493 } else { 477 } else {
494 if (m_pFormFiller) 478 if (m_pFormFiller)
495 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, 479 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,
496 point); 480 point);
497 } 481 }
498 482
499 return FALSE; 483 return FALSE;
500 } 484 }
501 485
502 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, 486 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
503 CPDFSDK_Annot* pAnnot, 487 CPDFSDK_Annot* pAnnot,
504 FX_DWORD nFlags, 488 FX_DWORD nFlags,
505 const CPDF_Point& point) { 489 const CPDF_Point& point) {
506 ASSERT(pAnnot != NULL);
507 CFX_ByteString sSubType = pAnnot->GetSubType(); 490 CFX_ByteString sSubType = pAnnot->GetSubType();
508 491
509 if (sSubType == BFFT_SIGNATURE) { 492 if (sSubType == BFFT_SIGNATURE) {
510 } else { 493 } else {
511 if (m_pFormFiller) 494 if (m_pFormFiller)
512 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); 495 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
513 } 496 }
514 497
515 return FALSE; 498 return FALSE;
516 } 499 }
517 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, 500 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
518 CPDFSDK_Annot* pAnnot, 501 CPDFSDK_Annot* pAnnot,
519 FX_DWORD nFlags, 502 FX_DWORD nFlags,
520 const CPDF_Point& point) { 503 const CPDF_Point& point) {
521 ASSERT(pAnnot != NULL);
522 CFX_ByteString sSubType = pAnnot->GetSubType(); 504 CFX_ByteString sSubType = pAnnot->GetSubType();
523 505
524 if (sSubType == BFFT_SIGNATURE) { 506 if (sSubType == BFFT_SIGNATURE) {
525 } else { 507 } else {
526 if (m_pFormFiller) 508 if (m_pFormFiller)
527 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); 509 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
528 } 510 }
529 511
530 return FALSE; 512 return FALSE;
531 } 513 }
532 514
533 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, 515 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
534 FX_DWORD nChar, 516 FX_DWORD nChar,
535 FX_DWORD nFlags) { 517 FX_DWORD nFlags) {
536 ASSERT(pAnnot != NULL);
537 CFX_ByteString sSubType = pAnnot->GetSubType(); 518 CFX_ByteString sSubType = pAnnot->GetSubType();
538 519
539 if (sSubType == BFFT_SIGNATURE) { 520 if (sSubType == BFFT_SIGNATURE) {
540 } else { 521 } else {
541 if (m_pFormFiller) 522 if (m_pFormFiller)
542 return m_pFormFiller->OnChar(pAnnot, nChar, nFlags); 523 return m_pFormFiller->OnChar(pAnnot, nChar, nFlags);
543 } 524 }
544 525
545 return FALSE; 526 return FALSE;
546 } 527 }
547 528
548 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, 529 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
549 int nKeyCode, 530 int nKeyCode,
550 int nFlag) { 531 int nFlag) {
551 ASSERT(pAnnot != NULL);
552 CFX_ByteString sSubType = pAnnot->GetSubType(); 532 CFX_ByteString sSubType = pAnnot->GetSubType();
553 533
554 if (sSubType == BFFT_SIGNATURE) { 534 if (sSubType == BFFT_SIGNATURE) {
555 } else { 535 } else {
556 if (m_pFormFiller) 536 if (m_pFormFiller)
557 return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag); 537 return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag);
558 } 538 }
559 539
560 return FALSE; 540 return FALSE;
561 } 541 }
562 542
563 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, 543 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
564 int nKeyCode, 544 int nKeyCode,
565 int nFlag) { 545 int nFlag) {
566 return FALSE; 546 return FALSE;
567 } 547 }
568 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) { 548 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {
569 ASSERT(pAnnot != NULL);
570 CFX_ByteString sSubType = pAnnot->GetSubType(); 549 CFX_ByteString sSubType = pAnnot->GetSubType();
571 550
572 if (sSubType == BFFT_SIGNATURE) { 551 if (sSubType == BFFT_SIGNATURE) {
573 } else { 552 } else {
574 if (m_pFormFiller) 553 if (m_pFormFiller)
575 m_pFormFiller->OnCreate(pAnnot); 554 m_pFormFiller->OnCreate(pAnnot);
576 } 555 }
577 } 556 }
578 557
579 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) { 558 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
(...skipping 12 matching lines...) Expand all
592 pWidget->ResetAppearance(sValue.c_str(), FALSE); 571 pWidget->ResetAppearance(sValue.c_str(), FALSE);
593 } 572 }
594 } 573 }
595 574
596 if (m_pFormFiller) 575 if (m_pFormFiller)
597 m_pFormFiller->OnLoad(pAnnot); 576 m_pFormFiller->OnLoad(pAnnot);
598 } 577 }
599 578
600 FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, 579 FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
601 FX_DWORD nFlag) { 580 FX_DWORD nFlag) {
602 ASSERT(pAnnot != NULL);
603 CFX_ByteString sSubType = pAnnot->GetSubType(); 581 CFX_ByteString sSubType = pAnnot->GetSubType();
604 582
605 if (sSubType == BFFT_SIGNATURE) { 583 if (sSubType == BFFT_SIGNATURE) {
606 } else { 584 } else {
607 if (m_pFormFiller) 585 if (m_pFormFiller)
608 return m_pFormFiller->OnSetFocus(pAnnot, nFlag); 586 return m_pFormFiller->OnSetFocus(pAnnot, nFlag);
609 } 587 }
610 588
611 return TRUE; 589 return TRUE;
612 } 590 }
613 FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, 591 FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
614 FX_DWORD nFlag) { 592 FX_DWORD nFlag) {
615 ASSERT(pAnnot != NULL);
616 CFX_ByteString sSubType = pAnnot->GetSubType(); 593 CFX_ByteString sSubType = pAnnot->GetSubType();
617 594
618 if (sSubType == BFFT_SIGNATURE) { 595 if (sSubType == BFFT_SIGNATURE) {
619 } else { 596 } else {
620 if (m_pFormFiller) 597 if (m_pFormFiller)
621 return m_pFormFiller->OnKillFocus(pAnnot, nFlag); 598 return m_pFormFiller->OnKillFocus(pAnnot, nFlag);
622 } 599 }
623 600
624 return TRUE; 601 return TRUE;
625 } 602 }
626 603
627 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, 604 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
628 CPDFSDK_Annot* pAnnot) { 605 CPDFSDK_Annot* pAnnot) {
629 ASSERT(pAnnot != NULL);
630 CFX_ByteString sSubType = pAnnot->GetSubType(); 606 CFX_ByteString sSubType = pAnnot->GetSubType();
631 607
632 if (sSubType == BFFT_SIGNATURE) { 608 if (sSubType == BFFT_SIGNATURE) {
633 } else { 609 } else {
634 if (m_pFormFiller) 610 if (m_pFormFiller)
635 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); 611 return m_pFormFiller->GetViewBBox(pPageView, pAnnot);
636 } 612 }
637 613
638 return CPDF_Rect(0, 0, 0, 0); 614 return CPDF_Rect(0, 0, 0, 0);
639 } 615 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 659
684 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { 660 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() {
685 if (m_pos < m_iteratorAnnotList.size()) 661 if (m_pos < m_iteratorAnnotList.size())
686 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; 662 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos];
687 return nullptr; 663 return nullptr;
688 } 664 }
689 665
690 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { 666 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() {
691 return m_bReverse ? PrevAnnot() : NextAnnot(); 667 return m_bReverse ? PrevAnnot() : NextAnnot();
692 } 668 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698