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 FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ | 7 #ifndef FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ |
8 #define FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ | 8 #define FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "core/fxcrt/include/fx_basic.h" | 13 #include "core/fxcrt/include/fx_basic.h" |
14 #include "core/include/fpdfdoc/fpdf_doc.h" | 14 #include "core/include/fpdfdoc/fpdf_doc.h" |
15 #include "core/include/fxge/fx_dib.h" | 15 #include "core/include/fxge/fx_dib.h" |
16 #include "fpdfsdk/include/fsdk_baseannot.h" | 16 #include "fpdfsdk/include/fsdk_baseannot.h" |
17 | 17 |
| 18 #ifdef PDF_ENABLE_XFA |
| 19 #include "xfa/include/fxfa/xfa_ffwidgethandler.h" |
| 20 #endif // PDF_ENABLE_XFA |
| 21 |
18 #if _FX_OS_ == _FX_ANDROID_ | 22 #if _FX_OS_ == _FX_ANDROID_ |
19 #include "time.h" | 23 #include "time.h" |
20 #else | 24 #else |
21 #include <ctime> | 25 #include <ctime> |
22 #endif | 26 #endif |
23 | 27 |
24 class CPDFSDK_Annot; | 28 class CPDFSDK_Annot; |
25 class CPDFSDK_Document; | 29 class CPDFSDK_Document; |
26 class CPDFSDK_InterForm; | 30 class CPDFSDK_InterForm; |
27 class CPDFSDK_PageView; | 31 class CPDFSDK_PageView; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 int nSelStart; // in[out] | 64 int nSelStart; // in[out] |
61 CFX_WideString sValue; // in[out] | 65 CFX_WideString sValue; // in[out] |
62 FX_BOOL bWillCommit; // in | 66 FX_BOOL bWillCommit; // in |
63 FX_BOOL bFieldFull; // in | 67 FX_BOOL bFieldFull; // in |
64 FX_BOOL bRC; // in[out] | 68 FX_BOOL bRC; // in[out] |
65 }; | 69 }; |
66 | 70 |
67 class CPDFSDK_Widget : public CPDFSDK_BAAnnot { | 71 class CPDFSDK_Widget : public CPDFSDK_BAAnnot { |
68 public: | 72 public: |
69 #ifdef PDF_ENABLE_XFA | 73 #ifdef PDF_ENABLE_XFA |
70 IXFA_Widget* GetMixXFAWidget() const; | 74 CXFA_FFWidget* GetMixXFAWidget() const; |
71 IXFA_Widget* GetGroupMixXFAWidget(); | 75 CXFA_FFWidget* GetGroupMixXFAWidget(); |
72 IXFA_WidgetHandler* GetXFAWidgetHandler() const; | 76 CXFA_FFWidgetHandler* GetXFAWidgetHandler() const; |
73 | 77 |
74 FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); | 78 FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); |
75 FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, | 79 FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, |
76 PDFSDK_FieldAction& data, | 80 PDFSDK_FieldAction& data, |
77 CPDFSDK_PageView* pPageView); | 81 CPDFSDK_PageView* pPageView); |
78 | 82 |
79 void Synchronize(FX_BOOL bSynchronizeElse); | 83 void Synchronize(FX_BOOL bSynchronizeElse); |
80 void SynchronizeXFAValue(); | 84 void SynchronizeXFAValue(); |
81 void SynchronizeXFAItems(); | 85 void SynchronizeXFAItems(); |
82 | 86 |
83 static void SynchronizeXFAValue(IXFA_DocView* pXFADocView, | 87 static void SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, |
84 IXFA_Widget* hWidget, | 88 CXFA_FFWidget* hWidget, |
85 CPDF_FormField* pFormField, | 89 CPDF_FormField* pFormField, |
86 CPDF_FormControl* pFormControl); | 90 CPDF_FormControl* pFormControl); |
87 static void SynchronizeXFAItems(IXFA_DocView* pXFADocView, | 91 static void SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, |
88 IXFA_Widget* hWidget, | 92 CXFA_FFWidget* hWidget, |
89 CPDF_FormField* pFormField, | 93 CPDF_FormField* pFormField, |
90 CPDF_FormControl* pFormControl); | 94 CPDF_FormControl* pFormControl); |
91 #endif // PDF_ENABLE_XFA | 95 #endif // PDF_ENABLE_XFA |
92 | 96 |
93 CPDFSDK_Widget(CPDF_Annot* pAnnot, | 97 CPDFSDK_Widget(CPDF_Annot* pAnnot, |
94 CPDFSDK_PageView* pPageView, | 98 CPDFSDK_PageView* pPageView, |
95 CPDFSDK_InterForm* pInterForm); | 99 CPDFSDK_InterForm* pInterForm); |
96 ~CPDFSDK_Widget() override; | 100 ~CPDFSDK_Widget() override; |
97 | 101 |
98 // CPDFSDK_Annot | 102 // CPDFSDK_Annot |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 211 |
208 FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY); | 212 FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY); |
209 | 213 |
210 private: | 214 private: |
211 CPDFSDK_InterForm* m_pInterForm; | 215 CPDFSDK_InterForm* m_pInterForm; |
212 FX_BOOL m_bAppModified; | 216 FX_BOOL m_bAppModified; |
213 int32_t m_nAppAge; | 217 int32_t m_nAppAge; |
214 int32_t m_nValueAge; | 218 int32_t m_nValueAge; |
215 | 219 |
216 #ifdef PDF_ENABLE_XFA | 220 #ifdef PDF_ENABLE_XFA |
217 mutable IXFA_Widget* m_hMixXFAWidget; | 221 mutable CXFA_FFWidget* m_hMixXFAWidget; |
218 mutable IXFA_WidgetHandler* m_pWidgetHandler; | 222 mutable CXFA_FFWidgetHandler* m_pWidgetHandler; |
219 #endif // PDF_ENABLE_XFA | 223 #endif // PDF_ENABLE_XFA |
220 }; | 224 }; |
221 | 225 |
222 #ifdef PDF_ENABLE_XFA | 226 #ifdef PDF_ENABLE_XFA |
223 class CPDFSDK_XFAWidget : public CPDFSDK_Annot { | 227 class CPDFSDK_XFAWidget : public CPDFSDK_Annot { |
224 public: | 228 public: |
225 CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, | 229 CPDFSDK_XFAWidget(CXFA_FFWidget* pAnnot, |
226 CPDFSDK_PageView* pPageView, | 230 CPDFSDK_PageView* pPageView, |
227 CPDFSDK_InterForm* pInterForm); | 231 CPDFSDK_InterForm* pInterForm); |
228 ~CPDFSDK_XFAWidget() override {} | 232 ~CPDFSDK_XFAWidget() override {} |
229 | 233 |
230 FX_BOOL IsXFAField() override; | 234 FX_BOOL IsXFAField() override; |
231 IXFA_Widget* GetXFAWidget() const override { return m_hXFAWidget; } | 235 CXFA_FFWidget* GetXFAWidget() const override { return m_hXFAWidget; } |
232 CFX_ByteString GetType() const override; | 236 CFX_ByteString GetType() const override; |
233 CFX_ByteString GetSubType() const override { return ""; } | 237 CFX_ByteString GetSubType() const override { return ""; } |
234 CFX_FloatRect GetRect() const override; | 238 CFX_FloatRect GetRect() const override; |
235 | 239 |
236 CPDFSDK_InterForm* GetInterForm() { return m_pInterForm; } | 240 CPDFSDK_InterForm* GetInterForm() { return m_pInterForm; } |
237 | 241 |
238 private: | 242 private: |
239 CPDFSDK_InterForm* m_pInterForm; | 243 CPDFSDK_InterForm* m_pInterForm; |
240 IXFA_Widget* m_hXFAWidget; | 244 CXFA_FFWidget* m_hXFAWidget; |
241 }; | 245 }; |
242 #define CPDFSDK_XFAWidgetMap \ | 246 #define CPDFSDK_XFAWidgetMap \ |
243 CFX_MapPtrTemplate<IXFA_Widget*, CPDFSDK_XFAWidget*> | 247 CFX_MapPtrTemplate<CXFA_FFWidget*, CPDFSDK_XFAWidget*> |
244 #define CPDFSDK_FieldSynchronizeMap CFX_MapPtrTemplate<CPDF_FormField*, int> | 248 #define CPDFSDK_FieldSynchronizeMap CFX_MapPtrTemplate<CPDF_FormField*, int> |
245 #endif // PDF_ENABLE_XFA | 249 #endif // PDF_ENABLE_XFA |
246 | 250 |
247 class CPDFSDK_InterForm : public CPDF_FormNotify { | 251 class CPDFSDK_InterForm : public CPDF_FormNotify { |
248 public: | 252 public: |
249 explicit CPDFSDK_InterForm(CPDFSDK_Document* pDocument); | 253 explicit CPDFSDK_InterForm(CPDFSDK_Document* pDocument); |
250 ~CPDFSDK_InterForm() override; | 254 ~CPDFSDK_InterForm() override; |
251 | 255 |
252 CPDF_InterForm* GetInterForm() const { return m_pInterForm; } | 256 CPDF_InterForm* GetInterForm() const { return m_pInterForm; } |
253 CPDFSDK_Document* GetDocument() const { return m_pDocument; } | 257 CPDFSDK_Document* GetDocument() const { return m_pDocument; } |
254 | 258 |
255 FX_BOOL HighlightWidgets(); | 259 FX_BOOL HighlightWidgets(); |
256 | 260 |
257 CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const; | 261 CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const; |
258 CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const; | 262 CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const; |
259 void GetWidgets(const CFX_WideString& sFieldName, | 263 void GetWidgets(const CFX_WideString& sFieldName, |
260 std::vector<CPDFSDK_Widget*>* widgets) const; | 264 std::vector<CPDFSDK_Widget*>* widgets) const; |
261 void GetWidgets(CPDF_FormField* pField, | 265 void GetWidgets(CPDF_FormField* pField, |
262 std::vector<CPDFSDK_Widget*>* widgets) const; | 266 std::vector<CPDFSDK_Widget*>* widgets) const; |
263 | 267 |
264 void AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget); | 268 void AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget); |
265 void RemoveMap(CPDF_FormControl* pControl); | 269 void RemoveMap(CPDF_FormControl* pControl); |
266 | 270 |
267 void EnableCalculate(FX_BOOL bEnabled); | 271 void EnableCalculate(FX_BOOL bEnabled); |
268 FX_BOOL IsCalculateEnabled() const; | 272 FX_BOOL IsCalculateEnabled() const; |
269 | 273 |
270 #ifdef PDF_ENABLE_XFA | 274 #ifdef PDF_ENABLE_XFA |
271 void AddXFAMap(IXFA_Widget* hWidget, CPDFSDK_XFAWidget* pWidget); | 275 void AddXFAMap(CXFA_FFWidget* hWidget, CPDFSDK_XFAWidget* pWidget); |
272 void RemoveXFAMap(IXFA_Widget* hWidget); | 276 void RemoveXFAMap(CXFA_FFWidget* hWidget); |
273 CPDFSDK_XFAWidget* GetXFAWidget(IXFA_Widget* hWidget); | 277 CPDFSDK_XFAWidget* GetXFAWidget(CXFA_FFWidget* hWidget); |
274 void XfaEnableCalculate(FX_BOOL bEnabled); | 278 void XfaEnableCalculate(FX_BOOL bEnabled); |
275 FX_BOOL IsXfaCalculateEnabled() const; | 279 FX_BOOL IsXfaCalculateEnabled() const; |
276 FX_BOOL IsXfaValidationsEnabled(); | 280 FX_BOOL IsXfaValidationsEnabled(); |
277 void XfaSetValidationsEnabled(FX_BOOL bEnabled); | 281 void XfaSetValidationsEnabled(FX_BOOL bEnabled); |
278 #endif // PDF_ENABLE_XFA | 282 #endif // PDF_ENABLE_XFA |
279 | 283 |
280 FX_BOOL OnKeyStrokeCommit(CPDF_FormField* pFormField, | 284 FX_BOOL OnKeyStrokeCommit(CPDF_FormField* pFormField, |
281 const CFX_WideString& csValue); | 285 const CFX_WideString& csValue); |
282 FX_BOOL OnValidate(CPDF_FormField* pFormField, const CFX_WideString& csValue); | 286 FX_BOOL OnValidate(CPDF_FormField* pFormField, const CFX_WideString& csValue); |
283 void OnCalculate(CPDF_FormField* pFormField = NULL); | 287 void OnCalculate(CPDF_FormField* pFormField = NULL); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 const CPDFSDK_Annot* p2); | 394 const CPDFSDK_Annot* p2); |
391 | 395 |
392 TabOrder m_eTabOrder; | 396 TabOrder m_eTabOrder; |
393 CPDFSDK_PageView* m_pPageView; | 397 CPDFSDK_PageView* m_pPageView; |
394 CFX_ByteString m_sType; | 398 CFX_ByteString m_sType; |
395 CFX_ByteString m_sSubType; | 399 CFX_ByteString m_sSubType; |
396 std::vector<CPDFSDK_Annot*> m_Annots; | 400 std::vector<CPDFSDK_Annot*> m_Annots; |
397 }; | 401 }; |
398 | 402 |
399 #endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ | 403 #endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ |
OLD | NEW |