OLD | NEW |
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 "../../include/formfiller/FFL_FormFiller.h" | 7 #include "../../include/formfiller/FFL_FormFiller.h" |
8 #include "../../include/formfiller/FFL_IFormFiller.h" | 8 #include "../../include/formfiller/FFL_IFormFiller.h" |
9 #include "../../include/formfiller/FFL_CheckBox.h" | 9 #include "../../include/formfiller/FFL_CheckBox.h" |
10 #include "../../include/formfiller/FFL_ComboBox.h" | 10 #include "../../include/formfiller/FFL_ComboBox.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 if (pWidget->IsAppModified()) { | 452 if (pWidget->IsAppModified()) { |
453 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 453 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
454 pFormFiller->ResetPDFWindow(pPageView, | 454 pFormFiller->ResetPDFWindow(pPageView, |
455 nValueAge == pWidget->GetValueAge()); | 455 nValueAge == pWidget->GetValueAge()); |
456 } | 456 } |
457 } | 457 } |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
461 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 461 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) |
462 return pFormFiller->OnSetFocus(pAnnot, nFlag); | 462 return pFormFiller->SetFocusForAnnot(pAnnot, nFlag); |
463 | 463 |
464 return TRUE; | 464 return TRUE; |
465 } | 465 } |
466 | 466 |
467 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { | 467 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
468 if (!pAnnot) | 468 if (!pAnnot) |
469 return FALSE; | 469 return FALSE; |
470 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 470 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
471 | 471 |
472 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 472 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
473 if (pFormFiller->OnKillFocus(pAnnot, nFlag)) { | 473 if (!pFormFiller->KillFocusForAnnot(pAnnot, nFlag)) |
474 if (!m_bNotifying) { | 474 return FALSE; |
475 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | |
476 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) { | |
477 m_bNotifying = TRUE; | |
478 pWidget->ClearAppModified(); | |
479 | 475 |
480 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 476 if (!m_bNotifying) { |
481 ASSERT(pPageView != NULL); | 477 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 478 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) { |
| 479 m_bNotifying = TRUE; |
| 480 pWidget->ClearAppModified(); |
482 | 481 |
483 PDFSDK_FieldAction fa; | 482 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
484 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 483 ASSERT(pPageView != NULL); |
485 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | |
486 | 484 |
487 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); | 485 PDFSDK_FieldAction fa; |
| 486 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 487 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
488 | 488 |
489 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); | 489 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); |
490 m_bNotifying = FALSE; | 490 |
491 } | 491 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
| 492 m_bNotifying = FALSE; |
492 } | 493 } |
493 } else | 494 } |
494 return FALSE; | |
495 } | 495 } |
496 | 496 |
497 return TRUE; | 497 return TRUE; |
498 } | 498 } |
499 | 499 |
500 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { | 500 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { |
501 return pWidget->IsVisible(); | 501 return pWidget->IsVisible(); |
502 } | 502 } |
503 | 503 |
504 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { | 504 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 | 891 |
892 m_bNotifying = FALSE; | 892 m_bNotifying = FALSE; |
893 } | 893 } |
894 } | 894 } |
895 } | 895 } |
896 | 896 |
897 void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, | 897 void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, |
898 void* pPrivateData, | 898 void* pPrivateData, |
899 FX_BOOL& bExit, | 899 FX_BOOL& bExit, |
900 FX_DWORD nFlag) { | 900 FX_DWORD nFlag) { |
901 ASSERT(pPrivateData != NULL); | |
902 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 901 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
903 ASSERT(pData->pWidget != NULL); | 902 ASSERT(pData->pWidget); |
904 | 903 |
905 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 904 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
906 ASSERT(pFormFiller != NULL); | |
907 | 905 |
908 if (!bEditOrList) | 906 if (!bEditOrList) |
909 pFormFiller->OnKeyStroke(bExit); | 907 pFormFiller->OnKeyStroke(bExit, nFlag); |
910 } | 908 } |
OLD | NEW |