Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h

Issue 1863163002: Move code from fpdfsdk/include to the sub directories. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/include/fpdfxfa/fpdfxfa_app.h ('k') | fpdfsdk/include/fpdfxfa/fpdfxfa_page.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef FPDFSDK_INCLUDE_FPDFXFA_FPDFXFA_DOC_H_
8 #define FPDFSDK_INCLUDE_FPDFXFA_FPDFXFA_DOC_H_
9
10 #include <vector>
11
12 #include "public/fpdfview.h"
13 #include "xfa/include/fxfa/fxfa.h"
14 #include "xfa/include/fxfa/xfa_ffdoc.h"
15 #include "xfa/include/fxfa/xfa_ffdochandler.h"
16
17 class CPDFXFA_App;
18 class CPDFXFA_Document;
19 class CPDFXFA_Page;
20 class CPDFSDK_Document;
21 class CPDFDoc_Environment;
22 class IJS_Runtime;
23 class IJS_Context;
24 class CXFA_FFDocHandler;
25
26 class CPDFXFA_Document : public IXFA_DocProvider {
27 public:
28 CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider);
29 ~CPDFXFA_Document();
30
31 FX_BOOL LoadXFADoc();
32 CPDFXFA_App* GetApp() { return m_pApp; }
33 CPDF_Document* GetPDFDoc() { return m_pPDFDoc; }
34 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc; }
35 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; }
36
37 int GetPageCount();
38 CPDFXFA_Page* GetPage(int page_index);
39 CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage);
40
41 void DeletePage(int page_index);
42 void RemovePage(CPDFXFA_Page* page);
43 int GetDocType() { return m_iDocType; }
44
45 CPDFSDK_Document* GetSDKDocument(CPDFDoc_Environment* pFormFillEnv);
46
47 void FXRect2PDFRect(const CFX_RectF& fxRectF, CFX_FloatRect& pdfRect);
48
49 virtual void SetChangeMark(CXFA_FFDoc* hDoc);
50 virtual FX_BOOL GetChangeMark(CXFA_FFDoc* hDoc);
51 // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
52 virtual void InvalidateRect(CXFA_FFPageView* pPageView,
53 const CFX_RectF& rt,
54 uint32_t dwFlags = 0);
55 // used in static xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
56 virtual void InvalidateRect(CXFA_FFWidget* hWidget, uint32_t dwFlags = 0);
57 // show or hide caret
58 virtual void DisplayCaret(CXFA_FFWidget* hWidget,
59 FX_BOOL bVisible,
60 const CFX_RectF* pRtAnchor);
61 // dwPos: (0:bottom 1:top)
62 virtual FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget,
63 FX_FLOAT fMinPopup,
64 FX_FLOAT fMaxPopup,
65 const CFX_RectF& rtAnchor,
66 CFX_RectF& rtPopup);
67 virtual FX_BOOL PopupMenu(CXFA_FFWidget* hWidget,
68 CFX_PointF ptPopup,
69 const CFX_RectF* pRectExclude = NULL);
70
71 // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing
72 virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags);
73 // dwEvent refer to XFA_WIDGETEVENT_XXX
74 virtual void WidgetEvent(CXFA_FFWidget* hWidget,
75 CXFA_WidgetAcc* pWidgetData,
76 uint32_t dwEvent,
77 void* pParam = NULL,
78 void* pAdditional = NULL);
79
80 // return true if render it.
81 virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget,
82 CFX_Graphics* pGS,
83 CFX_Matrix* pMatrix,
84 const CFX_RectF& rtUI) {
85 return FALSE;
86 }
87
88 // host method
89 virtual int32_t CountPages(CXFA_FFDoc* hDoc);
90 virtual int32_t GetCurrentPage(CXFA_FFDoc* hDoc);
91 virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage);
92 virtual FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc);
93 virtual void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled);
94 virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle);
95 virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsTitle);
96 virtual void ExportData(CXFA_FFDoc* hDoc,
97 const CFX_WideStringC& wsFilePath,
98 FX_BOOL bXDP = TRUE);
99 virtual void ImportData(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFilePath);
100 virtual void GotoURL(CXFA_FFDoc* hDoc,
101 const CFX_WideStringC& bsURL,
102 FX_BOOL bAppend = TRUE);
103 virtual FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc);
104 virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled);
105 virtual void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget);
106 virtual void Print(CXFA_FFDoc* hDoc,
107 int32_t nStartPage,
108 int32_t nEndPage,
109 uint32_t dwOptions);
110
111 // LayoutPseudo method
112 virtual int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) { return 0; }
113 virtual int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) {
114 return 0;
115 }
116 virtual int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) { return 0; }
117 virtual int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) {
118 return 0;
119 }
120
121 virtual int32_t Verify(CXFA_FFDoc* hDoc,
122 CXFA_Node* pSigNode,
123 FX_BOOL bUsed = TRUE) {
124 return 0;
125 }
126 virtual FX_BOOL Sign(CXFA_FFDoc* hDoc,
127 CXFA_NodeList* pNodeList,
128 const CFX_WideStringC& wsExpression,
129 const CFX_WideStringC& wsXMLIdent,
130 const CFX_WideStringC& wsValue = FX_WSTRC(L"open"),
131 FX_BOOL bUsed = TRUE) {
132 return 0;
133 }
134 virtual CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) { return 0; }
135 virtual FX_BOOL Clear(CXFA_FFDoc* hDoc,
136 CXFA_Node* pSigNode,
137 FX_BOOL bCleared = TRUE) {
138 return 0;
139 }
140
141 // Get document path
142 virtual void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL);
143 virtual FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc);
144
145 /**
146 *Submit data to email, http, ftp.
147 * @param[in] hDoc The document handler.
148 * @param[in] eFormat Determines the format in which the data will be
149 *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml...
150 * @param[in] wsTarget The URL to which the data will be submitted.
151 * @param[in] eEncoding The encoding of text content.
152 * @param[in] pXDPContent Controls what subset of the data is submitted, used
153 *only when the format property is xdp.
154 * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted
155 *content or not.
156 */
157 virtual FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit);
158
159 virtual FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) {
160 return FALSE;
161 }
162 virtual FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc,
163 const CFX_ByteStringC& sWord,
164 std::vector<CFX_ByteString>& sSuggest) {
165 return FALSE;
166 }
167
168 // Get PDF javascript object, set the object to hValue.
169 virtual FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc,
170 const CFX_ByteStringC& utf8Name,
171 FXJSE_HVALUE hValue);
172
173 virtual FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc,
174 const CFX_ByteStringC& szPropName,
175 FXJSE_HVALUE hValue);
176 virtual FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc,
177 const CFX_ByteStringC& szPropName,
178 FXJSE_HVALUE hValue);
179 virtual CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc,
180 IFX_FileRead* pFile,
181 FX_BOOL bTakeOverFile) {
182 return NULL;
183 }
184
185 virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc,
186 const CFX_WideString& wsLink);
187
188 FX_BOOL _GetHValueByName(const CFX_ByteStringC& utf8Name,
189 FXJSE_HVALUE hValue,
190 IJS_Runtime* runTime);
191 FX_BOOL _OnBeforeNotifySumbit();
192 void _OnAfterNotifySumbit();
193 FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost);
194 FX_BOOL _SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit);
195 FX_BOOL _MailToInfo(CFX_WideString& csURL,
196 CFX_WideString& csToAddress,
197 CFX_WideString& csCCAddress,
198 CFX_WideString& csBCCAddress,
199 CFX_WideString& csSubject,
200 CFX_WideString& csMsg);
201 FX_BOOL _ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler,
202 int fileType,
203 FPDF_DWORD encodeType,
204 FPDF_DWORD flag = 0x01111111);
205 void _ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag);
206 void _ClearChangeMark();
207
208 private:
209 enum LoadStatus {
210 FXFA_LOADSTATUS_PRELOAD = 0,
211 FXFA_LOADSTATUS_LOADING,
212 FXFA_LOADSTATUS_LOADED,
213 FXFA_LOADSTATUS_CLOSING,
214 FXFA_LOADSTATUS_CLOSED
215 };
216
217 void CloseXFADoc(CXFA_FFDocHandler* pDoc) {
218 if (pDoc) {
219 m_pXFADoc->CloseDoc();
220 delete m_pXFADoc;
221 m_pXFADoc = nullptr;
222 m_pXFADocView = nullptr;
223 }
224 }
225
226 int m_iDocType;
227 CPDF_Document* m_pPDFDoc;
228 CPDFSDK_Document* m_pSDKDoc;
229 CXFA_FFDoc* m_pXFADoc;
230 CXFA_FFDocView* m_pXFADocView;
231 CPDFXFA_App* m_pApp;
232 IJS_Context* m_pJSContext;
233 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
234 LoadStatus m_nLoadStatus;
235 int m_nPageCount;
236 };
237
238 #endif // FPDFSDK_INCLUDE_FPDFXFA_FPDFXFA_DOC_H_
OLDNEW
« no previous file with comments | « fpdfsdk/include/fpdfxfa/fpdfxfa_app.h ('k') | fpdfsdk/include/fpdfxfa/fpdfxfa_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698