OLD | NEW |
| (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 XFA_FXFA_INCLUDE_FXFA_H_ | |
8 #define XFA_FXFA_INCLUDE_FXFA_H_ | |
9 | |
10 #include <vector> | |
11 | |
12 #include "xfa/fxfa/include/fxfa_basic.h" | |
13 #include "xfa/fxfa/include/fxfa_widget.h" | |
14 | |
15 class CFGAS_GEFont; | |
16 class CFX_Graphics; | |
17 class CPDF_Document; | |
18 class CXFA_FFPageView; | |
19 class CXFA_Node; | |
20 class CXFA_NodeList; | |
21 class CXFA_WidgetAcc; | |
22 class IFWL_AdapterTimerMgr; | |
23 class IXFA_AppProvider; | |
24 class IXFA_DocEnvironment; | |
25 class IXFA_WidgetAccIterator; | |
26 class IXFA_WidgetIterator; | |
27 | |
28 #define XFA_MBICON_Error 0 | |
29 #define XFA_MBICON_Warning 1 | |
30 #define XFA_MBICON_Question 2 | |
31 #define XFA_MBICON_Status 3 | |
32 #define XFA_MB_OK 0 | |
33 #define XFA_MB_OKCancel 1 | |
34 #define XFA_MB_YesNo 2 | |
35 #define XFA_MB_YesNoCancel 3 | |
36 #define XFA_IDOK 1 | |
37 #define XFA_IDCancel 2 | |
38 #define XFA_IDNo 3 | |
39 #define XFA_IDYes 4 | |
40 #define XFA_IDS_ValidateFailed 1 | |
41 #define XFA_IDS_CalcOverride 2 | |
42 #define XFA_IDS_ModifyField 3 | |
43 #define XFA_IDS_NotModifyField 4 | |
44 #define XFA_IDS_AppName 5 | |
45 #define XFA_IDS_Unable_TO_SET 8 | |
46 #define XFA_IDS_INVAlID_PROP_SET 13 | |
47 #define XFA_IDS_NOT_DEFAUL_VALUE 14 | |
48 #define XFA_IDS_UNABLE_SET_LANGUAGE 15 | |
49 #define XFA_IDS_UNABLE_SET_NUMPAGES 16 | |
50 #define XFA_IDS_UNABLE_SET_PLATFORM 17 | |
51 #define XFA_IDS_UNABLE_SET_VARIATION 19 | |
52 #define XFA_IDS_UNABLE_SET_VERSION 20 | |
53 #define XFA_IDS_UNABLE_SET_READY 21 | |
54 #define XFA_IDS_COMPILER_ERROR 35 | |
55 #define XFA_IDS_DIVIDE_ZERO 44 | |
56 #define XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT 61 | |
57 #define XFA_IDS_INDEX_OUT_OF_BOUNDS 64 | |
58 #define XFA_IDS_INCORRECT_NUMBER_OF_METHOD 65 | |
59 #define XFA_IDS_ARGUMENT_MISMATCH 66 | |
60 #define XFA_IDS_NOT_HAVE_PROPERTY 70 | |
61 #define XFA_IDS_VIOLATE_BOUNDARY 72 | |
62 #define XFA_IDS_SERVER_DENY 73 | |
63 #define XFA_IDS_StringWeekDay_Sun 74 | |
64 #define XFA_IDS_StringWeekDay_Mon 75 | |
65 #define XFA_IDS_StringWeekDay_Tue 76 | |
66 #define XFA_IDS_StringWeekDay_Wed 77 | |
67 #define XFA_IDS_StringWeekDay_Thu 78 | |
68 #define XFA_IDS_StringWeekDay_Fri 79 | |
69 #define XFA_IDS_StringWeekDay_Sat 80 | |
70 #define XFA_IDS_StringMonth_Jan 81 | |
71 #define XFA_IDS_StringMonth_Feb 82 | |
72 #define XFA_IDS_StringMonth_March 83 | |
73 #define XFA_IDS_StringMonth_April 84 | |
74 #define XFA_IDS_StringMonth_May 85 | |
75 #define XFA_IDS_StringMonth_June 86 | |
76 #define XFA_IDS_StringMonth_July 87 | |
77 #define XFA_IDS_StringMonth_Aug 88 | |
78 #define XFA_IDS_StringMonth_Sept 89 | |
79 #define XFA_IDS_StringMonth_Oct 90 | |
80 #define XFA_IDS_StringMonth_Nov 91 | |
81 #define XFA_IDS_StringMonth_Dec 92 | |
82 #define XFA_IDS_String_Today 93 | |
83 #define XFA_IDS_ValidateLimit 94 | |
84 #define XFA_IDS_ValidateNullWarning 95 | |
85 #define XFA_IDS_ValidateNullError 96 | |
86 #define XFA_IDS_ValidateWarning 97 | |
87 #define XFA_IDS_ValidateError 98 | |
88 #define XFA_IDS_ValidateNumberError 99 | |
89 | |
90 #define XFA_DOCVIEW_View 0x00000000 | |
91 #define XFA_DOCVIEW_MasterPage 0x00000001 | |
92 #define XFA_DOCVIEW_Design 0x00000002 | |
93 #define XFA_DOCTYPE_Dynamic 0 | |
94 #define XFA_DOCTYPE_Static 1 | |
95 #define XFA_DOCTYPE_XDP 2 | |
96 #define XFA_PARSESTATUS_StatusErr -3 | |
97 #define XFA_PARSESTATUS_StreamErr -2 | |
98 #define XFA_PARSESTATUS_SyntaxErr -1 | |
99 #define XFA_PARSESTATUS_Ready 0 | |
100 #define XFA_PARSESTATUS_Done 100 | |
101 #define XFA_VALIDATE_preSubmit 1 | |
102 #define XFA_VALIDATE_prePrint 2 | |
103 #define XFA_VALIDATE_preExecute 3 | |
104 #define XFA_VALIDATE_preSave 4 | |
105 | |
106 #define XFA_INVALIDATE_AllPages 0x00000000 | |
107 #define XFA_INVALIDATE_CurrentPage 0x00000001 | |
108 #define XFA_PRINTOPT_ShowDialog 0x00000001 | |
109 #define XFA_PRINTOPT_CanCancel 0x00000002 | |
110 #define XFA_PRINTOPT_ShrinkPage 0x00000004 | |
111 #define XFA_PRINTOPT_AsImage 0x00000008 | |
112 #define XFA_PRINTOPT_ReverseOrder 0x00000010 | |
113 #define XFA_PRINTOPT_PrintAnnot 0x00000020 | |
114 #define XFA_PAGEVIEWEVENT_PostAdded 1 | |
115 #define XFA_PAGEVIEWEVENT_PostRemoved 3 | |
116 #define XFA_PAGEVIEWEVENT_StopLayout 4 | |
117 | |
118 #define XFA_EVENTERROR_Success 1 | |
119 #define XFA_EVENTERROR_Error -1 | |
120 #define XFA_EVENTERROR_NotExist 0 | |
121 #define XFA_EVENTERROR_Disabled 2 | |
122 | |
123 #define XFA_RENDERSTATUS_Ready 1 | |
124 #define XFA_RENDERSTATUS_ToBeContinued 2 | |
125 #define XFA_RENDERSTATUS_Done 3 | |
126 #define XFA_RENDERSTATUS_Failed -1 | |
127 | |
128 #define XFA_TRAVERSEWAY_Tranvalse 0x0001 | |
129 #define XFA_TRAVERSEWAY_Form 0x0002 | |
130 | |
131 enum XFA_WidgetStatus { | |
132 XFA_WidgetStatus_None = 0, | |
133 | |
134 XFA_WidgetStatus_Access = 1 << 0, | |
135 XFA_WidgetStatus_ButtonDown = 1 << 1, | |
136 XFA_WidgetStatus_Disabled = 1 << 2, | |
137 XFA_WidgetStatus_Focused = 1 << 3, | |
138 XFA_WidgetStatus_Highlight = 1 << 4, | |
139 XFA_WidgetStatus_Printable = 1 << 5, | |
140 XFA_WidgetStatus_RectCached = 1 << 6, | |
141 XFA_WidgetStatus_TextEditValueChanged = 1 << 7, | |
142 XFA_WidgetStatus_Viewable = 1 << 8, | |
143 XFA_WidgetStatus_Visible = 1 << 9 | |
144 }; | |
145 | |
146 enum XFA_WIDGETORDER { | |
147 XFA_WIDGETORDER_PreOrder, | |
148 }; | |
149 | |
150 enum XFA_WIDGETTYPE { | |
151 XFA_WIDGETTYPE_Barcode, | |
152 XFA_WIDGETTYPE_PushButton, | |
153 XFA_WIDGETTYPE_CheckButton, | |
154 XFA_WIDGETTYPE_RadioButton, | |
155 XFA_WIDGETTYPE_DatetimeEdit, | |
156 XFA_WIDGETTYPE_DecimalField, | |
157 XFA_WIDGETTYPE_NumericField, | |
158 XFA_WIDGETTYPE_Signature, | |
159 XFA_WIDGETTYPE_TextEdit, | |
160 XFA_WIDGETTYPE_DropdownList, | |
161 XFA_WIDGETTYPE_ListBox, | |
162 XFA_WIDGETTYPE_ImageField, | |
163 XFA_WIDGETTYPE_PasswordEdit, | |
164 XFA_WIDGETTYPE_Arc, | |
165 XFA_WIDGETTYPE_Rectangle, | |
166 XFA_WIDGETTYPE_Image, | |
167 XFA_WIDGETTYPE_Line, | |
168 XFA_WIDGETTYPE_Text, | |
169 XFA_WIDGETTYPE_ExcludeGroup, | |
170 XFA_WIDGETTYPE_Subform, | |
171 XFA_WIDGETTYPE_Unknown, | |
172 }; | |
173 | |
174 // Probably should be called IXFA_AppDelegate. | |
175 class IXFA_AppProvider { | |
176 public: | |
177 virtual ~IXFA_AppProvider() {} | |
178 | |
179 /** | |
180 * Specifies the name of the client application in which a form currently | |
181 * exists. Such as Exchange-Pro. | |
182 */ | |
183 virtual void SetAppType(const CFX_WideStringC& wsAppType) = 0; | |
184 virtual void GetAppType(CFX_WideString& wsAppType) = 0; | |
185 | |
186 /** | |
187 * Returns the language of the running host application. Such as zh_CN | |
188 */ | |
189 virtual void GetLanguage(CFX_WideString& wsLanguage) = 0; | |
190 | |
191 /** | |
192 * Returns the platform of the machine running the script. Such as WIN | |
193 */ | |
194 virtual void GetPlatform(CFX_WideString& wsPlatform) = 0; | |
195 | |
196 /** | |
197 * Indicates the packaging of the application that is running the script. Such | |
198 * as Full | |
199 */ | |
200 virtual void GetVariation(CFX_WideString& wsVariation) = 0; | |
201 | |
202 /** | |
203 * Indicates the version number of the current application. Such as 9 | |
204 */ | |
205 virtual void GetVersion(CFX_WideString& wsVersion) = 0; | |
206 | |
207 /** | |
208 * Get application name, such as Phantom. | |
209 */ | |
210 virtual void GetAppName(CFX_WideString& wsName) = 0; | |
211 | |
212 /** | |
213 * Causes the system to play a sound. | |
214 * @param[in] dwType The system code for the appropriate sound.0 (Error)1 | |
215 * (Warning)2 (Question)3 (Status)4 (Default) | |
216 */ | |
217 virtual void Beep(uint32_t dwType) = 0; | |
218 | |
219 /** | |
220 * Displays a message box. | |
221 * @param[in] wsMessage - Message string to display in box. | |
222 * @param[in] wsTitle - Title string for box. | |
223 * @param[in] dwIconType - Icon type, refer to XFA_MBICON. | |
224 * @param[in] dwButtonType - Button type, refer to XFA_MESSAGEBUTTON. | |
225 * @return A valid integer representing the value of the button pressed by the | |
226 * user, refer to XFA_ID. | |
227 */ | |
228 virtual int32_t MsgBox(const CFX_WideString& wsMessage, | |
229 const CFX_WideString& wsTitle = L"", | |
230 uint32_t dwIconType = 0, | |
231 uint32_t dwButtonType = 0) = 0; | |
232 | |
233 /** | |
234 * Get a response from the user. | |
235 * @param[in] wsQuestion - Message string to display in box. | |
236 * @param[in] wsTitle - Title string for box. | |
237 * @param[in] wsDefaultAnswer - Initial contents for answer. | |
238 * @param[in] bMask - Mask the user input with asterisks when true, | |
239 * @return A string containing the user's response. | |
240 */ | |
241 virtual CFX_WideString Response(const CFX_WideString& wsQuestion, | |
242 const CFX_WideString& wsTitle = L"", | |
243 const CFX_WideString& wsDefaultAnswer = L"", | |
244 FX_BOOL bMask = TRUE) = 0; | |
245 | |
246 /** | |
247 * Download something from somewhere. | |
248 * @param[in] wsURL - http, ftp, such as | |
249 * "http://www.w3.org/TR/REC-xml-names/". | |
250 */ | |
251 virtual IFX_FileRead* DownloadURL(const CFX_WideString& wsURL) = 0; | |
252 | |
253 /** | |
254 * POST data to the given url. | |
255 * @param[in] wsURL the URL being uploaded. | |
256 * @param[in] wsData the data being uploaded. | |
257 * @param[in] wsContentType the content type of data including text/html, | |
258 * text/xml, text/plain, multipart/form-data, | |
259 * application/x-www-form-urlencoded, | |
260 * application/octet-stream, any valid MIME type. | |
261 * @param[in] wsEncode the encode of data including UTF-8, UTF-16, | |
262 * ISO8859-1, any recognized [IANA]character encoding | |
263 * @param[in] wsHeader any additional HTTP headers to be included in the | |
264 * post. | |
265 * @param[out] wsResponse decoded response from server. | |
266 * @return TRUE Server permitted the post request, FALSE otherwise. | |
267 */ | |
268 virtual FX_BOOL PostRequestURL(const CFX_WideString& wsURL, | |
269 const CFX_WideString& wsData, | |
270 const CFX_WideString& wsContentType, | |
271 const CFX_WideString& wsEncode, | |
272 const CFX_WideString& wsHeader, | |
273 CFX_WideString& wsResponse) = 0; | |
274 | |
275 /** | |
276 * PUT data to the given url. | |
277 * @param[in] wsURL the URL being uploaded. | |
278 * @param[in] wsData the data being uploaded. | |
279 * @param[in] wsEncode the encode of data including UTF-8, UTF-16, | |
280 * ISO8859-1, any recognized [IANA]character encoding | |
281 * @return TRUE Server permitted the post request, FALSE otherwise. | |
282 */ | |
283 virtual FX_BOOL PutRequestURL(const CFX_WideString& wsURL, | |
284 const CFX_WideString& wsData, | |
285 const CFX_WideString& wsEncode) = 0; | |
286 | |
287 virtual void LoadString(int32_t iStringID, CFX_WideString& wsString) = 0; | |
288 virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0; | |
289 }; | |
290 | |
291 class IXFA_DocEnvironment { | |
292 public: | |
293 virtual ~IXFA_DocEnvironment() {} | |
294 | |
295 virtual void SetChangeMark(CXFA_FFDoc* hDoc) = 0; | |
296 virtual void InvalidateRect(CXFA_FFPageView* pPageView, | |
297 const CFX_RectF& rt, | |
298 uint32_t dwFlags) = 0; | |
299 virtual void DisplayCaret(CXFA_FFWidget* hWidget, | |
300 FX_BOOL bVisible, | |
301 const CFX_RectF* pRtAnchor) = 0; | |
302 virtual FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget, | |
303 FX_FLOAT fMinPopup, | |
304 FX_FLOAT fMaxPopup, | |
305 const CFX_RectF& rtAnchor, | |
306 CFX_RectF& rtPopup) = 0; | |
307 virtual FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) = 0; | |
308 virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) = 0; | |
309 virtual void WidgetPostAdd(CXFA_FFWidget* hWidget, | |
310 CXFA_WidgetAcc* pWidgetData) = 0; | |
311 virtual void WidgetPreRemove(CXFA_FFWidget* hWidget, | |
312 CXFA_WidgetAcc* pWidgetData) = 0; | |
313 | |
314 virtual int32_t CountPages(CXFA_FFDoc* hDoc) = 0; | |
315 virtual int32_t GetCurrentPage(CXFA_FFDoc* hDoc) = 0; | |
316 virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) = 0; | |
317 virtual FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) = 0; | |
318 virtual void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) = 0; | |
319 virtual void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) = 0; | |
320 virtual void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) = 0; | |
321 virtual void ExportData(CXFA_FFDoc* hDoc, | |
322 const CFX_WideString& wsFilePath, | |
323 FX_BOOL bXDP) = 0; | |
324 virtual void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) = 0; | |
325 virtual FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) = 0; | |
326 virtual void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) = 0; | |
327 virtual void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0; | |
328 virtual void Print(CXFA_FFDoc* hDoc, | |
329 int32_t nStartPage, | |
330 int32_t nEndPage, | |
331 uint32_t dwOptions) = 0; | |
332 virtual FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) = 0; | |
333 | |
334 virtual FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) = 0; | |
335 virtual FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, | |
336 const CFX_ByteStringC& szPropName, | |
337 CFXJSE_Value* pValue) = 0; | |
338 virtual FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, | |
339 const CFX_ByteStringC& szPropName, | |
340 CFXJSE_Value* pValue) = 0; | |
341 virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, | |
342 const CFX_WideString& wsLink) = 0; | |
343 }; | |
344 | |
345 class IXFA_WidgetIterator { | |
346 public: | |
347 virtual ~IXFA_WidgetIterator() {} | |
348 | |
349 virtual void Reset() = 0; | |
350 virtual CXFA_FFWidget* MoveToFirst() = 0; | |
351 virtual CXFA_FFWidget* MoveToLast() = 0; | |
352 virtual CXFA_FFWidget* MoveToNext() = 0; | |
353 virtual CXFA_FFWidget* MoveToPrevious() = 0; | |
354 virtual CXFA_FFWidget* GetCurrentWidget() = 0; | |
355 virtual FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) = 0; | |
356 }; | |
357 | |
358 #endif // XFA_FXFA_INCLUDE_FXFA_H_ | |
OLD | NEW |