| 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 "fpdfsdk/include/formfiller/FFL_IFormFiller.h" | 7 #include "fpdfsdk/include/formfiller/FFL_IFormFiller.h" | 
| 8 | 8 | 
| 9 #include "fpdfsdk/include/formfiller/FFL_CheckBox.h" | 9 #include "fpdfsdk/include/formfiller/FFL_CheckBox.h" | 
| 10 #include "fpdfsdk/include/formfiller/FFL_ComboBox.h" | 10 #include "fpdfsdk/include/formfiller/FFL_ComboBox.h" | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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)) { | 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 | 
| 138       ASSERT(pPageView); | 138       ASSERT(pPageView); | 
| 139 | 139 | 
| 140       PDFSDK_FieldAction fa; | 140       PDFSDK_FieldAction fa; | 
| 141       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 141       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 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)) { | 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); | 
| 174 | 174 | 
| 175       PDFSDK_FieldAction fa; | 175       PDFSDK_FieldAction fa; | 
| 176       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 176       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 
| 177       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 177       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 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)) { | 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 | 
| 211       ASSERT(pPageView); | 211       ASSERT(pPageView); | 
| 212 | 212 | 
| 213       PDFSDK_FieldAction fa; | 213       PDFSDK_FieldAction fa; | 
| 214       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); | 214       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); | 
| 215       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); | 215       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 277 } | 277 } | 
| 278 | 278 | 
| 279 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, | 279 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, | 
| 280                                   CPDFSDK_PageView* pPageView, | 280                                   CPDFSDK_PageView* pPageView, | 
| 281                                   FX_BOOL& bReset, | 281                                   FX_BOOL& bReset, | 
| 282                                   FX_BOOL& bExit, | 282                                   FX_BOOL& bExit, | 
| 283                                   FX_UINT nFlag) { | 283                                   FX_UINT nFlag) { | 
| 284   ASSERT(pWidget); | 284   ASSERT(pWidget); | 
| 285 | 285 | 
| 286   if (!m_bNotifying) { | 286   if (!m_bNotifying) { | 
| 287     if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) { | 287     if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) { | 
| 288       m_bNotifying = TRUE; | 288       m_bNotifying = TRUE; | 
| 289       int nAge = pWidget->GetAppearanceAge(); | 289       int nAge = pWidget->GetAppearanceAge(); | 
| 290       int nValueAge = pWidget->GetValueAge(); | 290       int nValueAge = pWidget->GetValueAge(); | 
| 291 | 291 | 
| 292       ASSERT(pPageView); | 292       ASSERT(pPageView); | 
| 293 | 293 | 
| 294       PDFSDK_FieldAction fa; | 294       PDFSDK_FieldAction fa; | 
| 295       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 295       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 
| 296       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 296       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 
| 297 | 297 | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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)) { | 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 | 
| 425       CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 425       CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 
| 426       ASSERT(pPageView); | 426       ASSERT(pPageView); | 
| 427 | 427 | 
| 428       PDFSDK_FieldAction fa; | 428       PDFSDK_FieldAction fa; | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 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)) { | 464       if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { | 
| 465         m_bNotifying = TRUE; | 465         m_bNotifying = TRUE; | 
| 466         pWidget->ClearAppModified(); | 466         pWidget->ClearAppModified(); | 
| 467 | 467 | 
| 468         CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 468         CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 
| 469         ASSERT(pPageView); | 469         ASSERT(pPageView); | 
| 470 | 470 | 
| 471         PDFSDK_FieldAction fa; | 471         PDFSDK_FieldAction fa; | 
| 472         fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 472         fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 
| 473         fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 473         fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 
| 474 | 474 | 
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 635   nRet = bBottom ? 0 : 1; | 635   nRet = bBottom ? 0 : 1; | 
| 636   fPopupRet = fFactHeight; | 636   fPopupRet = fFactHeight; | 
| 637 } | 637 } | 
| 638 | 638 | 
| 639 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, | 639 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, | 
| 640                                          CPDFSDK_PageView* pPageView, | 640                                          CPDFSDK_PageView* pPageView, | 
| 641                                          FX_BOOL& bRC, | 641                                          FX_BOOL& bRC, | 
| 642                                          FX_BOOL& bExit, | 642                                          FX_BOOL& bExit, | 
| 643                                          FX_DWORD nFlag) { | 643                                          FX_DWORD nFlag) { | 
| 644   if (!m_bNotifying) { | 644   if (!m_bNotifying) { | 
| 645     if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) { | 645     if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { | 
| 646       m_bNotifying = TRUE; | 646       m_bNotifying = TRUE; | 
| 647       pWidget->ClearAppModified(); | 647       pWidget->ClearAppModified(); | 
| 648 | 648 | 
| 649       ASSERT(pPageView); | 649       ASSERT(pPageView); | 
| 650 | 650 | 
| 651       PDFSDK_FieldAction fa; | 651       PDFSDK_FieldAction fa; | 
| 652       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 652       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 
| 653       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 653       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 
| 654       fa.bWillCommit = TRUE; | 654       fa.bWillCommit = TRUE; | 
| 655       fa.bKeyDown = TRUE; | 655       fa.bKeyDown = TRUE; | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 667     } | 667     } | 
| 668   } | 668   } | 
| 669 } | 669 } | 
| 670 | 670 | 
| 671 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, | 671 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, | 
| 672                                   CPDFSDK_PageView* pPageView, | 672                                   CPDFSDK_PageView* pPageView, | 
| 673                                   FX_BOOL& bRC, | 673                                   FX_BOOL& bRC, | 
| 674                                   FX_BOOL& bExit, | 674                                   FX_BOOL& bExit, | 
| 675                                   FX_DWORD nFlag) { | 675                                   FX_DWORD nFlag) { | 
| 676   if (!m_bNotifying) { | 676   if (!m_bNotifying) { | 
| 677     if (pWidget->GetAAction(CPDF_AAction::Validate)) { | 677     if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) { | 
| 678       m_bNotifying = TRUE; | 678       m_bNotifying = TRUE; | 
| 679       pWidget->ClearAppModified(); | 679       pWidget->ClearAppModified(); | 
| 680 | 680 | 
| 681       ASSERT(pPageView); | 681       ASSERT(pPageView); | 
| 682 | 682 | 
| 683       PDFSDK_FieldAction fa; | 683       PDFSDK_FieldAction fa; | 
| 684       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 684       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 
| 685       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 685       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 
| 686       fa.bKeyDown = TRUE; | 686       fa.bKeyDown = TRUE; | 
| 687       fa.bRC = TRUE; | 687       fa.bRC = TRUE; | 
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 944     OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag); | 944     OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag); | 
| 945 | 945 | 
| 946     if (bFullReset || bFullExit) { | 946     if (bFullReset || bFullExit) { | 
| 947       bExit = TRUE; | 947       bExit = TRUE; | 
| 948       return; | 948       return; | 
| 949     } | 949     } | 
| 950   } | 950   } | 
| 951 #endif  // PDF_ENABLE_XFA | 951 #endif  // PDF_ENABLE_XFA | 
| 952 | 952 | 
| 953   if (!m_bNotifying) { | 953   if (!m_bNotifying) { | 
| 954     if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { | 954     if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { | 
| 955       m_bNotifying = TRUE; | 955       m_bNotifying = TRUE; | 
| 956       int nAge = pData->pWidget->GetAppearanceAge(); | 956       int nAge = pData->pWidget->GetAppearanceAge(); | 
| 957       int nValueAge = pData->pWidget->GetValueAge(); | 957       int nValueAge = pData->pWidget->GetValueAge(); | 
| 958 | 958 | 
| 959       CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); | 959       CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); | 
| 960 | 960 | 
| 961       PDFSDK_FieldAction fa; | 961       PDFSDK_FieldAction fa; | 
| 962       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 962       fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 
| 963       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 963       fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 
| 964       fa.sChange = strChange; | 964       fa.sChange = strChange; | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1005           bExit = TRUE; | 1005           bExit = TRUE; | 
| 1006           m_bNotifying = FALSE; | 1006           m_bNotifying = FALSE; | 
| 1007           return; | 1007           return; | 
| 1008         } | 1008         } | 
| 1009       } | 1009       } | 
| 1010 | 1010 | 
| 1011       m_bNotifying = FALSE; | 1011       m_bNotifying = FALSE; | 
| 1012     } | 1012     } | 
| 1013   } | 1013   } | 
| 1014 } | 1014 } | 
| OLD | NEW | 
|---|