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_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ | 7 #ifndef FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ |
8 #define FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ | 8 #define FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ |
9 | 9 |
10 #include "public/fpdfview.h" | 10 #include "public/fpdfview.h" |
11 #include "xfa/fxfa/fxfa.h" | 11 #include "xfa/fxfa/fxfa.h" |
12 | 12 |
13 class CPDFXFA_Context; | 13 class CPDFXFA_Context; |
14 class IJS_Context; | 14 class IJS_Context; |
15 | 15 |
16 class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { | 16 class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { |
17 public: | 17 public: |
18 CPDFXFA_DocEnvironment(CPDFXFA_Context*); | 18 CPDFXFA_DocEnvironment(CPDFXFA_Context*); |
19 ~CPDFXFA_DocEnvironment() override; | 19 ~CPDFXFA_DocEnvironment() override; |
20 | 20 |
21 // IXFA_DocEnvironment | 21 // IXFA_DocEnvironment |
22 void SetChangeMark(CXFA_FFDoc* hDoc) override; | 22 void SetChangeMark(CXFA_FFDoc* hDoc) override; |
23 // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. | 23 // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. |
24 void InvalidateRect(CXFA_FFPageView* pPageView, | 24 void InvalidateRect(CXFA_FFPageView* pPageView, |
25 const CFX_RectF& rt, | 25 const CFX_RectF& rt, |
26 uint32_t dwFlags) override; | 26 uint32_t dwFlags) override; |
27 // show or hide caret | 27 // show or hide caret |
28 void DisplayCaret(CXFA_FFWidget* hWidget, | 28 void DisplayCaret(CXFA_FFWidget* hWidget, |
29 FX_BOOL bVisible, | 29 bool bVisible, |
30 const CFX_RectF* pRtAnchor) override; | 30 const CFX_RectF* pRtAnchor) override; |
31 // dwPos: (0:bottom 1:top) | 31 // dwPos: (0:bottom 1:top) |
32 FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget, | 32 bool GetPopupPos(CXFA_FFWidget* hWidget, |
33 FX_FLOAT fMinPopup, | 33 FX_FLOAT fMinPopup, |
34 FX_FLOAT fMaxPopup, | 34 FX_FLOAT fMaxPopup, |
35 const CFX_RectF& rtAnchor, | 35 const CFX_RectF& rtAnchor, |
36 CFX_RectF& rtPopup) override; | 36 CFX_RectF& rtPopup) override; |
37 FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) override; | 37 bool PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) override; |
38 | 38 |
39 // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing | 39 // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing |
40 void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) override; | 40 void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) override; |
41 void WidgetPostAdd(CXFA_FFWidget* hWidget, | 41 void WidgetPostAdd(CXFA_FFWidget* hWidget, |
42 CXFA_WidgetAcc* pWidgetData) override; | 42 CXFA_WidgetAcc* pWidgetData) override; |
43 void WidgetPreRemove(CXFA_FFWidget* hWidget, | 43 void WidgetPreRemove(CXFA_FFWidget* hWidget, |
44 CXFA_WidgetAcc* pWidgetData) override; | 44 CXFA_WidgetAcc* pWidgetData) override; |
45 | 45 |
46 // Host method | 46 // Host method |
47 int32_t CountPages(CXFA_FFDoc* hDoc) override; | 47 int32_t CountPages(CXFA_FFDoc* hDoc) override; |
48 int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override; | 48 int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override; |
49 void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override; | 49 void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override; |
50 FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) override; | 50 bool IsCalculationsEnabled(CXFA_FFDoc* hDoc) override; |
51 void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; | 51 void SetCalculationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override; |
52 void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override; | 52 void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override; |
53 void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override; | 53 void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override; |
54 void ExportData(CXFA_FFDoc* hDoc, | 54 void ExportData(CXFA_FFDoc* hDoc, |
55 const CFX_WideString& wsFilePath, | 55 const CFX_WideString& wsFilePath, |
56 FX_BOOL bXDP) override; | 56 bool bXDP) override; |
57 void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) override; | 57 void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) override; |
58 FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) override; | 58 bool IsValidationsEnabled(CXFA_FFDoc* hDoc) override; |
59 void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; | 59 void SetValidationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override; |
60 void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; | 60 void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; |
61 void Print(CXFA_FFDoc* hDoc, | 61 void Print(CXFA_FFDoc* hDoc, |
62 int32_t nStartPage, | 62 int32_t nStartPage, |
63 int32_t nEndPage, | 63 int32_t nEndPage, |
64 uint32_t dwOptions) override; | 64 uint32_t dwOptions) override; |
65 FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) override; | 65 FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) override; |
66 | 66 |
67 /** | 67 /** |
68 *Submit data to email, http, ftp. | 68 *Submit data to email, http, ftp. |
69 * @param[in] hDoc The document handler. | 69 * @param[in] hDoc The document handler. |
70 * @param[in] eFormat Determines the format in which the data will be | 70 * @param[in] eFormat Determines the format in which the data will be |
71 *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml... | 71 *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml... |
72 * @param[in] wsTarget The URL to which the data will be submitted. | 72 * @param[in] wsTarget The URL to which the data will be submitted. |
73 * @param[in] eEncoding The encoding of text content. | 73 * @param[in] eEncoding The encoding of text content. |
74 * @param[in] pXDPContent Controls what subset of the data is submitted, used | 74 * @param[in] pXDPContent Controls what subset of the data is submitted, used |
75 *only when the format property is xdp. | 75 *only when the format property is xdp. |
76 * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted | 76 * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted |
77 *content or not. | 77 *content or not. |
78 */ | 78 */ |
79 FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; | 79 bool SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; |
80 | 80 |
81 FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, | 81 bool GetGlobalProperty(CXFA_FFDoc* hDoc, |
82 const CFX_ByteStringC& szPropName, | 82 const CFX_ByteStringC& szPropName, |
83 CFXJSE_Value* pValue) override; | 83 CFXJSE_Value* pValue) override; |
84 FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, | 84 bool SetGlobalProperty(CXFA_FFDoc* hDoc, |
85 const CFX_ByteStringC& szPropName, | 85 const CFX_ByteStringC& szPropName, |
86 CFXJSE_Value* pValue) override; | 86 CFXJSE_Value* pValue) override; |
87 | 87 |
88 IFX_SeekableReadStream* OpenLinkedFile(CXFA_FFDoc* hDoc, | 88 IFX_SeekableReadStream* OpenLinkedFile(CXFA_FFDoc* hDoc, |
89 const CFX_WideString& wsLink) override; | 89 const CFX_WideString& wsLink) override; |
90 | 90 |
91 private: | 91 private: |
92 FX_BOOL OnBeforeNotifySubmit(); | 92 bool OnBeforeNotifySubmit(); |
93 void OnAfterNotifySubmit(); | 93 void OnAfterNotifySubmit(); |
94 FX_BOOL NotifySubmit(FX_BOOL bPrevOrPost); | 94 bool NotifySubmit(bool bPrevOrPost); |
95 FX_BOOL SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); | 95 bool SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); |
96 FX_BOOL MailToInfo(CFX_WideString& csURL, | 96 bool MailToInfo(CFX_WideString& csURL, |
97 CFX_WideString& csToAddress, | 97 CFX_WideString& csToAddress, |
98 CFX_WideString& csCCAddress, | 98 CFX_WideString& csCCAddress, |
99 CFX_WideString& csBCCAddress, | 99 CFX_WideString& csBCCAddress, |
100 CFX_WideString& csSubject, | 100 CFX_WideString& csSubject, |
101 CFX_WideString& csMsg); | 101 CFX_WideString& csMsg); |
102 FX_BOOL ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, | 102 bool ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, |
103 int fileType, | 103 int fileType, |
104 FPDF_DWORD encodeType, | 104 FPDF_DWORD encodeType, |
105 FPDF_DWORD flag); | 105 FPDF_DWORD flag); |
106 void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); | 106 void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); |
107 | 107 |
108 CPDFXFA_Context* const m_pContext; // Not owned; | 108 CPDFXFA_Context* const m_pContext; // Not owned; |
109 IJS_Context* m_pJSContext; | 109 IJS_Context* m_pJSContext; |
110 }; | 110 }; |
111 | 111 |
112 #endif // FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ | 112 #endif // FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ |
OLD | NEW |