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_CheckBox.h" | 7 #include "fpdfsdk/include/formfiller/FFL_CheckBox.h" |
8 #include "fpdfsdk/include/formfiller/FFL_ComboBox.h" | 8 #include "fpdfsdk/include/formfiller/FFL_ComboBox.h" |
9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" | 9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" |
10 #include "fpdfsdk/include/formfiller/FFL_IFormFiller.h" | 10 #include "fpdfsdk/include/formfiller/FFL_IFormFiller.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 270 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
271 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); | 271 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
272 } | 272 } |
273 | 273 |
274 if (pDocument->GetFocusAnnot() == pAnnot) { | 274 if (pDocument->GetFocusAnnot() == pAnnot) { |
275 FX_BOOL bExit = FALSE; | 275 FX_BOOL bExit = FALSE; |
276 FX_BOOL bReset = FALSE; | 276 FX_BOOL bReset = FALSE; |
277 OnButtonUp(pWidget, pPageView, bReset, bExit, nFlags); | 277 OnButtonUp(pWidget, pPageView, bReset, bExit, nFlags); |
278 if (bExit) | 278 if (bExit) |
279 return TRUE; | 279 return TRUE; |
| 280 #ifdef PDF_ENABLE_XFA |
| 281 |
| 282 OnClick(pWidget, pPageView, bReset, bExit, nFlags); |
| 283 if (bExit) |
| 284 return TRUE; |
| 285 #endif |
280 } | 286 } |
281 return bRet; | 287 return bRet; |
282 } | 288 } |
283 | 289 |
284 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, | 290 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, |
285 CPDFSDK_PageView* pPageView, | 291 CPDFSDK_PageView* pPageView, |
286 FX_BOOL& bReset, | 292 FX_BOOL& bReset, |
287 FX_BOOL& bExit, | 293 FX_BOOL& bExit, |
288 FX_UINT nFlag) { | 294 FX_UINT nFlag) { |
289 ASSERT(pWidget != NULL); | 295 ASSERT(pWidget != NULL); |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 if (bFormated) { | 791 if (bFormated) { |
786 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(), | 792 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(), |
787 TRUE); | 793 TRUE); |
788 pInterForm->UpdateField(pWidget->GetFormField()); | 794 pInterForm->UpdateField(pWidget->GetFormField()); |
789 } | 795 } |
790 | 796 |
791 m_bNotifying = FALSE; | 797 m_bNotifying = FALSE; |
792 } | 798 } |
793 } | 799 } |
794 | 800 |
| 801 #ifdef PDF_ENABLE_XFA |
| 802 void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget, |
| 803 CPDFSDK_PageView* pPageView, |
| 804 FX_BOOL& bReset, |
| 805 FX_BOOL& bExit, |
| 806 FX_UINT nFlag) { |
| 807 ASSERT(pWidget != NULL); |
| 808 |
| 809 if (!m_bNotifying) { |
| 810 if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) { |
| 811 m_bNotifying = TRUE; |
| 812 int nAge = pWidget->GetAppearanceAge(); |
| 813 int nValueAge = pWidget->GetValueAge(); |
| 814 |
| 815 PDFSDK_FieldAction fa; |
| 816 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 817 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 818 |
| 819 pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); |
| 820 m_bNotifying = FALSE; |
| 821 |
| 822 if (!IsValidAnnot(pPageView, pWidget)) { |
| 823 bExit = TRUE; |
| 824 return; |
| 825 } |
| 826 |
| 827 if (nAge != pWidget->GetAppearanceAge()) { |
| 828 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 829 pFormFiller->ResetPDFWindow(pPageView, |
| 830 nValueAge == pWidget->GetValueAge()); |
| 831 } |
| 832 |
| 833 bReset = TRUE; |
| 834 } |
| 835 } |
| 836 } |
| 837 } |
| 838 |
| 839 void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget, |
| 840 CPDFSDK_PageView* pPageView, |
| 841 FX_BOOL& bReset, |
| 842 FX_BOOL& bExit, |
| 843 FX_UINT nFlag) { |
| 844 ASSERT(pWidget != NULL); |
| 845 |
| 846 if (!m_bNotifying) { |
| 847 if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) { |
| 848 m_bNotifying = TRUE; |
| 849 int nAge = pWidget->GetAppearanceAge(); |
| 850 int nValueAge = pWidget->GetValueAge(); |
| 851 |
| 852 PDFSDK_FieldAction fa; |
| 853 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 854 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 855 |
| 856 pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); |
| 857 m_bNotifying = FALSE; |
| 858 |
| 859 if (!IsValidAnnot(pPageView, pWidget)) { |
| 860 bExit = TRUE; |
| 861 return; |
| 862 } |
| 863 |
| 864 if (nAge != pWidget->GetAppearanceAge()) { |
| 865 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 866 pFormFiller->ResetPDFWindow(pPageView, |
| 867 nValueAge == pWidget->GetValueAge()); |
| 868 } |
| 869 |
| 870 bReset = TRUE; |
| 871 } |
| 872 } |
| 873 } |
| 874 } |
| 875 |
| 876 void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData, |
| 877 FX_BOOL& bExit, |
| 878 FX_DWORD nFlag) { |
| 879 ASSERT(pPrivateData != NULL); |
| 880 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 881 ASSERT(pData->pWidget != NULL); |
| 882 |
| 883 FX_BOOL bTempReset = FALSE; |
| 884 FX_BOOL bTempExit = FALSE; |
| 885 this->OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, |
| 886 nFlag); |
| 887 |
| 888 if (bTempReset || bTempExit) { |
| 889 bExit = TRUE; |
| 890 } |
| 891 } |
| 892 |
| 893 void CFFL_IFormFiller::OnPopupPostOpen(void* pPrivateData, |
| 894 FX_BOOL& bExit, |
| 895 FX_DWORD nFlag) { |
| 896 ASSERT(pPrivateData != NULL); |
| 897 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 898 ASSERT(pData->pWidget != NULL); |
| 899 |
| 900 FX_BOOL bTempReset = FALSE; |
| 901 FX_BOOL bTempExit = FALSE; |
| 902 this->OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, |
| 903 nFlag); |
| 904 |
| 905 if (bTempReset || bTempExit) { |
| 906 bExit = TRUE; |
| 907 } |
| 908 } |
| 909 |
| 910 void CFFL_IFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, |
| 911 CPDFSDK_PageView* pPageView, |
| 912 FX_BOOL& bReset, |
| 913 FX_BOOL& bExit, |
| 914 FX_UINT nFlag) { |
| 915 ASSERT(pWidget != NULL); |
| 916 |
| 917 if (!m_bNotifying) { |
| 918 if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { |
| 919 m_bNotifying = TRUE; |
| 920 int nAge = pWidget->GetAppearanceAge(); |
| 921 int nValueAge = pWidget->GetValueAge(); |
| 922 |
| 923 PDFSDK_FieldAction fa; |
| 924 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 925 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 926 |
| 927 pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); |
| 928 m_bNotifying = FALSE; |
| 929 |
| 930 if (!IsValidAnnot(pPageView, pWidget)) { |
| 931 bExit = TRUE; |
| 932 return; |
| 933 } |
| 934 |
| 935 if (nAge != pWidget->GetAppearanceAge()) { |
| 936 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 937 pFormFiller->ResetPDFWindow(pPageView, |
| 938 nValueAge == pWidget->GetValueAge()); |
| 939 } |
| 940 |
| 941 bReset = TRUE; |
| 942 } |
| 943 } |
| 944 } |
| 945 } |
| 946 |
| 947 void CFFL_IFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget, |
| 948 CPDFSDK_PageView* pPageView, |
| 949 FX_BOOL& bReset, |
| 950 FX_BOOL& bExit, |
| 951 FX_UINT nFlag) { |
| 952 ASSERT(pWidget != NULL); |
| 953 |
| 954 if (!m_bNotifying) { |
| 955 if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) { |
| 956 m_bNotifying = TRUE; |
| 957 int nAge = pWidget->GetAppearanceAge(); |
| 958 int nValueAge = pWidget->GetValueAge(); |
| 959 |
| 960 PDFSDK_FieldAction fa; |
| 961 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 962 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 963 |
| 964 pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); |
| 965 m_bNotifying = FALSE; |
| 966 |
| 967 if (!IsValidAnnot(pPageView, pWidget)) { |
| 968 bExit = TRUE; |
| 969 return; |
| 970 } |
| 971 |
| 972 if (nAge != pWidget->GetAppearanceAge()) { |
| 973 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 974 pFormFiller->ResetPDFWindow(pPageView, |
| 975 nValueAge == pWidget->GetValueAge()); |
| 976 } |
| 977 |
| 978 bReset = TRUE; |
| 979 } |
| 980 } |
| 981 } |
| 982 } |
| 983 |
| 984 #endif |
795 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, | 985 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, |
796 CPDFSDK_Annot* pAnnot) { | 986 CPDFSDK_Annot* pAnnot) { |
797 if (pPageView) | 987 if (pPageView) |
798 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); | 988 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); |
799 | 989 |
800 return FALSE; | 990 return FALSE; |
801 } | 991 } |
802 | 992 |
803 void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, | 993 void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, |
804 CFX_WideString& strChange, | 994 CFX_WideString& strChange, |
805 const CFX_WideString& strChangeEx, | 995 const CFX_WideString& strChangeEx, |
806 int nSelStart, | 996 int nSelStart, |
807 int nSelEnd, | 997 int nSelEnd, |
808 FX_BOOL bKeyDown, | 998 FX_BOOL bKeyDown, |
809 FX_BOOL& bRC, | 999 FX_BOOL& bRC, |
810 FX_BOOL& bExit, | 1000 FX_BOOL& bExit, |
811 FX_DWORD nFlag) { | 1001 FX_DWORD nFlag) { |
812 ASSERT(pPrivateData != NULL); | 1002 ASSERT(pPrivateData != NULL); |
813 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 1003 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
814 ASSERT(pData->pWidget != NULL); | 1004 ASSERT(pData->pWidget != NULL); |
815 | 1005 |
816 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 1006 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
817 ASSERT(pFormFiller != NULL); | 1007 ASSERT(pFormFiller != NULL); |
818 | 1008 |
| 1009 #ifdef PDF_ENABLE_XFA |
| 1010 if (pFormFiller->IsFieldFull(pData->pPageView)) { |
| 1011 FX_BOOL bFullExit = FALSE; |
| 1012 FX_BOOL bFullReset = FALSE; |
| 1013 OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag); |
| 1014 |
| 1015 if (bFullReset || bFullExit) { |
| 1016 bExit = TRUE; |
| 1017 return; |
| 1018 } |
| 1019 } |
| 1020 |
| 1021 #endif |
819 if (!m_bNotifying) { | 1022 if (!m_bNotifying) { |
820 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { | 1023 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { |
821 m_bNotifying = TRUE; | 1024 m_bNotifying = TRUE; |
822 int nAge = pData->pWidget->GetAppearanceAge(); | 1025 int nAge = pData->pWidget->GetAppearanceAge(); |
823 int nValueAge = pData->pWidget->GetValueAge(); | 1026 int nValueAge = pData->pWidget->GetValueAge(); |
824 | 1027 |
825 ASSERT(pData->pPageView != NULL); | 1028 ASSERT(pData->pPageView != NULL); |
826 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); | 1029 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); |
827 | 1030 |
828 PDFSDK_FieldAction fa; | 1031 PDFSDK_FieldAction fa; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 bExit = TRUE; | 1075 bExit = TRUE; |
873 m_bNotifying = FALSE; | 1076 m_bNotifying = FALSE; |
874 return; | 1077 return; |
875 } | 1078 } |
876 } | 1079 } |
877 | 1080 |
878 m_bNotifying = FALSE; | 1081 m_bNotifying = FALSE; |
879 } | 1082 } |
880 } | 1083 } |
881 } | 1084 } |
OLD | NEW |