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

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

Powered by Google App Engine
This is Rietveld 408576698