OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 FPDFSDK_CPDFSDK_INTERFORM_H_ | 7 #ifndef FPDFSDK_CPDFSDK_INTERFORM_H_ |
8 #define FPDFSDK_CPDFSDK_INTERFORM_H_ | 8 #define FPDFSDK_CPDFSDK_INTERFORM_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "core/fpdfdoc/cpdf_action.h" | 13 #include "core/fpdfdoc/cpdf_action.h" |
14 #include "core/fpdfdoc/ipdf_formnotify.h" | 14 #include "core/fpdfdoc/ipdf_formnotify.h" |
15 #include "core/fxcrt/fx_basic.h" | 15 #include "core/fxcrt/fx_basic.h" |
16 #include "core/fxge/fx_dib.h" | 16 #include "core/fxge/fx_dib.h" |
17 | 17 |
18 class CPDF_Dictionary; | 18 class CPDF_Dictionary; |
19 class CPDF_FormControl; | 19 class CPDF_FormControl; |
20 class CPDF_FormField; | 20 class CPDF_FormField; |
21 class CPDF_InterForm; | 21 class CPDF_InterForm; |
22 class CPDF_Object; | 22 class CPDF_Object; |
23 class CPDFSDK_Document; | 23 class CPDFSDK_FormFillEnvironment; |
24 class CPDFSDK_Widget; | 24 class CPDFSDK_Widget; |
25 | 25 |
26 #ifdef PDF_ENABLE_XFA | 26 #ifdef PDF_ENABLE_XFA |
27 class CPDFSDK_XFAWidget; | 27 class CPDFSDK_XFAWidget; |
28 class CXFA_FFWidget; | 28 class CXFA_FFWidget; |
29 #endif // PDF_ENABLE_XFA | 29 #endif // PDF_ENABLE_XFA |
30 | 30 |
31 class CPDFSDK_InterForm : public IPDF_FormNotify { | 31 class CPDFSDK_InterForm : public IPDF_FormNotify { |
32 public: | 32 public: |
33 explicit CPDFSDK_InterForm(CPDFSDK_Document* pDocument); | 33 explicit CPDFSDK_InterForm(CPDFSDK_FormFillEnvironment* pFormFillEnv); |
34 ~CPDFSDK_InterForm() override; | 34 ~CPDFSDK_InterForm() override; |
35 | 35 |
36 CPDF_InterForm* GetInterForm() const { return m_pInterForm.get(); } | 36 CPDF_InterForm* GetInterForm() const { return m_pInterForm.get(); } |
37 CPDFSDK_Document* GetDocument() const { return m_pDocument; } | 37 CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv; } |
38 | 38 |
39 FX_BOOL HighlightWidgets(); | 39 FX_BOOL HighlightWidgets(); |
40 | 40 |
41 CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const; | 41 CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const; |
42 CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl, | 42 CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl, |
43 bool createIfNeeded) const; | 43 bool createIfNeeded) const; |
44 void GetWidgets(const CFX_WideString& sFieldName, | 44 void GetWidgets(const CFX_WideString& sFieldName, |
45 std::vector<CPDFSDK_Widget*>* widgets) const; | 45 std::vector<CPDFSDK_Widget*>* widgets) const; |
46 void GetWidgets(CPDF_FormField* pField, | 46 void GetWidgets(CPDF_FormField* pField, |
47 std::vector<CPDFSDK_Widget*>* widgets) const; | 47 std::vector<CPDFSDK_Widget*>* widgets) const; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void AfterFormImportData(CPDF_InterForm* pForm) override; | 115 void AfterFormImportData(CPDF_InterForm* pForm) override; |
116 | 116 |
117 FX_BOOL FDFToURLEncodedData(CFX_WideString csFDFFile, | 117 FX_BOOL FDFToURLEncodedData(CFX_WideString csFDFFile, |
118 CFX_WideString csTxtFile); | 118 CFX_WideString csTxtFile); |
119 FX_BOOL FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize); | 119 FX_BOOL FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize); |
120 int GetPageIndexByAnnotDict(CPDF_Document* pDocument, | 120 int GetPageIndexByAnnotDict(CPDF_Document* pDocument, |
121 CPDF_Dictionary* pAnnotDict) const; | 121 CPDF_Dictionary* pAnnotDict) const; |
122 | 122 |
123 using CPDFSDK_WidgetMap = std::map<CPDF_FormControl*, CPDFSDK_Widget*>; | 123 using CPDFSDK_WidgetMap = std::map<CPDF_FormControl*, CPDFSDK_Widget*>; |
124 | 124 |
125 CPDFSDK_Document* m_pDocument; | 125 CPDFSDK_FormFillEnvironment* m_pFormFillEnv; // Not owned. |
126 std::unique_ptr<CPDF_InterForm> m_pInterForm; | 126 std::unique_ptr<CPDF_InterForm> m_pInterForm; |
127 CPDFSDK_WidgetMap m_Map; | 127 CPDFSDK_WidgetMap m_Map; |
128 #ifdef PDF_ENABLE_XFA | 128 #ifdef PDF_ENABLE_XFA |
129 std::map<CXFA_FFWidget*, CPDFSDK_XFAWidget*> m_XFAMap; | 129 std::map<CXFA_FFWidget*, CPDFSDK_XFAWidget*> m_XFAMap; |
130 FX_BOOL m_bXfaCalculate; | 130 FX_BOOL m_bXfaCalculate; |
131 FX_BOOL m_bXfaValidationsEnabled; | 131 FX_BOOL m_bXfaValidationsEnabled; |
132 static const int kNumFieldTypes = 7; | 132 static const int kNumFieldTypes = 7; |
133 #else // PDF_ENABLE_XFA | 133 #else // PDF_ENABLE_XFA |
134 static const int kNumFieldTypes = 6; | 134 static const int kNumFieldTypes = 6; |
135 #endif // PDF_ENABLE_XFA | 135 #endif // PDF_ENABLE_XFA |
136 FX_BOOL m_bCalculate; | 136 FX_BOOL m_bCalculate; |
137 FX_BOOL m_bBusy; | 137 FX_BOOL m_bBusy; |
138 | 138 |
139 FX_COLORREF m_aHighlightColor[kNumFieldTypes]; | 139 FX_COLORREF m_aHighlightColor[kNumFieldTypes]; |
140 uint8_t m_iHighlightAlpha; | 140 uint8_t m_iHighlightAlpha; |
141 FX_BOOL m_bNeedHightlight[kNumFieldTypes]; | 141 FX_BOOL m_bNeedHightlight[kNumFieldTypes]; |
142 }; | 142 }; |
143 | 143 |
144 #endif // FPDFSDK_CPDFSDK_INTERFORM_H_ | 144 #endif // FPDFSDK_CPDFSDK_INTERFORM_H_ |
OLD | NEW |