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_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ | 7 #ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ |
8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ | 8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ |
9 | 9 |
10 #include "xfa/fxfa/include/xfa_ffdoc.h" | 10 #include "xfa/fxfa/include/xfa_ffdoc.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 CFX_PointF ptPopup, | 69 CFX_PointF ptPopup, |
70 const CFX_RectF* pRectExclude = nullptr) override; | 70 const CFX_RectF* pRectExclude = nullptr) override; |
71 | 71 |
72 // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing | 72 // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing |
73 void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) override; | 73 void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) override; |
74 void WidgetPostAdd(CXFA_FFWidget* hWidget, | 74 void WidgetPostAdd(CXFA_FFWidget* hWidget, |
75 CXFA_WidgetAcc* pWidgetData) override; | 75 CXFA_WidgetAcc* pWidgetData) override; |
76 void WidgetPreRemove(CXFA_FFWidget* hWidget, | 76 void WidgetPreRemove(CXFA_FFWidget* hWidget, |
77 CXFA_WidgetAcc* pWidgetData) override; | 77 CXFA_WidgetAcc* pWidgetData) override; |
78 | 78 |
79 // return true if render it. | |
80 FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget, | |
81 CFX_Graphics* pGS, | |
82 CFX_Matrix* pMatrix, | |
83 const CFX_RectF& rtUI) override; | |
84 | |
85 // Host method | 79 // Host method |
86 int32_t CountPages(CXFA_FFDoc* hDoc) override; | 80 int32_t CountPages(CXFA_FFDoc* hDoc) override; |
87 int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override; | 81 int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override; |
88 void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override; | 82 void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override; |
89 FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) override; | 83 FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) override; |
90 void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; | 84 void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; |
91 void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override; | 85 void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override; |
92 void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override; | 86 void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override; |
93 void ExportData(CXFA_FFDoc* hDoc, | 87 void ExportData(CXFA_FFDoc* hDoc, |
94 const CFX_WideString& wsFilePath, | 88 const CFX_WideString& wsFilePath, |
95 FX_BOOL bXDP = TRUE) override; | 89 FX_BOOL bXDP = TRUE) override; |
96 void ImportData(CXFA_FFDoc* hDoc, const CFX_WideString& wsFilePath) override; | |
97 void GotoURL(CXFA_FFDoc* hDoc, | 90 void GotoURL(CXFA_FFDoc* hDoc, |
98 const CFX_WideString& bsURL, | 91 const CFX_WideString& bsURL, |
99 FX_BOOL bAppend = TRUE) override; | 92 FX_BOOL bAppend = TRUE) override; |
100 FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) override; | 93 FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) override; |
101 void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; | 94 void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; |
102 void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; | 95 void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; |
103 void Print(CXFA_FFDoc* hDoc, | 96 void Print(CXFA_FFDoc* hDoc, |
104 int32_t nStartPage, | 97 int32_t nStartPage, |
105 int32_t nEndPage, | 98 int32_t nEndPage, |
106 uint32_t dwOptions) override; | 99 uint32_t dwOptions) override; |
107 | |
108 // LayoutPseudo method | |
109 int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) override; | |
110 int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; | |
111 int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) override; | |
112 int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; | |
113 | |
114 int32_t Verify(CXFA_FFDoc* hDoc, | |
115 CXFA_Node* pSigNode, | |
116 FX_BOOL bUsed = TRUE) override; | |
117 FX_BOOL Sign(CXFA_FFDoc* hDoc, | |
118 CXFA_NodeList* pNodeList, | |
119 const CFX_WideStringC& wsExpression, | |
120 const CFX_WideStringC& wsXMLIdent, | |
121 const CFX_WideStringC& wsValue = FX_WSTRC(L"open"), | |
122 FX_BOOL bUsed = TRUE) override; | |
123 CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) override; | |
124 FX_BOOL Clear(CXFA_FFDoc* hDoc, | |
125 CXFA_Node* pSigNode, | |
126 FX_BOOL bCleared = TRUE) override; | |
127 | |
128 // Get document path | 100 // Get document path |
129 void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) override; | 101 void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) override; |
130 FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) override; | 102 FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) override; |
131 | 103 |
132 /** | 104 /** |
133 *Submit data to email, http, ftp. | 105 *Submit data to email, http, ftp. |
134 * @param[in] hDoc The document handler. | 106 * @param[in] hDoc The document handler. |
135 * @param[in] eFormat Determines the format in which the data will be | 107 * @param[in] eFormat Determines the format in which the data will be |
136 *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml... | 108 *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml... |
137 * @param[in] wsTarget The URL to which the data will be submitted. | 109 * @param[in] wsTarget The URL to which the data will be submitted. |
138 * @param[in] eEncoding The encoding of text content. | 110 * @param[in] eEncoding The encoding of text content. |
139 * @param[in] pXDPContent Controls what subset of the data is submitted, used | 111 * @param[in] pXDPContent Controls what subset of the data is submitted, used |
140 *only when the format property is xdp. | 112 *only when the format property is xdp. |
141 * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted | 113 * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted |
142 *content or not. | 114 *content or not. |
143 */ | 115 */ |
144 FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; | 116 FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; |
145 | 117 |
146 FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) override; | |
147 FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc, | |
148 const CFX_ByteStringC& sWord, | |
149 std::vector<CFX_ByteString>& sSuggest) override; | |
150 | |
151 // Get PDF javascript object, set the object to pValue. | 118 // Get PDF javascript object, set the object to pValue. |
152 FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc, | 119 FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc, |
153 const CFX_ByteStringC& utf8Name, | 120 const CFX_ByteStringC& utf8Name, |
154 CFXJSE_Value* pValue) override; | 121 CFXJSE_Value* pValue) override; |
155 | 122 |
156 FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, | 123 FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, |
157 const CFX_ByteStringC& szPropName, | 124 const CFX_ByteStringC& szPropName, |
158 CFXJSE_Value* pValue) override; | 125 CFXJSE_Value* pValue) override; |
159 FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, | 126 FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, |
160 const CFX_ByteStringC& szPropName, | 127 const CFX_ByteStringC& szPropName, |
161 CFXJSE_Value* pValue) override; | 128 CFXJSE_Value* pValue) override; |
162 CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc, | |
163 IFX_FileRead* pFile, | |
164 FX_BOOL bTakeOverFile) override; | |
165 | 129 |
166 IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, | 130 IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, |
167 const CFX_WideString& wsLink) override; | 131 const CFX_WideString& wsLink) override; |
168 | 132 |
169 FX_BOOL _OnBeforeNotifySumbit(); | 133 void ClearChangeMark(); |
170 void _OnAfterNotifySumbit(); | |
171 FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost); | |
172 FX_BOOL _SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit); | |
173 FX_BOOL _MailToInfo(CFX_WideString& csURL, | |
174 CFX_WideString& csToAddress, | |
175 CFX_WideString& csCCAddress, | |
176 CFX_WideString& csBCCAddress, | |
177 CFX_WideString& csSubject, | |
178 CFX_WideString& csMsg); | |
179 FX_BOOL _ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, | |
180 int fileType, | |
181 FPDF_DWORD encodeType, | |
182 FPDF_DWORD flag = 0x01111111); | |
183 void _ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); | |
184 void _ClearChangeMark(); | |
185 | 134 |
186 private: | 135 private: |
187 enum LoadStatus { | 136 enum LoadStatus { |
188 FXFA_LOADSTATUS_PRELOAD = 0, | 137 FXFA_LOADSTATUS_PRELOAD = 0, |
189 FXFA_LOADSTATUS_LOADING, | 138 FXFA_LOADSTATUS_LOADING, |
190 FXFA_LOADSTATUS_LOADED, | 139 FXFA_LOADSTATUS_LOADED, |
191 FXFA_LOADSTATUS_CLOSING, | 140 FXFA_LOADSTATUS_CLOSING, |
192 FXFA_LOADSTATUS_CLOSED | 141 FXFA_LOADSTATUS_CLOSED |
193 }; | 142 }; |
194 | 143 |
195 void CloseXFADoc(CXFA_FFDocHandler* pDoc) { | 144 void CloseXFADoc(CXFA_FFDocHandler* pDoc) { |
196 if (pDoc) { | 145 if (pDoc) { |
197 m_pXFADoc->CloseDoc(); | 146 m_pXFADoc->CloseDoc(); |
198 m_pXFADoc.reset(); | 147 m_pXFADoc.reset(); |
199 m_pXFADocView = nullptr; | 148 m_pXFADocView = nullptr; |
200 } | 149 } |
201 } | 150 } |
202 | 151 |
| 152 FX_BOOL OnBeforeNotifySubmit(); |
| 153 void OnAfterNotifySubmit(); |
| 154 FX_BOOL NotifySubmit(FX_BOOL bPrevOrPost); |
| 155 FX_BOOL SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); |
| 156 FX_BOOL MailToInfo(CFX_WideString& csURL, |
| 157 CFX_WideString& csToAddress, |
| 158 CFX_WideString& csCCAddress, |
| 159 CFX_WideString& csBCCAddress, |
| 160 CFX_WideString& csSubject, |
| 161 CFX_WideString& csMsg); |
| 162 FX_BOOL ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, |
| 163 int fileType, |
| 164 FPDF_DWORD encodeType, |
| 165 FPDF_DWORD flag); |
| 166 void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); |
| 167 |
203 int m_iDocType; | 168 int m_iDocType; |
204 | 169 |
205 // |m_pSDKDoc| has to be released before |m_pPDFDoc| since it needs to access | 170 // |m_pSDKDoc| has to be released before |m_pPDFDoc| since it needs to access |
206 // it to kill focused annotations. | 171 // it to kill focused annotations. |
207 std::unique_ptr<CPDF_Document> m_pPDFDoc; | 172 std::unique_ptr<CPDF_Document> m_pPDFDoc; |
208 std::unique_ptr<CPDFSDK_Document> m_pSDKDoc; | 173 std::unique_ptr<CPDFSDK_Document> m_pSDKDoc; |
209 std::unique_ptr<CXFA_FFDoc> m_pXFADoc; | 174 std::unique_ptr<CXFA_FFDoc> m_pXFADoc; |
210 CXFA_FFDocView* m_pXFADocView; // not owned. | 175 CXFA_FFDocView* m_pXFADocView; // not owned. |
211 CPDFXFA_App* const m_pApp; | 176 CPDFXFA_App* const m_pApp; |
212 IJS_Context* m_pJSContext; | 177 IJS_Context* m_pJSContext; |
213 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; | 178 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; |
214 LoadStatus m_nLoadStatus; | 179 LoadStatus m_nLoadStatus; |
215 int m_nPageCount; | 180 int m_nPageCount; |
216 }; | 181 }; |
217 | 182 |
218 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ | 183 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ |
OLD | NEW |