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 #ifndef CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ | 7 #ifndef CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ |
8 #define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ | 8 #define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 Text, | 727 Text, |
728 RichText, | 728 RichText, |
729 File, | 729 File, |
730 ListBox, | 730 ListBox, |
731 ComboBox, | 731 ComboBox, |
732 Sign | 732 Sign |
733 }; | 733 }; |
734 | 734 |
735 CFX_WideString GetFullName(); | 735 CFX_WideString GetFullName(); |
736 | 736 |
737 Type GetType() { return m_Type; } | 737 Type GetType() const { return m_Type; } |
738 | 738 FX_DWORD GetFlags() const { return m_Flags; } |
739 FX_DWORD GetFlags() { return m_Flags; } | |
740 | 739 |
741 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } | 740 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } |
742 | |
743 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } | 741 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } |
744 | 742 |
745 FX_BOOL ResetField(FX_BOOL bNotify = FALSE); | 743 FX_BOOL ResetField(FX_BOOL bNotify = FALSE); |
746 | 744 |
747 int CountControls() { return m_ControlList.GetSize(); } | 745 int CountControls() { return m_ControlList.GetSize(); } |
748 | 746 |
749 CPDF_FormControl* GetControl(int index) { return m_ControlList.GetAt(index); } | 747 CPDF_FormControl* GetControl(int index) { return m_ControlList.GetAt(index); } |
750 | 748 |
751 int GetControlIndex(const CPDF_FormControl* pControl); | 749 int GetControlIndex(const CPDF_FormControl* pControl); |
752 | 750 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 | 790 |
793 CFX_WideString GetOptionLabel(int index); | 791 CFX_WideString GetOptionLabel(int index); |
794 | 792 |
795 CFX_WideString GetOptionValue(int index); | 793 CFX_WideString GetOptionValue(int index); |
796 | 794 |
797 int FindOption(CFX_WideString csOptLabel); | 795 int FindOption(CFX_WideString csOptLabel); |
798 | 796 |
799 int FindOptionValue(const CFX_WideString& csOptValue, int iStartIndex = 0); | 797 int FindOptionValue(const CFX_WideString& csOptValue, int iStartIndex = 0); |
800 | 798 |
801 FX_BOOL CheckControl(int iControlIndex, | 799 FX_BOOL CheckControl(int iControlIndex, |
802 FX_BOOL bChecked, | 800 bool bChecked, |
803 FX_BOOL bNotify = FALSE); | 801 bool bNotify = false); |
804 | 802 |
805 int GetTopVisibleIndex(); | 803 int GetTopVisibleIndex(); |
806 | 804 |
807 int CountSelectedOptions(); | 805 int CountSelectedOptions(); |
808 | 806 |
809 int GetSelectedOptionIndex(int index); | 807 int GetSelectedOptionIndex(int index); |
810 | 808 |
811 FX_BOOL IsOptionSelected(int iOptIndex); | 809 FX_BOOL IsOptionSelected(int iOptIndex); |
812 | 810 |
813 FX_BOOL SelectOption(int iOptIndex, | 811 FX_BOOL SelectOption(int iOptIndex, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 CPDF_Dictionary* m_pDict; | 886 CPDF_Dictionary* m_pDict; |
889 }; | 887 }; |
890 | 888 |
891 #define TEXTPOS_CAPTION 0 | 889 #define TEXTPOS_CAPTION 0 |
892 #define TEXTPOS_ICON 1 | 890 #define TEXTPOS_ICON 1 |
893 #define TEXTPOS_BELOW 2 | 891 #define TEXTPOS_BELOW 2 |
894 #define TEXTPOS_ABOVE 3 | 892 #define TEXTPOS_ABOVE 3 |
895 #define TEXTPOS_RIGHT 4 | 893 #define TEXTPOS_RIGHT 4 |
896 #define TEXTPOS_LEFT 5 | 894 #define TEXTPOS_LEFT 5 |
897 #define TEXTPOS_OVERLAID 6 | 895 #define TEXTPOS_OVERLAID 6 |
| 896 |
898 class CPDF_FormControl { | 897 class CPDF_FormControl { |
899 public: | 898 public: |
900 CPDF_FormField::Type GetType() { return m_pField->GetType(); } | 899 enum HighlightingMode { None = 0, Invert, Outline, Push, Toggle }; |
901 | 900 |
| 901 CPDF_FormField::Type GetType() const { return m_pField->GetType(); } |
902 CPDF_InterForm* GetInterForm() const { return m_pForm; } | 902 CPDF_InterForm* GetInterForm() const { return m_pForm; } |
903 | |
904 CPDF_FormField* GetField() const { return m_pField; } | 903 CPDF_FormField* GetField() const { return m_pField; } |
905 | |
906 CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; } | 904 CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; } |
907 | |
908 CFX_FloatRect GetRect() const; | 905 CFX_FloatRect GetRect() const; |
909 | 906 |
910 void DrawControl(CFX_RenderDevice* pDevice, | 907 void DrawControl(CFX_RenderDevice* pDevice, |
911 CFX_Matrix* pMatrix, | 908 CFX_Matrix* pMatrix, |
912 CPDF_Page* pPage, | 909 CPDF_Page* pPage, |
913 CPDF_Annot::AppearanceMode mode, | 910 CPDF_Annot::AppearanceMode mode, |
914 const CPDF_RenderOptions* pOptions = NULL); | 911 const CPDF_RenderOptions* pOptions = NULL); |
915 | 912 |
916 CFX_ByteString GetCheckedAPState(); | 913 CFX_ByteString GetCheckedAPState(); |
917 | |
918 CFX_WideString GetExportValue(); | 914 CFX_WideString GetExportValue(); |
919 | 915 |
920 FX_BOOL IsChecked(); | 916 bool IsChecked() const; |
921 | 917 bool IsDefaultChecked() const; |
922 FX_BOOL IsDefaultChecked(); | |
923 | |
924 enum HighlightingMode { None = 0, Invert, Outline, Push, Toggle }; | |
925 | 918 |
926 HighlightingMode GetHighlightingMode(); | 919 HighlightingMode GetHighlightingMode(); |
927 | |
928 bool HasMKEntry(CFX_ByteString csEntry) const; | 920 bool HasMKEntry(CFX_ByteString csEntry) const; |
929 | |
930 int GetRotation(); | 921 int GetRotation(); |
931 | 922 |
932 inline FX_ARGB GetBorderColor(int& iColorType) { | 923 inline FX_ARGB GetBorderColor(int& iColorType) { |
933 return GetColor(iColorType, "BC"); | 924 return GetColor(iColorType, "BC"); |
934 } | 925 } |
935 | 926 |
936 FX_FLOAT GetOriginalBorderColor(int index) { | 927 FX_FLOAT GetOriginalBorderColor(int index) { |
937 return GetOriginalColor(index, "BC"); | 928 return GetOriginalColor(index, "BC"); |
938 } | 929 } |
939 | 930 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 966 |
976 CPDF_DefaultAppearance GetDefaultAppearance(); | 967 CPDF_DefaultAppearance GetDefaultAppearance(); |
977 | 968 |
978 CPDF_Font* GetDefaultControlFont(); | 969 CPDF_Font* GetDefaultControlFont(); |
979 | 970 |
980 int GetControlAlignment(); | 971 int GetControlAlignment(); |
981 | 972 |
982 protected: | 973 protected: |
983 CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict); | 974 CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict); |
984 | 975 |
985 CFX_ByteString GetOnStateName(); | 976 CFX_ByteString GetOnStateName() const; |
986 | |
987 void SetOnStateName(const CFX_ByteString& csOn); | 977 void SetOnStateName(const CFX_ByteString& csOn); |
988 | 978 |
989 void CheckControl(FX_BOOL bChecked); | 979 void CheckControl(FX_BOOL bChecked); |
990 | 980 |
991 FX_ARGB GetColor(int& iColorType, CFX_ByteString csEntry); | 981 FX_ARGB GetColor(int& iColorType, CFX_ByteString csEntry); |
992 | 982 |
993 FX_FLOAT GetOriginalColor(int index, CFX_ByteString csEntry); | 983 FX_FLOAT GetOriginalColor(int index, CFX_ByteString csEntry); |
994 | 984 |
995 void GetOriginalColor(int& iColorType, | 985 void GetOriginalColor(int& iColorType, |
996 FX_FLOAT fc[4], | 986 FX_FLOAT fc[4], |
997 CFX_ByteString csEntry); | 987 CFX_ByteString csEntry); |
998 | 988 |
999 CFX_WideString GetCaption(CFX_ByteString csEntry); | 989 CFX_WideString GetCaption(CFX_ByteString csEntry); |
1000 | 990 |
1001 CPDF_Stream* GetIcon(CFX_ByteString csEntry); | 991 CPDF_Stream* GetIcon(CFX_ByteString csEntry); |
1002 | 992 |
1003 CPDF_ApSettings GetMK() const; | 993 CPDF_ApSettings GetMK() const; |
1004 | 994 |
1005 CPDF_InterForm* m_pForm; | 995 CPDF_InterForm* m_pForm; |
1006 | 996 |
1007 CPDF_FormField* m_pField; | 997 CPDF_FormField* m_pField; |
1008 | 998 |
1009 CPDF_Dictionary* m_pWidgetDict; | 999 CPDF_Dictionary* m_pWidgetDict; |
1010 friend class CPDF_InterForm; | 1000 friend class CPDF_InterForm; |
1011 friend class CPDF_FormField; | 1001 friend class CPDF_FormField; |
1012 }; | 1002 }; |
| 1003 |
1013 class CPDF_FormNotify { | 1004 class CPDF_FormNotify { |
1014 public: | 1005 public: |
1015 virtual ~CPDF_FormNotify() {} | 1006 virtual ~CPDF_FormNotify() {} |
1016 | 1007 |
1017 virtual int BeforeValueChange(const CPDF_FormField* pField, | 1008 virtual int BeforeValueChange(const CPDF_FormField* pField, |
1018 CFX_WideString& csValue) { | 1009 CFX_WideString& csValue) { |
1019 return 0; | 1010 return 0; |
1020 } | 1011 } |
1021 | |
1022 virtual int AfterValueChange(const CPDF_FormField* pField) { return 0; } | 1012 virtual int AfterValueChange(const CPDF_FormField* pField) { return 0; } |
1023 | 1013 |
1024 virtual int BeforeSelectionChange(const CPDF_FormField* pField, | 1014 virtual int BeforeSelectionChange(const CPDF_FormField* pField, |
1025 CFX_WideString& csValue) { | 1015 CFX_WideString& csValue) { |
1026 return 0; | 1016 return 0; |
1027 } | 1017 } |
1028 | |
1029 virtual int AfterSelectionChange(const CPDF_FormField* pField) { return 0; } | 1018 virtual int AfterSelectionChange(const CPDF_FormField* pField) { return 0; } |
1030 | 1019 |
1031 virtual int AfterCheckedStatusChange(const CPDF_FormField* pField, | 1020 virtual void AfterCheckedStatusChange(CPDF_FormField* pField) {} |
1032 const CFX_ByteArray& statusArray) { | |
1033 return 0; | |
1034 } | |
1035 | |
1036 virtual int BeforeFormReset(const CPDF_InterForm* pForm) { return 0; } | 1021 virtual int BeforeFormReset(const CPDF_InterForm* pForm) { return 0; } |
1037 | |
1038 virtual int AfterFormReset(const CPDF_InterForm* pForm) { return 0; } | 1022 virtual int AfterFormReset(const CPDF_InterForm* pForm) { return 0; } |
1039 | |
1040 virtual int BeforeFormImportData(const CPDF_InterForm* pForm) { return 0; } | 1023 virtual int BeforeFormImportData(const CPDF_InterForm* pForm) { return 0; } |
1041 | |
1042 virtual int AfterFormImportData(const CPDF_InterForm* pForm) { return 0; } | 1024 virtual int AfterFormImportData(const CPDF_InterForm* pForm) { return 0; } |
1043 }; | 1025 }; |
| 1026 |
1044 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict); | 1027 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict); |
1045 class CPDF_PageLabel { | 1028 class CPDF_PageLabel { |
1046 public: | 1029 public: |
1047 explicit CPDF_PageLabel(CPDF_Document* pDocument) { m_pDocument = pDocument; } | 1030 explicit CPDF_PageLabel(CPDF_Document* pDocument) { m_pDocument = pDocument; } |
1048 | 1031 |
1049 CFX_WideString GetLabel(int nPage) const; | 1032 CFX_WideString GetLabel(int nPage) const; |
1050 | 1033 |
1051 int32_t GetPageByLabel(const CFX_ByteStringC& bsLabel) const; | 1034 int32_t GetPageByLabel(const CFX_ByteStringC& bsLabel) const; |
1052 | 1035 |
1053 int32_t GetPageByLabel(const CFX_WideStringC& wsLabel) const; | 1036 int32_t GetPageByLabel(const CFX_WideStringC& wsLabel) const; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 CFX_WideString GetCaption(const CFX_ByteStringC& csEntry) const; | 1131 CFX_WideString GetCaption(const CFX_ByteStringC& csEntry) const; |
1149 | 1132 |
1150 CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry) const; | 1133 CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry) const; |
1151 | 1134 |
1152 CPDF_Dictionary* const m_pDict; | 1135 CPDF_Dictionary* const m_pDict; |
1153 }; | 1136 }; |
1154 | 1137 |
1155 CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath); | 1138 CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath); |
1156 | 1139 |
1157 #endif // CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ | 1140 #endif // CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ |
OLD | NEW |