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

Side by Side Diff: fpdfsdk/formfiller/cffl_iformfiller.cpp

Issue 2287703002: Rename CPDFSDK_Annot::GetType to CPDFSDK_Annot::GetAnnotSubtype. (Closed)
Patch Set: Rename CPDFSDK_Annot::GetType to CPDFSDK_Annot::GetAnnotSubtype. Created 4 years, 3 months 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/formfiller/cffl_formfiller.cpp ('k') | fpdfsdk/fpdf_ext.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 "fpdfsdk/formfiller/cffl_iformfiller.h" 7 #include "fpdfsdk/formfiller/cffl_iformfiller.h"
8 8
9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 117 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
118 pFormFiller->OnDelete(pAnnot); 118 pFormFiller->OnDelete(pAnnot);
119 } 119 }
120 120
121 UnRegisterFormFiller(pAnnot); 121 UnRegisterFormFiller(pAnnot);
122 } 122 }
123 123
124 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, 124 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
125 CPDFSDK_Annot* pAnnot, 125 CPDFSDK_Annot* pAnnot,
126 FX_UINT nFlag) { 126 FX_UINT nFlag) {
127 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 127 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
128 128
129 if (!m_bNotifying) { 129 if (!m_bNotifying) {
130 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 130 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
131 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { 131 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) {
132 m_bNotifying = TRUE; 132 m_bNotifying = TRUE;
133 133
134 int nValueAge = pWidget->GetValueAge(); 134 int nValueAge = pWidget->GetValueAge();
135 135
136 pWidget->ClearAppModified(); 136 pWidget->ClearAppModified();
137 137
(...skipping 15 matching lines...) Expand all
153 } 153 }
154 154
155 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { 155 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) {
156 pFormFiller->OnMouseEnter(pPageView, pAnnot); 156 pFormFiller->OnMouseEnter(pPageView, pAnnot);
157 } 157 }
158 } 158 }
159 159
160 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, 160 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
161 CPDFSDK_Annot* pAnnot, 161 CPDFSDK_Annot* pAnnot,
162 FX_UINT nFlag) { 162 FX_UINT nFlag) {
163 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 163 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
164 164
165 if (!m_bNotifying) { 165 if (!m_bNotifying) {
166 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 166 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
167 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { 167 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) {
168 m_bNotifying = TRUE; 168 m_bNotifying = TRUE;
169 pWidget->GetAppearanceAge(); 169 pWidget->GetAppearanceAge();
170 int nValueAge = pWidget->GetValueAge(); 170 int nValueAge = pWidget->GetValueAge();
171 pWidget->ClearAppModified(); 171 pWidget->ClearAppModified();
172 172
173 ASSERT(pPageView); 173 ASSERT(pPageView);
(...skipping 16 matching lines...) Expand all
190 190
191 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 191 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
192 pFormFiller->OnMouseExit(pPageView, pAnnot); 192 pFormFiller->OnMouseExit(pPageView, pAnnot);
193 } 193 }
194 } 194 }
195 195
196 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, 196 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView,
197 CPDFSDK_Annot* pAnnot, 197 CPDFSDK_Annot* pAnnot,
198 FX_UINT nFlags, 198 FX_UINT nFlags,
199 const CFX_FloatPoint& point) { 199 const CFX_FloatPoint& point) {
200 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 200 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
201 201
202 if (!m_bNotifying) { 202 if (!m_bNotifying) {
203 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 203 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
204 if (Annot_HitTest(pPageView, pAnnot, point) && 204 if (Annot_HitTest(pPageView, pAnnot, point) &&
205 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { 205 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) {
206 m_bNotifying = TRUE; 206 m_bNotifying = TRUE;
207 pWidget->GetAppearanceAge(); 207 pWidget->GetAppearanceAge();
208 int nValueAge = pWidget->GetValueAge(); 208 int nValueAge = pWidget->GetValueAge();
209 pWidget->ClearAppModified(); 209 pWidget->ClearAppModified();
210 210
(...skipping 21 matching lines...) Expand all
232 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); 232 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
233 } 233 }
234 234
235 return FALSE; 235 return FALSE;
236 } 236 }
237 237
238 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, 238 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView,
239 CPDFSDK_Annot* pAnnot, 239 CPDFSDK_Annot* pAnnot,
240 FX_UINT nFlags, 240 FX_UINT nFlags,
241 const CFX_FloatPoint& point) { 241 const CFX_FloatPoint& point) {
242 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 242 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
243 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 243 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
244 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); 244 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
245 245
246 switch (pWidget->GetFieldType()) { 246 switch (pWidget->GetFieldType()) {
247 case FIELDTYPE_PUSHBUTTON: 247 case FIELDTYPE_PUSHBUTTON:
248 case FIELDTYPE_CHECKBOX: 248 case FIELDTYPE_CHECKBOX:
249 case FIELDTYPE_RADIOBUTTON: 249 case FIELDTYPE_RADIOBUTTON:
250 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) 250 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y))
251 pDocument->SetFocusAnnot(pAnnot); 251 pDocument->SetFocusAnnot(pAnnot);
252 break; 252 break;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 bReset = TRUE; 312 bReset = TRUE;
313 } 313 }
314 } 314 }
315 } 315 }
316 } 316 }
317 317
318 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, 318 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
319 CPDFSDK_Annot* pAnnot, 319 CPDFSDK_Annot* pAnnot,
320 FX_UINT nFlags, 320 FX_UINT nFlags,
321 const CFX_FloatPoint& point) { 321 const CFX_FloatPoint& point) {
322 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 322 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
323 323
324 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 324 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
325 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); 325 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
326 } 326 }
327 327
328 return FALSE; 328 return FALSE;
329 } 329 }
330 330
331 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, 331 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView,
332 CPDFSDK_Annot* pAnnot, 332 CPDFSDK_Annot* pAnnot,
333 FX_UINT nFlags, 333 FX_UINT nFlags,
334 const CFX_FloatPoint& point) { 334 const CFX_FloatPoint& point) {
335 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 335 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
336 336
337 // change cursor 337 // change cursor
338 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { 338 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) {
339 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); 339 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
340 } 340 }
341 341
342 return FALSE; 342 return FALSE;
343 } 343 }
344 344
345 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, 345 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView,
346 CPDFSDK_Annot* pAnnot, 346 CPDFSDK_Annot* pAnnot,
347 FX_UINT nFlags, 347 FX_UINT nFlags,
348 short zDelta, 348 short zDelta,
349 const CFX_FloatPoint& point) { 349 const CFX_FloatPoint& point) {
350 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 350 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
351 351
352 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 352 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
353 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); 353 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point);
354 } 354 }
355 355
356 return FALSE; 356 return FALSE;
357 } 357 }
358 358
359 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, 359 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView,
360 CPDFSDK_Annot* pAnnot, 360 CPDFSDK_Annot* pAnnot,
361 FX_UINT nFlags, 361 FX_UINT nFlags,
362 const CFX_FloatPoint& point) { 362 const CFX_FloatPoint& point) {
363 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 363 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
364 364
365 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 365 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
366 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); 366 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
367 } 367 }
368 368
369 return FALSE; 369 return FALSE;
370 } 370 }
371 371
372 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, 372 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView,
373 CPDFSDK_Annot* pAnnot, 373 CPDFSDK_Annot* pAnnot,
374 FX_UINT nFlags, 374 FX_UINT nFlags,
375 const CFX_FloatPoint& point) { 375 const CFX_FloatPoint& point) {
376 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 376 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
377 377
378 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 378 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
379 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); 379 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
380 } 380 }
381 381
382 return FALSE; 382 return FALSE;
383 } 383 }
384 384
385 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, 385 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot,
386 FX_UINT nKeyCode, 386 FX_UINT nKeyCode,
387 FX_UINT nFlags) { 387 FX_UINT nFlags) {
388 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 388 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
389 389
390 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 390 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
391 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); 391 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags);
392 } 392 }
393 393
394 return FALSE; 394 return FALSE;
395 } 395 }
396 396
397 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, 397 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot,
398 FX_UINT nChar, 398 FX_UINT nChar,
399 FX_UINT nFlags) { 399 FX_UINT nFlags) {
400 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 400 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
401 if (nChar == FWL_VKEY_Tab) 401 if (nChar == FWL_VKEY_Tab)
402 return TRUE; 402 return TRUE;
403 403
404 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 404 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
405 return pFormFiller->OnChar(pAnnot, nChar, nFlags); 405 return pFormFiller->OnChar(pAnnot, nChar, nFlags);
406 406
407 return FALSE; 407 return FALSE;
408 } 408 }
409 409
410 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { 410 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
411 if (!pAnnot) 411 if (!pAnnot)
412 return FALSE; 412 return FALSE;
413 413
414 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 414 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
415 415
416 if (!m_bNotifying) { 416 if (!m_bNotifying) {
417 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 417 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
418 if (pWidget->GetAAction(CPDF_AAction::GetFocus).GetDict()) { 418 if (pWidget->GetAAction(CPDF_AAction::GetFocus).GetDict()) {
419 m_bNotifying = TRUE; 419 m_bNotifying = TRUE;
420 pWidget->GetAppearanceAge(); 420 pWidget->GetAppearanceAge();
421 421
422 int nValueAge = pWidget->GetValueAge(); 422 int nValueAge = pWidget->GetValueAge();
423 pWidget->ClearAppModified(); 423 pWidget->ClearAppModified();
424 424
(...skipping 22 matching lines...) Expand all
447 447
448 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) 448 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
449 pFormFiller->SetFocusForAnnot(pAnnot, nFlag); 449 pFormFiller->SetFocusForAnnot(pAnnot, nFlag);
450 450
451 return TRUE; 451 return TRUE;
452 } 452 }
453 453
454 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { 454 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
455 if (!pAnnot) 455 if (!pAnnot)
456 return FALSE; 456 return FALSE;
457 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 457 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
458 458
459 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 459 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
460 pFormFiller->KillFocusForAnnot(pAnnot, nFlag); 460 pFormFiller->KillFocusForAnnot(pAnnot, nFlag);
461 461
462 if (!m_bNotifying) { 462 if (!m_bNotifying) {
463 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 463 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
464 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { 464 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) {
465 m_bNotifying = TRUE; 465 m_bNotifying = TRUE;
466 pWidget->ClearAppModified(); 466 pWidget->ClearAppModified();
467 467
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 bExit = TRUE; 999 bExit = TRUE;
1000 m_bNotifying = FALSE; 1000 m_bNotifying = FALSE;
1001 return; 1001 return;
1002 } 1002 }
1003 } 1003 }
1004 1004
1005 m_bNotifying = FALSE; 1005 m_bNotifying = FALSE;
1006 } 1006 }
1007 } 1007 }
1008 } 1008 }
OLDNEW
« no previous file with comments | « fpdfsdk/formfiller/cffl_formfiller.cpp ('k') | fpdfsdk/fpdf_ext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698