blob: 4bedfb58205eccc96380c2cd5500273f9f3f0e2b [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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.
Tom Sepez9857e202015-05-13 17:09:26 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Tom Sepez9857e202015-05-13 17:09:26 -07007#ifndef PUBLIC_FPDF_FORMFILL_H_
8#define PUBLIC_FPDF_FORMFILL_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Dan Sinclair85c8e7f2016-11-21 13:50:32 -050010// NOLINTNEXTLINE(build/include)
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070011#include "fpdfview.h"
12
Ryan Harrison0e568812017-10-21 02:07:02 -040013// These values are return values for a public API, so should not be changed
14// other than the count when adding new values.
Lei Zhangd6e92bd2018-01-29 19:01:26 +000015#define FORMTYPE_NONE 0 // Document contains no forms
16#define FORMTYPE_ACRO_FORM 1 // Forms are specified using AcroForm spec
17#define FORMTYPE_XFA_FULL 2 // Forms are specified using the entire XFA
18 // spec
19#define FORMTYPE_XFA_FOREGROUND 3 // Forms are specified using the XFAF subset
20 // of XFA spec
21#define FORMTYPE_COUNT 4 // The number of form types
Jun Fange118ce92015-02-17 06:50:08 -080022
Ryan Harrisonc3cc2ab2018-06-21 21:09:54 +000023#define JSPLATFORM_ALERT_BUTTON_OK 0 // OK button
24#define JSPLATFORM_ALERT_BUTTON_OKCANCEL 1 // OK & Cancel buttons
25#define JSPLATFORM_ALERT_BUTTON_YESNO 2 // Yes & No buttons
26#define JSPLATFORM_ALERT_BUTTON_YESNOCANCEL 3 // Yes, No & Cancel buttons
27#define JSPLATFORM_ALERT_BUTTON_DEFAULT JSPLATFORM_ALERT_BUTTON_OK
28
29#define JSPLATFORM_ALERT_ICON_ERROR 0 // Error
30#define JSPLATFORM_ALERT_ICON_WARNING 1 // Warning
31#define JSPLATFORM_ALERT_ICON_QUESTION 2 // Question
32#define JSPLATFORM_ALERT_ICON_STATUS 3 // Status
33#define JSPLATFORM_ALERT_ICON_ASTERISK 4 // Asterisk
34#define JSPLATFORM_ALERT_ICON_DEFAULT JSPLATFORM_ALERT_ICON_ERROR
35
36#define JSPLATFORM_ALERT_RETURN_OK 1 // OK
37#define JSPLATFORM_ALERT_RETURN_CANCEL 2 // Cancel
38#define JSPLATFORM_ALERT_RETURN_NO 3 // No
39#define JSPLATFORM_ALERT_RETURN_YES 4 // Yes
40
41#define JSPLATFORM_BEEP_ERROR 0 // Error
42#define JSPLATFORM_BEEP_WARNING 1 // Warning
43#define JSPLATFORM_BEEP_QUESTION 2 // Question
44#define JSPLATFORM_BEEP_STATUS 3 // Status
45#define JSPLATFORM_BEEP_DEFAULT 4 // Default
46
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070047// Exported Functions
48#ifdef __cplusplus
49extern "C" {
50#endif
51
Nico Weber9d8ec5a2015-08-04 13:00:21 -070052typedef struct _IPDF_JsPlatform {
53 /**
54 * Version number of the interface. Currently must be 2.
55 **/
56 int version;
Bo Xufdc00a72014-10-28 23:03:33 -070057
Nico Weber9d8ec5a2015-08-04 13:00:21 -070058 /* Version 1. */
Jochen Eisinger06b60022015-07-30 17:44:35 +020059
Nico Weber9d8ec5a2015-08-04 13:00:21 -070060 /**
Ryan Harrisonc3cc2ab2018-06-21 21:09:54 +000061 * Method: app_alert
62 * pop up a dialog to show warning or hint.
63 * Interface Version:
64 * 1
65 * Implementation Required:
66 * yes
67 * Parameters:
68 * pThis - Pointer to the interface structure itself.
69 * Msg - A string containing the message to be displayed.
70 * Title - The title of the dialog.
71 * Type - The type of button group, see
72 * JSPLATFORM_ALERT_BUTTON_* above.
73 * nIcon - The icon type, see see
74 * JSPLATFORM_ALERT_ICON_* above .
75 *
76 * Return Value:
Ryan Harrison8b8031d2018-06-22 19:15:05 +000077 * Option selected by user in dialogue, see
Ryan Harrisonc3cc2ab2018-06-21 21:09:54 +000078 * JSPLATFORM_ALERT_RETURN_* above.
79 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -070080 int (*app_alert)(struct _IPDF_JsPlatform* pThis,
81 FPDF_WIDESTRING Msg,
82 FPDF_WIDESTRING Title,
83 int Type,
84 int Icon);
Tom Sepez621d4de2014-07-29 14:01:21 -070085
Nico Weber9d8ec5a2015-08-04 13:00:21 -070086 /**
Ryan Harrisonc3cc2ab2018-06-21 21:09:54 +000087 * Method: app_beep
88 * Causes the system to play a sound.
89 * Interface Version:
90 * 1
91 * Implementation Required:
92 * yes
93 * Parameters:
94 * pThis - Pointer to the interface structure itself
95 * nType - The sound type, see see JSPLATFORM_BEEP_TYPE_*
96 * above.
97 *
98 * Return Value:
99 * None
100 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700101 void (*app_beep)(struct _IPDF_JsPlatform* pThis, int nType);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700102
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700103 /**
104 * Method: app_response
105 * Displays a dialog box containing a question and an entry field for
106 * the user to reply to the question.
107 * Interface Version:
108 * 1
109 * Implementation Required:
110 * yes
111 * Parameters:
112 * pThis - Pointer to the interface structure itself
113 * Question - The question to be posed to the user.
114 * Title - The title of the dialog box.
115 * Default - A default value for the answer to the question. If
116 * not specified, no default value is presented.
117 * cLabel - A short string to appear in front of and on the
118 * same line as the edit text field.
119 * bPassword - If true, indicates that the user's response should
120 * show as asterisks (*) or bullets (?) to mask the response, which might be
121 * sensitive information. The default is false.
122 * response - A string buffer allocated by SDK, to receive the
123 * user's response.
124 * length - The length of the buffer, number of bytes.
125 * Currently, It's always be 2048.
126 * Return Value:
127 * Number of bytes the complete user input would actually require, not
128 * including trailing zeros, regardless of the value of the length
129 * parameter or the presence of the response buffer.
130 * Comments:
131 * No matter on what platform, the response buffer should be always
132 * written using UTF-16LE encoding. If a response buffer is
133 * present and the size of the user input exceeds the capacity of the
134 * buffer as specified by the length parameter, only the
135 * first "length" bytes of the user input are to be written to the
136 * buffer.
137 */
138 int (*app_response)(struct _IPDF_JsPlatform* pThis,
139 FPDF_WIDESTRING Question,
140 FPDF_WIDESTRING Title,
141 FPDF_WIDESTRING Default,
142 FPDF_WIDESTRING cLabel,
143 FPDF_BOOL bPassword,
144 void* response,
145 int length);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700146
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700147 /*
148 * Method: Doc_getFilePath
149 * Get the file path of the current document.
150 * Interface Version:
151 * 1
152 * Implementation Required:
153 * yes
154 * Parameters:
155 * pThis - Pointer to the interface structure itself
156 * filePath - The string buffer to receive the file path. Can be
157 * NULL.
158 * length - The length of the buffer, number of bytes. Can be
159 * 0.
160 * Return Value:
161 * Number of bytes the filePath consumes, including trailing zeros.
162 * Comments:
163 * The filePath should be always input in local encoding.
164 *
165 * The return value always indicated number of bytes required for the
thestig9067fd62016-11-23 14:10:06 -0800166 * buffer , even when there is no buffer specified, or the buffer size is
167 * less than required. In this case, the buffer will not be modified.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700168 */
169 int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis,
170 void* filePath,
171 int length);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700172
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700173 /*
174 * Method: Doc_mail
175 * Mails the data buffer as an attachment to all recipients, with or
176 * without user interaction.
177 * Interface Version:
178 * 1
179 * Implementation Required:
180 * yes
181 * Parameters:
182 * pThis - Pointer to the interface structure itself
183 * mailData - Pointer to the data buffer to be sent.Can be NULL.
184 * length - The size,in bytes, of the buffer pointed by
185 * mailData parameter.Can be 0.
186 * bUI - If true, the rest of the parameters are used in a
187 * compose-new-message window that is displayed to the user. If false, the cTo
188 * parameter is required and all others are optional.
189 * To - A semicolon-delimited list of recipients for the
190 * message.
191 * Subject - The subject of the message. The length limit is 64
192 * KB.
193 * CC - A semicolon-delimited list of CC recipients for
194 * the message.
195 * BCC - A semicolon-delimited list of BCC recipients for
196 * the message.
197 * Msg - The content of the message. The length limit is 64
198 * KB.
199 * Return Value:
200 * None.
201 * Comments:
202 * If the parameter mailData is NULL or length is 0, the current
203 * document will be mailed as an attachment to all recipients.
204 */
205 void (*Doc_mail)(struct _IPDF_JsPlatform* pThis,
206 void* mailData,
207 int length,
208 FPDF_BOOL bUI,
209 FPDF_WIDESTRING To,
210 FPDF_WIDESTRING Subject,
211 FPDF_WIDESTRING CC,
212 FPDF_WIDESTRING BCC,
213 FPDF_WIDESTRING Msg);
Tom Sepez9857e202015-05-13 17:09:26 -0700214
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700215 /*
216 * Method: Doc_print
217 * Prints all or a specific number of pages of the document.
218 * Interface Version:
219 * 1
220 * Implementation Required:
221 * yes
222 * Parameters:
223 * pThis - Pointer to the interface structure itself.
224 * bUI - If true, will cause a UI to be presented to the
225 * user to obtain printing information and confirm the action.
226 * nStart - A 0-based index that defines the start of an
227 * inclusive range of pages.
228 * nEnd - A 0-based index that defines the end of an
229 * inclusive page range.
230 * bSilent - If true, suppresses the cancel dialog box while
231 * the document is printing. The default is false.
232 * bShrinkToFit - If true, the page is shrunk (if necessary) to
233 * fit within the imageable area of the printed page.
234 * bPrintAsImage - If true, print pages as an image.
235 * bReverse - If true, print from nEnd to nStart.
236 * bAnnotations - If true (the default), annotations are
237 * printed.
238 */
239 void (*Doc_print)(struct _IPDF_JsPlatform* pThis,
240 FPDF_BOOL bUI,
241 int nStart,
242 int nEnd,
243 FPDF_BOOL bSilent,
244 FPDF_BOOL bShrinkToFit,
245 FPDF_BOOL bPrintAsImage,
246 FPDF_BOOL bReverse,
247 FPDF_BOOL bAnnotations);
Tom Sepez9857e202015-05-13 17:09:26 -0700248
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700249 /*
250 * Method: Doc_submitForm
251 * Send the form data to a specified URL.
252 * Interface Version:
253 * 1
254 * Implementation Required:
255 * yes
256 * Parameters:
257 * pThis - Pointer to the interface structure itself
258 * formData - Pointer to the data buffer to be sent.
259 * length - The size,in bytes, of the buffer pointed by
260 * formData parameter.
261 * URL - The URL to send to.
262 * Return Value:
263 * None.
264 *
265 */
266 void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis,
267 void* formData,
268 int length,
269 FPDF_WIDESTRING URL);
Tom Sepez9857e202015-05-13 17:09:26 -0700270
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700271 /*
272 * Method: Doc_gotoPage
273 * Jump to a specified page.
274 * Interface Version:
275 * 1
276 * Implementation Required:
277 * yes
278 * Parameters:
279 * pThis - Pointer to the interface structure itself
280 * nPageNum - The specified page number, zero for the first
281 * page.
282 * Return Value:
283 * None.
284 *
285 */
286 void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum);
287 /*
288 * Method: Field_browse
289 * Show a file selection dialog, and return the selected file path.
290 * Interface Version:
291 * 1
292 * Implementation Required:
293 * yes
294 * Parameters:
295 * pThis - Pointer to the interface structure itself.
296 * filePath - Pointer to the data buffer to receive the file
297 * path.Can be NULL.
298 * length - The length of the buffer, number of bytes. Can be
299 * 0.
300 * Return Value:
301 * Number of bytes the filePath consumes, including trailing zeros.
302 * Comments:
303 * The filePath shoule be always input in local encoding.
304 */
305 int (*Field_browse)(struct _IPDF_JsPlatform* pThis,
306 void* filePath,
307 int length);
Tom Sepez9857e202015-05-13 17:09:26 -0700308
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700309 /**
310 * pointer to FPDF_FORMFILLINFO interface.
311 **/
312 void* m_pFormfillinfo;
Tom Sepez9857e202015-05-13 17:09:26 -0700313
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700314 /* Version 2. */
Tom Sepez9857e202015-05-13 17:09:26 -0700315
Tom Sepeza72e8e22015-10-07 10:17:53 -0700316 void* m_isolate; /* Unused in v3, retain for compatibility. */
317 unsigned int m_v8EmbedderSlot; /* Unused in v3, retain for compatibility. */
Jochen Eisinger06b60022015-07-30 17:44:35 +0200318
Tom Sepeza72e8e22015-10-07 10:17:53 -0700319 /* Version 3. */
320 /* Version 3 moves m_Isolate and m_v8EmbedderSlot to FPDF_LIBRARY_CONFIG. */
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700321} IPDF_JSPLATFORM;
322
323// Flags for Cursor type
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700324#define FXCT_ARROW 0
325#define FXCT_NESW 1
326#define FXCT_NWSE 2
327#define FXCT_VBEAM 3
328#define FXCT_HBEAM 4
329#define FXCT_HAND 5
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700330
331/**
tsepez8e120292016-08-03 14:03:35 -0700332 * Function signature for the callback function passed to the FFI_SetTimer
333 * method.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700334 * Parameters:
Tom Sepez9857e202015-05-13 17:09:26 -0700335 * idEvent - Identifier of the timer.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700336 * Return value:
Tom Sepez9857e202015-05-13 17:09:26 -0700337 * None.
338 **/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700339typedef void (*TimerCallback)(int idEvent);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700340
341/**
342 * Declares of a struct type to the local system time.
343**/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700344typedef struct _FPDF_SYSTEMTIME {
345 unsigned short wYear; /* years since 1900 */
346 unsigned short wMonth; /* months since January - [0,11] */
347 unsigned short wDayOfWeek; /* days since Sunday - [0,6] */
348 unsigned short wDay; /* day of the month - [1,31] */
349 unsigned short wHour; /* hours since midnight - [0,23] */
350 unsigned short wMinute; /* minutes after the hour - [0,59] */
351 unsigned short wSecond; /* seconds after the minute - [0,59] */
352 unsigned short wMilliseconds; /* milliseconds after the second - [0,999] */
353} FPDF_SYSTEMTIME;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700354
Tom Sepezc46d0002015-11-30 15:46:36 -0800355#ifdef PDF_ENABLE_XFA
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700356// XFA
Bo Xufdc00a72014-10-28 23:03:33 -0700357/**
358 * @name Pageview event flags
359 */
360/*@{*/
361/** @brief After a new pageview is added. */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700362#define FXFA_PAGEVIEWEVENT_POSTADDED 1
Bo Xufdc00a72014-10-28 23:03:33 -0700363/** @brief After a pageview is removed. */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700364#define FXFA_PAGEVIEWEVENT_POSTREMOVED 3
Bo Xufdc00a72014-10-28 23:03:33 -0700365/*@}*/
366
367// menu
368/**
369 * @name Macro Definitions for Right Context Menu Features Of XFA Fields
370 */
371/*@{*/
dsinclairf2662c42016-09-14 06:23:48 -0700372#define FXFA_MENU_COPY 1
373#define FXFA_MENU_CUT 2
374#define FXFA_MENU_SELECTALL 4
375#define FXFA_MENU_UNDO 8
376#define FXFA_MENU_REDO 16
377#define FXFA_MENU_PASTE 32
Bo Xufdc00a72014-10-28 23:03:33 -0700378/*@}*/
379
380// file type
381/**
382 * @name Macro Definitions for File Type.
383 */
384/*@{*/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700385#define FXFA_SAVEAS_XML 1
386#define FXFA_SAVEAS_XDP 2
Bo Xufdc00a72014-10-28 23:03:33 -0700387/*@}*/
Tom Sepezc46d0002015-11-30 15:46:36 -0800388#endif // PDF_ENABLE_XFA
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700389
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700390typedef struct _FPDF_FORMFILLINFO {
391 /**
Tom Sepezc46d0002015-11-30 15:46:36 -0800392 * Version number of the interface. Currently must be 1 (when PDFium is built
393 * without the XFA module) or must be 2 (when built with the XFA module).
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700394 **/
395 int version;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700396
Tom Sepezc46d0002015-11-30 15:46:36 -0800397 /* Version 1. */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700398 /**
Lei Zhang08265822018-12-13 21:47:02 +0000399 * Method: Release
400 * Give the implementation a chance to release any resources after the
401 * interface is no longer used.
402 * Interface Version:
403 * 1
404 * Implementation Required:
405 * No
406 * Comments:
407 * Called by PDFium during the final cleanup process.
408 * Parameters:
409 * pThis - Pointer to the interface structure itself
410 * Return Value:
411 * None
Tom Sepezc46d0002015-11-30 15:46:36 -0800412 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700413 void (*Release)(struct _FPDF_FORMFILLINFO* pThis);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700414
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700415 /**
416 * Method: FFI_Invalidate
Lei Zhang08265822018-12-13 21:47:02 +0000417 * Invalidate the client area within the specified rectangle.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700418 * Interface Version:
Lei Zhang08265822018-12-13 21:47:02 +0000419 * 1
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700420 * Implementation Required:
Lei Zhang08265822018-12-13 21:47:02 +0000421 * yes
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700422 * Parameters:
Lei Zhang08265822018-12-13 21:47:02 +0000423 * pThis - Pointer to the interface structure itself.
424 * page - Handle to the page. Returned by FPDF_LoadPage().
425 * left - Left position of the client area in PDF page
426 * coordinates.
427 * top - Top position of the client area in PDF page
428 * coordinates.
429 * right - Right position of the client area in PDF page
430 * coordinates.
431 * bottom - Bottom position of the client area in PDF page
432 * coordinates.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700433 * Return Value:
Lei Zhang08265822018-12-13 21:47:02 +0000434 * None.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700435 *
Lei Zhang08265822018-12-13 21:47:02 +0000436 * Comments:
437 * All positions are measured in PDF "user space".
438 * Implementation should call FPDF_RenderPageBitmap() for repainting the
439 * specified page area.
440 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700441 void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis,
442 FPDF_PAGE page,
443 double left,
444 double top,
445 double right,
446 double bottom);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700447
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700448 /**
449 * Method: FFI_OutputSelectedRect
Lei Zhang08265822018-12-13 21:47:02 +0000450 * When the user selects text in form fields with the mouse, this
451 * callback function will be invoked with the selected areas.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700452 *
453 * Interface Version:
Lei Zhang08265822018-12-13 21:47:02 +0000454 * 1
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700455 * Implementation Required:
Lei Zhang08265822018-12-13 21:47:02 +0000456 * No
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700457 * Parameters:
Lei Zhang08265822018-12-13 21:47:02 +0000458 * pThis - Pointer to the interface structure itself.
459 * page - Handle to the page. Returned by FPDF_LoadPage()/
460 * left - Left position of the client area in PDF page
461 * coordinates.
462 * top - Top position of the client area in PDF page
463 * coordinates.
464 * right - Right position of the client area in PDF page
465 * coordinates.
466 * bottom - Bottom position of the client area in PDF page
467 * coordinates.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700468 * Return Value:
Lei Zhang08265822018-12-13 21:47:02 +0000469 * None.
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700470 *
Lei Zhang08265822018-12-13 21:47:02 +0000471 * Comments:
472 * This callback function is useful for implementing special text
473 * selection effects. An implementation should first record the returned
474 * rectangles, then draw them one by one during the next painting period.
475 * Lastly, it should remove all the recorded rectangles when finished
476 * painting.
477 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700478 void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis,
479 FPDF_PAGE page,
480 double left,
481 double top,
482 double right,
483 double bottom);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700484
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700485 /**
Lei Zhang08265822018-12-13 21:47:02 +0000486 * Method: FFI_SetCursor
487 * Set the Cursor shape.
488 * Interface Version:
489 * 1
490 * Implementation Required:
491 * yes
492 * Parameters:
493 * pThis - Pointer to the interface structure itself.
494 * nCursorType - Cursor type, see Flags for Cursor type for the details.
495 * Return value:
496 * None.
497 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700498 void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700499
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700500 /**
Lei Zhang08265822018-12-13 21:47:02 +0000501 * Method: FFI_SetTimer
502 * This method installs a system timer. An interval value is specified,
503 * and every time that interval elapses, the system must call into the
504 * callback function with the timer ID as returned by this function.
505 * Interface Version:
506 * 1
507 * Implementation Required:
508 * yes
509 * Parameters:
510 * pThis - Pointer to the interface structure itself.
511 * uElapse - Specifies the time-out value, in milliseconds.
512 * lpTimerFunc - A pointer to the callback function-TimerCallback.
513 * Return value:
514 * The timer identifier of the new timer if the function is successful.
515 * An application passes this value to the FFI_KillTimer method to kill
516 * the timer. Nonzero if it is successful; otherwise, it is zero.
517 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700518 int (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis,
519 int uElapse,
520 TimerCallback lpTimerFunc);
Tom Sepez9857e202015-05-13 17:09:26 -0700521
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700522 /**
Lei Zhang08265822018-12-13 21:47:02 +0000523 * Method: FFI_KillTimer
524 * This method uninstalls a system timer, as set by an earlier call to
525 * FFI_SetTimer.
526 * Interface Version:
527 * 1
528 * Implementation Required:
529 * yes
530 * Parameters:
531 * pThis - Pointer to the interface structure itself.
532 * nTimerID - The timer ID returned by FFI_SetTimer function.
533 * Return value:
534 * None.
535 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700536 void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700537
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700538 /**
Lei Zhang08265822018-12-13 21:47:02 +0000539 * Method: FFI_GetLocalTime
540 * This method receives the current local time on the system.
541 * Interface Version:
542 * 1
543 * Implementation Required:
544 * yes
545 * Parameters:
546 * pThis - Pointer to the interface structure itself.
547 * Return value:
548 * The local time. See FPDF_SYSTEMTIME above for details.
Lei Zhang425cb142018-12-13 22:28:52 +0000549 * Note: Unused.
Lei Zhang08265822018-12-13 21:47:02 +0000550 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700551 FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700552
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700553 /**
Lei Zhang08265822018-12-13 21:47:02 +0000554 * Method: FFI_OnChange
555 * This method will be invoked to notify the implementation when the
556 * value of any FormField on the document had been changed.
557 * Interface Version:
558 * 1
559 * Implementation Required:
560 * no
561 * Parameters:
562 * pThis - Pointer to the interface structure itself.
563 * Return value:
564 * None.
565 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700566 void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700567
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700568 /**
Lei Zhang08265822018-12-13 21:47:02 +0000569 * Method: FFI_GetPage
570 * This method receives the page handle associated with a specified page
571 * index.
572 * Interface Version:
573 * 1
574 * Implementation Required:
575 * yes
576 * Parameters:
577 * pThis - Pointer to the interface structure itself.
578 * document - Handle to document. Returned by FPDF_LoadDocument().
579 * nPageIndex - Index number of the page. 0 for the first page.
580 * Return value:
581 * Handle to the page, as previously returned to the implementation by
582 * FPDF_LoadPage().
583 * Comments:
584 * The implementation is expected to keep track of the page handles it
585 * receives from PDFium, and their mappings to page numbers.
586 * In some cases, the document-level JavaScript action may refer to a
587 * page which hadn't been loaded yet. To successfully run the Javascript
588 * action, the implementation need to load the page.
589 */
Dan Sinclair3ebd1212016-03-09 09:59:23 -0500590 FPDF_PAGE (*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis,
591 FPDF_DOCUMENT document,
592 int nPageIndex);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700593
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700594 /**
Lei Zhang08265822018-12-13 21:47:02 +0000595 * Method: FFI_GetCurrentPage
596 * This method receives the handle to the current page.
597 * Interface Version:
598 * 1
599 * Implementation Required:
600 * yes
601 * Parameters:
602 * pThis - Pointer to the interface structure itself.
603 * document - Handle to document. Returned by FPDF_LoadDocument().
604 * Return value:
605 * Handle to the page. Returned by FPDF_LoadPage().
606 * Comments:
607 * The implementation is expected to keep track of the current page. e.g.
608 * The current page can be the one that is most visible on screen.
609 */
Dan Sinclair3ebd1212016-03-09 09:59:23 -0500610 FPDF_PAGE (*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis,
611 FPDF_DOCUMENT document);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700612
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700613 /**
Lei Zhang08265822018-12-13 21:47:02 +0000614 * Method: FFI_GetRotation
615 * This method receives currently rotation of the page view.
616 * Interface Version:
617 * 1
618 * Implementation Required:
619 * yes
620 * Parameters:
621 * pThis - Pointer to the interface structure itself.
622 * page - Handle to page. Returned by FPDF_LoadPage function.
623 * Return value:
624 * A number to indicate the page rotation in 90 degree increments in a
625 * clockwise direction:
626 * 0 - 0 degrees
627 * 1 - 90 degrees
628 * 2 - 180 degrees
629 * 3 - 270 degrees
630 * Note: Unused.
631 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700632 int (*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700633
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700634 /**
Lei Zhang08265822018-12-13 21:47:02 +0000635 * Method: FFI_ExecuteNamedAction
636 * This method will execute a named action.
637 * Interface Version:
638 * 1
639 * Implementation Required:
640 * yes
641 * Parameters:
642 * pThis - Pointer to the interface structure itself.
643 * namedAction - A byte string which indicates the named action,
644 * terminated by 0.
645 * Return value:
646 * None.
647 * Comments:
648 * See the named actions description of <<PDF Reference, version 1.7>>
649 * for more details.
650 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700651 void (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis,
652 FPDF_BYTESTRING namedAction);
653 /**
Lei Zhang08265822018-12-13 21:47:02 +0000654 * Method: FFI_SetTextFieldFocus
655 * Called when a text field is getting or losing focus.
656 * Interface Version:
657 * 1
658 * Implementation Required:
659 * no
660 * Parameters:
661 * pThis - Pointer to the interface structure itself.
662 * value - The string value of the form field, in UTF-16LE
663 * format.
664 * valueLen - The length of the string value. This is the number
665 * of characters, not bytes.
666 * is_focus - True if the form field is getting focus, False if
667 * the form field is losing focus.
668 * Return value:
669 * None.
670 * Comments:
671 * Only supports text fields and combobox fields.
672 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700673 void (*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis,
674 FPDF_WIDESTRING value,
675 FPDF_DWORD valueLen,
676 FPDF_BOOL is_focus);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700677
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700678 /**
Lei Zhang08265822018-12-13 21:47:02 +0000679 * Method: FFI_DoURIAction
680 * Ask the implementation to navigate to a uniform resource identifier.
681 * Interface Version:
682 * 1
683 * Implementation Required:
684 * No
685 * Parameters:
686 * pThis - Pointer to the interface structure itself.
687 * bsURI - A byte string which indicates the uniform resource
688 * identifier, terminated by 0.
689 * Return value:
690 * None.
691 * Comments:
692 * See the URI actions description of <<PDF Reference, version 1.7>> for
693 * more details.
694 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700695 void (*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis,
696 FPDF_BYTESTRING bsURI);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700697
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700698 /**
Lei Zhang08265822018-12-13 21:47:02 +0000699 * Method: FFI_DoGoToAction
700 * This action changes the view to a specified destination.
701 * Interface Version:
702 * 1
703 * Implementation Required:
704 * No
705 * Parameters:
706 * pThis - Pointer to the interface structure itself.
707 * nPageIndex - The index of the PDF page.
708 * zoomMode - The zoom mode for viewing page. See below.
709 * fPosArray - The float array which carries the position info.
710 * sizeofArray - The size of float array.
711 *
712 * PDFZoom values:
713 * - XYZ = 1
714 * - FITPAGE = 2
715 * - FITHORZ = 3
716 * - FITVERT = 4
717 * - FITRECT = 5
718 * - FITBBOX = 6
719 * - FITBHORZ = 7
720 * - FITBVERT = 8
721 *
722 * Return value:
723 * None.
724 * Comments:
725 * See the Destinations description of <<PDF Reference, version 1.7>> in
726 * 8.2.1 for more details.
727 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700728 void (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis,
729 int nPageIndex,
730 int zoomMode,
731 float* fPosArray,
732 int sizeofArray);
Bo Xubb5ef882014-11-06 16:13:33 -0800733
734 /**
Tom Sepez85871732019-02-15 18:13:22 +0000735 * Pointer to IPDF_JSPLATFORM interface.
736 * Unused if PDFium is built without V8 support. Otherwise, if NULL, then
737 * JavaScript will be prevented from executing while rendering the document.
738 **/
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700739 IPDF_JSPLATFORM* m_pJsPlatform;
Bo Xubb5ef882014-11-06 16:13:33 -0800740
Tom Sepezc46d0002015-11-30 15:46:36 -0800741#ifdef PDF_ENABLE_XFA
742 /* Version 2. */
Bo Xubb5ef882014-11-06 16:13:33 -0800743 /**
Lei Zhang08265822018-12-13 21:47:02 +0000744 * Method: FFI_DisplayCaret
745 * This method will show the caret at specified position.
746 * Interface Version:
747 * 2
748 * Implementation Required:
749 * yes
750 * Parameters:
751 * pThis - Pointer to the interface structure itself.
752 * page - Handle to page. Returned by FPDF_LoadPage().
753 * left - Left position of the client area in PDF page
754 * coordinates.
755 * top - Top position of the client area in PDF page
756 * coordinates.
757 * right - Right position of the client area in PDF page
758 * coordinates.
759 * bottom - Bottom position of the client area in PDF page
760 * coordinates.
761 * Return value:
762 * None.
763 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700764 void (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis,
765 FPDF_PAGE page,
766 FPDF_BOOL bVisible,
767 double left,
768 double top,
769 double right,
770 double bottom);
Tom Sepezc46d0002015-11-30 15:46:36 -0800771
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700772 /**
773 * Method: FFI_GetCurrentPageIndex
774 * This method will get the current page index.
775 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -0800776 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700777 * Implementation Required:
778 * yes
779 * Parameters:
780 * pThis - Pointer to the interface structure itself.
781 * document - Handle to document. Returned by FPDF_LoadDocument
782 *function.
783 * Return value:
784 * The index of current page.
785 **/
786 int (*FFI_GetCurrentPageIndex)(struct _FPDF_FORMFILLINFO* pThis,
787 FPDF_DOCUMENT document);
Tom Sepezc46d0002015-11-30 15:46:36 -0800788
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700789 /**
790 * Method: FFI_SetCurrentPage
791 * This method will set the current page.
792 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -0800793 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700794 * Implementation Required:
795 * yes
796 * Parameters:
797 * pThis - Pointer to the interface structure itself.
798 * document - Handle to document. Returned by FPDF_LoadDocument
799 *function.
800 * iCurPage - The index of the PDF page.
801 * Return value:
802 * None.
803 **/
804 void (*FFI_SetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis,
805 FPDF_DOCUMENT document,
806 int iCurPage);
Tom Sepezc46d0002015-11-30 15:46:36 -0800807
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700808 /**
809 * Method: FFI_GotoURL
810 * This method will link to the specified URL.
811 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -0800812 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700813 * Implementation Required:
814 * no
815 * Parameters:
816 * pThis - Pointer to the interface structure itself.
817 * document - Handle to document. Returned by FPDF_LoadDocument
818 *function.
819 * wsURL - The string value of the URL, in UTF-16LE format.
820 * Return value:
821 * None.
822 **/
823 void (*FFI_GotoURL)(struct _FPDF_FORMFILLINFO* pThis,
824 FPDF_DOCUMENT document,
825 FPDF_WIDESTRING wsURL);
Tom Sepezc46d0002015-11-30 15:46:36 -0800826
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700827 /**
Lei Zhang08265822018-12-13 21:47:02 +0000828 * Method: FFI_GetPageViewRect
829 * This method will get the current page view rectangle.
830 * Interface Version:
831 * 2
832 * Implementation Required:
833 * yes
834 * Parameters:
835 * pThis - Pointer to the interface structure itself.
836 * page - Handle to page. Returned by FPDF_LoadPage().
837 * left - The pointer to receive left position of the page
838 * view area in PDF page coordinates.
839 * top - The pointer to receive top position of the page
840 * view area in PDF page coordinates.
841 * right - The pointer to receive right position of the page
842 * view area in PDF page coordinates.
843 * bottom - The pointer to receive bottom position of the page
844 * view area in PDF page coordinates.
845 * Return value:
846 * None.
847 */
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700848 void (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis,
849 FPDF_PAGE page,
850 double* left,
851 double* top,
852 double* right,
853 double* bottom);
Lei Zhang84e5a122016-02-19 14:25:10 -0800854
855 /**
856 * Method: FFI_PageEvent
jinming_wanga1cef702016-03-18 16:35:40 +0800857 * This method fires when pages have been added to or deleted from the XFA
858 * document.
Lei Zhang84e5a122016-02-19 14:25:10 -0800859 * Interface Version:
860 * 2
861 * Implementation Required:
862 * yes
863 * Parameters:
864 * pThis - Pointer to the interface structure itself.
jinming_wanga1cef702016-03-18 16:35:40 +0800865 * page_count - The number of pages to be added to or deleted from the
866 * document.
Lei Zhang84e5a122016-02-19 14:25:10 -0800867 * event_type - See FXFA_PAGEVIEWEVENT_* above.
868 * Return value:
869 * None.
jinming_wanga1cef702016-03-18 16:35:40 +0800870 * Comments:
871 * The pages to be added or deleted always start from the last page
872 * of document. This means that if parameter page_count is 2 and
873 * event type is FXFA_PAGEVIEWEVENT_POSTADDED, 2 new pages have been
874 * appended to the tail of document; If page_count is 2 and
875 * event type is FXFA_PAGEVIEWEVENT_POSTREMOVED, the last 2 pages
876 * have been deleted.
Lei Zhang84e5a122016-02-19 14:25:10 -0800877 **/
878 void (*FFI_PageEvent)(struct _FPDF_FORMFILLINFO* pThis,
jinming_wanga1cef702016-03-18 16:35:40 +0800879 int page_count,
Lei Zhang84e5a122016-02-19 14:25:10 -0800880 FPDF_DWORD event_type);
881
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700882 /**
Lei Zhang08265822018-12-13 21:47:02 +0000883 * Method: FFI_PopupMenu
884 * This method will track the right context menu for XFA fields.
885 * Interface Version:
886 * 2
887 * Implementation Required:
888 * yes
889 * Parameters:
890 * pThis - Pointer to the interface structure itself.
891 * page - Handle to page. Returned by FPDF_LoadPage().
892 * hWidget - Handle to XFA fields.
893 * menuFlag - The menu flags. Please refer to macro definition
894 * of FXFA_MENU_XXX and this can be one or a
895 * combination of these macros.
896 * x - X position of the client area in PDF page
897 * coordinates.
898 * y - Y position of the client area in PDF page
899 * coordinates.
900 * Return value:
901 * TRUE indicates success; otherwise false.
902 */
Dan Sinclair3ebd1212016-03-09 09:59:23 -0500903 FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis,
904 FPDF_PAGE page,
905 FPDF_WIDGET hWidget,
906 int menuFlag,
907 float x,
908 float y);
Tom Sepezc46d0002015-11-30 15:46:36 -0800909
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700910 /**
911 * Method: FFI_OpenFile
912 * This method will open the specified file with the specified mode.
913 * Interface Version
Jun Fangc30d5bf2016-02-02 18:12:23 -0800914 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700915 * Implementation Required:
916 * yes
917 * Parameters:
918 * pThis - Pointer to the interface structure itself.
919 * fileFlag - The file flag.Please refer to macro definition of
920 *FXFA_SAVEAS_XXX and this can be one of these macros.
921 * wsURL - The string value of the file URL, in UTF-16LE
922 *format.
923 * mode - The mode for open file.
924 * Return value:
925 * The handle to FPDF_FILEHANDLER.
926 **/
927 FPDF_FILEHANDLER* (*FFI_OpenFile)(struct _FPDF_FORMFILLINFO* pThis,
928 int fileFlag,
929 FPDF_WIDESTRING wsURL,
930 const char* mode);
Tom Sepezc46d0002015-11-30 15:46:36 -0800931
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700932 /**
933 * Method: FFI_EmailTo
934 * This method will email the specified file stream to the specified
935 *contacter.
936 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -0800937 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700938 * Implementation Required:
939 * yes
940 * Parameters:
941 * pThis - Pointer to the interface structure itself.
942 * pFileHandler - Handle to the FPDF_FILEHANDLER.
943 * pTo - A semicolon-delimited list of recipients for the
944 *message,in UTF-16LE format.
945 * pSubject - The subject of the message,in UTF-16LE format.
946 * pCC - A semicolon-delimited list of CC recipients for
947 *the message,in UTF-16LE format.
948 * pBcc - A semicolon-delimited list of BCC recipients for
949 *the message,in UTF-16LE format.
950 * pMsg - Pointer to the data buffer to be sent.Can be
951 *NULL,in UTF-16LE format.
952 * Return value:
953 * None.
954 **/
955 void (*FFI_EmailTo)(struct _FPDF_FORMFILLINFO* pThis,
956 FPDF_FILEHANDLER* fileHandler,
957 FPDF_WIDESTRING pTo,
958 FPDF_WIDESTRING pSubject,
959 FPDF_WIDESTRING pCC,
960 FPDF_WIDESTRING pBcc,
961 FPDF_WIDESTRING pMsg);
Tom Sepezc46d0002015-11-30 15:46:36 -0800962
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700963 /**
964 * Method: FFI_UploadTo
965 * This method will get upload the specified file stream to the
966 *specified URL.
967 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -0800968 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700969 * Implementation Required:
970 * yes
971 * Parameters:
972 * pThis - Pointer to the interface structure itself.
973 * pFileHandler - Handle to the FPDF_FILEHANDLER.
974 * fileFlag - The file flag.Please refer to macro definition of
975 *FXFA_SAVEAS_XXX and this can be one of these macros.
976 * uploadTo - Pointer to the URL path, in UTF-16LE format.
977 * Return value:
978 * None.
979 **/
980 void (*FFI_UploadTo)(struct _FPDF_FORMFILLINFO* pThis,
981 FPDF_FILEHANDLER* fileHandler,
982 int fileFlag,
983 FPDF_WIDESTRING uploadTo);
Tom Sepez9857e202015-05-13 17:09:26 -0700984
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700985 /**
986 * Method: FFI_GetPlatform
987 * This method will get the current platform.
988 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -0800989 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700990 * Implementation Required:
991 * yes
992 * Parameters:
993 * pThis - Pointer to the interface structure itself.
994 * platform - Pointer to the data buffer to receive the
995 *platform.Can be NULL,in UTF-16LE format.
996 * length - The length of the buffer, number of bytes. Can be
997 *0.
998 * Return value:
999 * The length of the buffer, number of bytes.
1000 **/
1001 int (*FFI_GetPlatform)(struct _FPDF_FORMFILLINFO* pThis,
1002 void* platform,
1003 int length);
Tom Sepezc46d0002015-11-30 15:46:36 -08001004
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001005 /**
1006 * Method: FFI_GetLanguage
1007 * This method will get the current language.
1008 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -08001009 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001010 * Implementation Required:
1011 * yes
1012 * Parameters:
1013 * pThis - Pointer to the interface structure itself.
1014 * language - Pointer to the data buffer to receive the current
1015 *language.Can be NULL.
1016 * length - The length of the buffer, number of bytes. Can be
1017 *0.
1018 * Return value:
1019 * The length of the buffer, number of bytes.
1020 **/
1021 int (*FFI_GetLanguage)(struct _FPDF_FORMFILLINFO* pThis,
1022 void* language,
1023 int length);
Tom Sepezc46d0002015-11-30 15:46:36 -08001024
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001025 /**
1026 * Method: FFI_DownloadFromURL
1027 * This method will download the specified file from the URL.
1028 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -08001029 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001030 * Implementation Required:
1031 * yes
1032 * Parameters:
1033 * pThis - Pointer to the interface structure itself.
1034 * URL - The string value of the file URL, in UTF-16LE
1035 *format.
1036 * Return value:
1037 * The handle to FPDF_FILEHANDLER.
1038 **/
Dan Sinclair3ebd1212016-03-09 09:59:23 -05001039 FPDF_LPFILEHANDLER (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis,
1040 FPDF_WIDESTRING URL);
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001041 /**
1042 * Method: FFI_PostRequestURL
1043 * This method will post the request to the server URL.
1044 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -08001045 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001046 * Implementation Required:
1047 * yes
1048 * Parameters:
1049 * pThis - Pointer to the interface structure itself.
1050 * wsURL - The string value of the server URL, in UTF-16LE
1051 *format.
1052 * wsData - The post data,in UTF-16LE format.
1053 * wsContentType - The content type of the request data,in UTF-16LE
1054 *format.
1055 * wsEncode - The encode type,in UTF-16LE format.
1056 * wsHeader - The request header,in UTF-16LE format.
1057 * response - Pointer to the FPDF_BSTR to receive the response
1058 *data from server,,in UTF-16LE format.
1059 * Return value:
1060 * TRUE indicates success, otherwise FALSE.
1061 **/
Dan Sinclair3ebd1212016-03-09 09:59:23 -05001062 FPDF_BOOL (*FFI_PostRequestURL)(struct _FPDF_FORMFILLINFO* pThis,
1063 FPDF_WIDESTRING wsURL,
1064 FPDF_WIDESTRING wsData,
1065 FPDF_WIDESTRING wsContentType,
1066 FPDF_WIDESTRING wsEncode,
1067 FPDF_WIDESTRING wsHeader,
1068 FPDF_BSTR* respone);
Tom Sepezc46d0002015-11-30 15:46:36 -08001069
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001070 /**
1071 * Method: FFI_PutRequestURL
1072 * This method will put the request to the server URL.
1073 * Interface Version:
Jun Fangc30d5bf2016-02-02 18:12:23 -08001074 * 2
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001075 * Implementation Required:
1076 * yes
1077 * Parameters:
1078 * pThis - Pointer to the interface structure itself.
1079 * wsURL - The string value of the server URL, in UTF-16LE
1080 *format.
1081 * wsData - The put data, in UTF-16LE format.
1082 * wsEncode - The encode type, in UTR-16LE format.
1083 * Return value:
1084 * TRUE indicates success, otherwise FALSE.
1085 **/
Dan Sinclair3ebd1212016-03-09 09:59:23 -05001086 FPDF_BOOL (*FFI_PutRequestURL)(struct _FPDF_FORMFILLINFO* pThis,
1087 FPDF_WIDESTRING wsURL,
1088 FPDF_WIDESTRING wsData,
1089 FPDF_WIDESTRING wsEncode);
Tom Sepezc46d0002015-11-30 15:46:36 -08001090#endif // PDF_ENABLE_XFA
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001091} FPDF_FORMFILLINFO;
1092
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001093/**
Bo Xu2b7a49d2014-11-14 17:40:50 -08001094 * Function: FPDFDOC_InitFormFillEnvironment
Tom Sepez9857e202015-05-13 17:09:26 -07001095 * Init form fill environment.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001096 * Comments:
Tom Sepez9857e202015-05-13 17:09:26 -07001097 * This function should be called before any form fill operation.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001098 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001099 * document - Handle to document. Returned by
1100 *FPDF_LoadDocument function.
Tom Sepez9857e202015-05-13 17:09:26 -07001101 * pFormFillInfo - Pointer to a FPDF_FORMFILLINFO structure.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001102 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001103 * Return handler to the form fill module. NULL means fails.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001104 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001105FPDF_EXPORT FPDF_FORMHANDLE FPDF_CALLCONV
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001106FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
1107 FPDF_FORMFILLINFO* formInfo);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001108
1109/**
Bo Xu2b7a49d2014-11-14 17:40:50 -08001110 * Function: FPDFDOC_ExitFormFillEnvironment
Tom Sepez9857e202015-05-13 17:09:26 -07001111 * Exit form fill environment.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001112 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001113 * hHandle - Handle to the form fill module. Returned by
1114 *FPDFDOC_InitFormFillEnvironment.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001115 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001116 * NULL.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001117 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001118FPDF_EXPORT void FPDF_CALLCONV
1119FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001120
1121/**
1122 * Function: FORM_OnAfterLoadPage
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001123 * This method is required for implementing all the form related
1124 *functions. Should be invoked after user
1125 * successfully loaded a PDF page, and method
1126 *FPDFDOC_InitFormFillEnvironment had been invoked.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001127 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001128 * hHandle - Handle to the form fill module. Returned by
1129 *FPDFDOC_InitFormFillEnvironment.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001130 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001131 * NONE.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001132 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001133FPDF_EXPORT void FPDF_CALLCONV FORM_OnAfterLoadPage(FPDF_PAGE page,
1134 FPDF_FORMHANDLE hHandle);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001135
1136/**
1137 * Function: FORM_OnBeforeClosePage
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001138 * This method is required for implementing all the form related
1139 *functions. Should be invoked before user
Tom Sepez9857e202015-05-13 17:09:26 -07001140 * close the PDF page.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001141 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001142 * page - Handle to the page. Returned by FPDF_LoadPage
1143 *function.
1144 * hHandle - Handle to the form fill module. Returned by
1145 *FPDFDOC_InitFormFillEnvironment.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001146 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001147 * NONE.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001148 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001149FPDF_EXPORT void FPDF_CALLCONV FORM_OnBeforeClosePage(FPDF_PAGE page,
1150 FPDF_FORMHANDLE hHandle);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001151
1152/**
1153* Function: FORM_DoDocumentJSAction
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001154* This method is required for performing Document-level JavaScript
1155*action. It should be invoked after the PDF document
Tom Sepez9857e202015-05-13 17:09:26 -07001156* had been loaded.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001157* Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001158* hHandle - Handle to the form fill module. Returned by
1159*FPDFDOC_InitFormFillEnvironment.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001160* Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001161* NONE
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001162* Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001163* If there is Document-level JavaScript action embedded in the
1164*document, this method will execute the javascript action;
Tom Sepez9857e202015-05-13 17:09:26 -07001165* otherwise, the method will do nothing.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001166**/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001167FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001168
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001169/**
1170* Function: FORM_DoDocumentOpenAction
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001171* This method is required for performing open-action when the document
1172*is opened.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001173* Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001174* hHandle - Handle to the form fill module. Returned by
1175*FPDFDOC_InitFormFillEnvironment.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001176* Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001177* NONE
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001178* Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001179* This method will do nothing if there is no open-actions embedded in
1180*the document.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001181**/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001182FPDF_EXPORT void FPDF_CALLCONV
1183FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001184
Tom Sepez9ead8112018-10-19 16:56:58 +00001185// Additional actions type of document:
1186// WC, before closing document, JavaScript action.
1187// WS, before saving document, JavaScript action.
1188// DS, after saving document, JavaScript action.
1189// WP, before printing document, JavaScript action.
1190// DP, after printing document, JavaScript action.
1191#define FPDFDOC_AACTION_WC 0x10
1192#define FPDFDOC_AACTION_WS 0x11
1193#define FPDFDOC_AACTION_DS 0x12
1194#define FPDFDOC_AACTION_WP 0x13
1195#define FPDFDOC_AACTION_DP 0x14
Nico Weber077f1a32015-08-06 15:08:57 -07001196
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001197/**
Tom Sepez9ead8112018-10-19 16:56:58 +00001198 * Function: FORM_DoDocumentAAction
1199 * This method is required for performing the document's
1200 * additional-action.
1201 * Parameters:
1202 * hHandle - Handle to the form fill module. Returned by
1203 * FPDFDOC_InitFormFillEnvironment.
1204 * aaType - The type of the additional-actions which defined
1205 * above.
1206 * Return Value:
1207 * NONE
1208 * Comments:
1209 * This method will do nothing if there is no document
1210 * additional-action corresponding to the specified aaType.
1211 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001212FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle,
1213 int aaType);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001214
Tom Sepez9ead8112018-10-19 16:56:58 +00001215// Additional-action types of page object:
1216// OPEN (/O) -- An action to be performed when the page is opened
1217// CLOSE (/C) -- An action to be performed when the page is closed
1218#define FPDFPAGE_AACTION_OPEN 0
1219#define FPDFPAGE_AACTION_CLOSE 1
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001220
1221/**
Tom Sepez9ead8112018-10-19 16:56:58 +00001222 * Function: FORM_DoPageAAction
1223 * This method is required for performing the page object's
1224 * additional-action when opened or closed.
1225 * Parameters:
1226 * page - Handle to the page. Returned by FPDF_LoadPage
1227 * function.
1228 * hHandle - Handle to the form fill module. Returned by
1229 * FPDFDOC_InitFormFillEnvironment.
1230 * aaType - The type of the page object's additional-actions
1231 * which defined above.
1232 * Return Value:
1233 * NONE
1234 * Comments:
1235 * This method will do nothing if no additional-action corresponding
1236 * to the specified aaType exists.
1237 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001238FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page,
1239 FPDF_FORMHANDLE hHandle,
1240 int aaType);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001241
1242/**
1243 * Function: FORM_OnMouseMove
Tom Sepez9857e202015-05-13 17:09:26 -07001244 * You can call this member function when the mouse cursor moves.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001245 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001246 * hHandle - Handle to the form fill module. Returned by
1247 *FPDFDOC_InitFormFillEnvironment.
1248 * page - Handle to the page. Returned by FPDF_LoadPage
1249 *function.
Tom Sepez9857e202015-05-13 17:09:26 -07001250 * modifier - Indicates whether various virtual keys are down.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001251 * page_x - Specifies the x-coordinate of the cursor in PDF user
1252 *space.
1253 * page_y - Specifies the y-coordinate of the cursor in PDF user
1254 *space.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001255 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001256 * TRUE indicates success; otherwise false.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001257 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001258FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,
1259 FPDF_PAGE page,
1260 int modifier,
1261 double page_x,
1262 double page_y);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001263
1264/**
Lei Zhang63b01262017-08-31 08:54:46 -07001265 * Function: FORM_OnFocus
1266 * This function focuses the form annotation at a given point. If the
1267 * annotation at the point already has focus, nothing happens. If there
1268 * is no annotation at the point, remove form focus.
1269 * Parameters:
1270 * hHandle - Handle to the form fill module. Returned by
1271 * FPDFDOC_InitFormFillEnvironment.
1272 * page - Handle to the page. Returned by FPDF_LoadPage.
1273 * modifier - Indicates whether various virtual keys are down.
1274 * page_x - Specifies the x-coordinate of the cursor in PDF user
1275 * space.
1276 * page_y - Specifies the y-coordinate of the cursor in PDF user
1277 * space.
1278 * Return Value:
1279 * TRUE if there is an annotation at the given point and it has focus.
1280 **/
1281FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnFocus(FPDF_FORMHANDLE hHandle,
1282 FPDF_PAGE page,
1283 int modifier,
1284 double page_x,
1285 double page_y);
1286
1287/**
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001288 * Function: FORM_OnLButtonDown
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001289 * You can call this member function when the user presses the left
Lei Zhanga37989f2018-10-17 20:32:41 +00001290 * mouse button.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001291 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001292 * hHandle - Handle to the form fill module. Returned by
Lei Zhanga37989f2018-10-17 20:32:41 +00001293 * FPDFDOC_InitFormFillEnvironment().
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001294 * page - Handle to the page. Returned by FPDF_LoadPage
Lei Zhanga37989f2018-10-17 20:32:41 +00001295 * function.
1296 * modifier - Indicates whether various virtual keys are down.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001297 * page_x - Specifies the x-coordinate of the cursor in PDF user
Lei Zhanga37989f2018-10-17 20:32:41 +00001298 * space.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001299 * page_y - Specifies the y-coordinate of the cursor in PDF user
Lei Zhanga37989f2018-10-17 20:32:41 +00001300 * space.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001301 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001302 * TRUE indicates success; otherwise false.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001303 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001304FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,
1305 FPDF_PAGE page,
1306 int modifier,
1307 double page_x,
1308 double page_y);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001309
1310/**
1311 * Function: FORM_OnLButtonUp
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001312 * You can call this member function when the user releases the left
Lei Zhanga37989f2018-10-17 20:32:41 +00001313 * mouse button.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001314 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001315 * hHandle - Handle to the form fill module. Returned by
Lei Zhanga37989f2018-10-17 20:32:41 +00001316 * FPDFDOC_InitFormFillEnvironment().
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001317 * page - Handle to the page. Returned by FPDF_LoadPage
1318 *function.
Tom Sepez9857e202015-05-13 17:09:26 -07001319 * modifier - Indicates whether various virtual keys are down.
1320 * page_x - Specifies the x-coordinate of the cursor in device.
1321 * page_y - Specifies the y-coordinate of the cursor in device.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001322 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001323 * TRUE indicates success; otherwise false.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001324 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001325FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,
1326 FPDF_PAGE page,
1327 int modifier,
1328 double page_x,
1329 double page_y);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001330
Lei Zhanga37989f2018-10-17 20:32:41 +00001331/**
1332 * Function: FORM_OnLButtonDoubleClick
1333 * You can call this member function when the user double clicks the
1334 * left mouse button.
1335 * Parameters:
1336 * hHandle - Handle to the form fill module. Returned by
1337 * FPDFDOC_InitFormFillEnvironment().
1338 * page - Handle to the page. Returned by FPDF_LoadPage
1339 * function.
1340 * modifier - Indicates whether various virtual keys are down.
1341 * page_x - Specifies the x-coordinate of the cursor in PDF user
1342 * space.
1343 * page_y - Specifies the y-coordinate of the cursor in PDF user
1344 * space.
1345 * Return Value:
1346 * TRUE indicates success; otherwise false.
1347 **/
1348FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1349FORM_OnLButtonDoubleClick(FPDF_FORMHANDLE hHandle,
1350 FPDF_PAGE page,
1351 int modifier,
1352 double page_x,
1353 double page_y);
1354
Tom Sepezc46d0002015-11-30 15:46:36 -08001355#ifdef PDF_ENABLE_XFA
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001356FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle,
1357 FPDF_PAGE page,
1358 int modifier,
1359 double page_x,
1360 double page_y);
1361FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle,
1362 FPDF_PAGE page,
1363 int modifier,
1364 double page_x,
1365 double page_y);
Tom Sepezc46d0002015-11-30 15:46:36 -08001366#endif // PDF_ENABLE_XFA
Bo Xufdc00a72014-10-28 23:03:33 -07001367
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001368/**
1369 * Function: FORM_OnKeyDown
Tom Sepez9857e202015-05-13 17:09:26 -07001370 * You can call this member function when a nonsystem key is pressed.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001371 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001372 * hHandle - Handle to the form fill module. Returned by
1373 *FPDFDOC_InitFormFillEnvironment.
1374 * page - Handle to the page. Returned by FPDF_LoadPage
1375 *function.
Tom Sepez9857e202015-05-13 17:09:26 -07001376 * nKeyCode - Indicates whether various virtual keys are down.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001377 * modifier - Contains the scan code, key-transition code,
1378 *previous key state, and context code.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001379 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001380 * TRUE indicates success; otherwise false.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001381 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001382FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,
1383 FPDF_PAGE page,
1384 int nKeyCode,
1385 int modifier);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001386
1387/**
1388 * Function: FORM_OnKeyUp
Tom Sepez9857e202015-05-13 17:09:26 -07001389 * You can call this member function when a nonsystem key is released.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001390 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001391 * hHandle - Handle to the form fill module. Returned by
1392 *FPDFDOC_InitFormFillEnvironment.
1393 * page - Handle to the page. Returned by FPDF_LoadPage
1394 *function.
Tom Sepez9857e202015-05-13 17:09:26 -07001395 * nKeyCode - The virtual-key code of the given key.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001396 * modifier - Contains the scan code, key-transition code,
1397 *previous key state, and context code.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001398 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001399 * TRUE indicates success; otherwise false.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001400 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001401FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,
1402 FPDF_PAGE page,
1403 int nKeyCode,
1404 int modifier);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001405
1406/**
1407 * Function: FORM_OnChar
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001408 * You can call this member function when a keystroke translates to a
1409 *nonsystem character.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001410 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001411 * hHandle - Handle to the form fill module. Returned by
1412 *FPDFDOC_InitFormFillEnvironment.
1413 * page - Handle to the page. Returned by FPDF_LoadPage
1414 *function.
Tom Sepez9857e202015-05-13 17:09:26 -07001415 * nChar - The character code value of the key.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001416 * modifier - Contains the scan code, key-transition code,
1417 *previous key state, and context code.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001418 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001419 * TRUE indicates success; otherwise false.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001420 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001421FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle,
1422 FPDF_PAGE page,
1423 int nChar,
1424 int modifier);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001425
1426/**
Lei Zhanga4c7ac42018-04-17 15:12:58 +00001427 * Experimental API
1428 * Function: FORM_GetFocusedText
1429 * You can call this function to obtain the text within the current
1430 * focused field, if any.
1431 * Parameters:
1432 * hHandle - Handle to the form fill module. Returned by
1433 * FPDFDOC_InitFormFillEnvironment.
1434 * page - Handle to the page. Returned by FPDF_LoadPage
1435 * function.
1436 * buffer - Buffer for holding the form text, encoded in
1437 * UTF16-LE. If NULL, |buffer| is not modified.
1438 * buflen - Length of |buffer| in bytes. If |buflen| is less
1439 than the length of the form text string, |buffer| is
1440 not modified.
1441 * Return Value:
1442 * Length in bytes for the text in the focused field.
1443 **/
1444FPDF_EXPORT unsigned long FPDF_CALLCONV
1445FORM_GetFocusedText(FPDF_FORMHANDLE hHandle,
1446 FPDF_PAGE page,
1447 void* buffer,
1448 unsigned long buflen);
1449
1450/**
Diana Gagedce2d722017-06-20 11:17:11 -07001451 * Function: FORM_GetSelectedText
1452 * You can call this function to obtain selected text within
1453 * a form text field or form combobox text field.
1454 * Parameters:
1455 * hHandle - Handle to the form fill module. Returned by
1456 * FPDFDOC_InitFormFillEnvironment.
1457 * page - Handle to the page. Returned by FPDF_LoadPage
1458 * function.
Lei Zhanga4c7ac42018-04-17 15:12:58 +00001459 * buffer - Buffer for holding the selected text, encoded in
1460 * UTF16-LE. If NULL, |buffer| is not modified.
1461 * buflen - Length of |buffer| in bytes. If |buflen| is less
1462 than the length of the selected text string,
1463 |buffer| is not modified.
Diana Gagedce2d722017-06-20 11:17:11 -07001464 * Return Value:
1465 * Length in bytes of selected text in form text field or form combobox
1466 * text field.
1467 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001468FPDF_EXPORT unsigned long FPDF_CALLCONV
1469FORM_GetSelectedText(FPDF_FORMHANDLE hHandle,
1470 FPDF_PAGE page,
1471 void* buffer,
1472 unsigned long buflen);
Diana Gagedce2d722017-06-20 11:17:11 -07001473
1474/**
Diana Gageab390972017-07-28 17:07:39 -07001475 * Function: FORM_ReplaceSelection
1476 * You can call this function to replace the selected text in a form
1477 * text field or user-editable form combobox text field with another
1478 * text string (which can be empty or non-empty). If there is no
1479 * selected text, this function will append the replacement text after
1480 * the current caret position.
Diana Gage1c7f1422017-07-24 11:19:52 -07001481 * Parameters:
1482 * hHandle - Handle to the form fill module. Returned by
1483 * FPDFDOC_InitFormFillEnvironment.
1484 * page - Handle to the page. Returned by FPDF_LoadPage
1485 * function.
Diana Gageab390972017-07-28 17:07:39 -07001486 * wsText - The text to be inserted, in UTF-16LE format.
Diana Gage1c7f1422017-07-24 11:19:52 -07001487 * Return Value:
1488 * None.
1489 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001490FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceSelection(FPDF_FORMHANDLE hHandle,
1491 FPDF_PAGE page,
1492 FPDF_WIDESTRING wsText);
Diana Gage1c7f1422017-07-24 11:19:52 -07001493
1494/**
Lei Zhangee967722018-04-19 20:55:54 +00001495 * Function: FORM_CanUndo
1496 * Find out if it is possible for the current focused widget in a given
1497 * form to perform an undo operation.
1498 * Parameters:
1499 * hHandle - Handle to the form fill module. Returned by
1500 * FPDFDOC_InitFormFillEnvironment.
1501 * page - Handle to the page. Returned by FPDF_LoadPage
1502 * function.
1503 * Return Value:
1504 * True if it is possible to undo.
1505 **/
1506FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanUndo(FPDF_FORMHANDLE hHandle,
1507 FPDF_PAGE page);
1508
1509/**
1510 * Function: FORM_CanRedo
1511 * Find out if it is possible for the current focused widget in a given
1512 * form to perform a redo operation.
1513 * Parameters:
1514 * hHandle - Handle to the form fill module. Returned by
1515 * FPDFDOC_InitFormFillEnvironment.
1516 * page - Handle to the page. Returned by FPDF_LoadPage
1517 * function.
1518 * Return Value:
1519 * True if it is possible to redo.
1520 **/
1521FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanRedo(FPDF_FORMHANDLE hHandle,
1522 FPDF_PAGE page);
1523
1524/**
1525 * Function: FORM_Undo
1526 * Make the current focussed widget perform an undo operation.
1527 * Parameters:
1528 * hHandle - Handle to the form fill module. Returned by
1529 * FPDFDOC_InitFormFillEnvironment.
1530 * page - Handle to the page. Returned by FPDF_LoadPage
1531 * function.
1532 * Return Value:
1533 * True if the undo operation succeeded.
1534 **/
1535FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Undo(FPDF_FORMHANDLE hHandle,
1536 FPDF_PAGE page);
1537
1538/**
1539 * Function: FORM_Redo
1540 * Make the current focussed widget perform a redo operation.
1541 * Parameters:
1542 * hHandle - Handle to the form fill module. Returned by
1543 * FPDFDOC_InitFormFillEnvironment.
1544 * page - Handle to the page. Returned by FPDF_LoadPage
1545 * function.
1546 * Return Value:
1547 * True if the redo operation succeeded.
1548 **/
1549FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Redo(FPDF_FORMHANDLE hHandle,
1550 FPDF_PAGE page);
1551
1552/**
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001553 * Function: FORM_ForceToKillFocus.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001554 * You can call this member function to force to kill the focus of the
1555 *form field which got focus.
1556 * It would kill the focus on the form field, save the value of form
1557 *field if it's changed by user.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001558 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001559 * hHandle - Handle to the form fill module. Returned by
1560 *FPDFDOC_InitFormFillEnvironment.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001561 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001562 * TRUE indicates success; otherwise false.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001563 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001564FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1565FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001566
Ryan Harrison9baf31f2018-01-12 18:36:30 +00001567// Form Field Types
1568// The names of the defines are stable, but the specific values associated with
1569// them are not, so do not hardcode their values.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001570#define FPDF_FORMFIELD_UNKNOWN 0 // Unknown.
1571#define FPDF_FORMFIELD_PUSHBUTTON 1 // push button type.
1572#define FPDF_FORMFIELD_CHECKBOX 2 // check box type.
1573#define FPDF_FORMFIELD_RADIOBUTTON 3 // radio button type.
1574#define FPDF_FORMFIELD_COMBOBOX 4 // combo box type.
1575#define FPDF_FORMFIELD_LISTBOX 5 // list box type.
1576#define FPDF_FORMFIELD_TEXTFIELD 6 // text field type.
Ryan Harrison9baf31f2018-01-12 18:36:30 +00001577#define FPDF_FORMFIELD_SIGNATURE 7 // text field type.
Tom Sepezc46d0002015-11-30 15:46:36 -08001578#ifdef PDF_ENABLE_XFA
Ryan Harrison2056fac2018-01-16 16:06:45 +00001579#define FPDF_FORMFIELD_XFA 8 // Generic XFA type.
1580#define FPDF_FORMFIELD_XFA_CHECKBOX 9 // XFA check box type.
1581#define FPDF_FORMFIELD_XFA_COMBOBOX 10 // XFA combo box type.
1582#define FPDF_FORMFIELD_XFA_IMAGEFIELD 11 // XFA image field type.
1583#define FPDF_FORMFIELD_XFA_LISTBOX 12 // XFA list box type.
1584#define FPDF_FORMFIELD_XFA_PUSHBUTTON 13 // XFA push button type.
1585#define FPDF_FORMFIELD_XFA_SIGNATURE 14 // XFA signture field type.
1586#define FPDF_FORMFIELD_XFA_TEXTFIELD 15 // XFA text field type.
1587#endif // PDF_ENABLE_XFA
Ryan Harrison9baf31f2018-01-12 18:36:30 +00001588
Tom Sepezca0273392018-05-25 23:37:50 +00001589#ifdef PDF_ENABLE_XFA
Ryan Harrison2056fac2018-01-16 16:06:45 +00001590#define FPDF_FORMFIELD_COUNT 16
Tom Sepez62d8ebe2018-06-12 20:49:55 +00001591#else // PDF_ENABLE_XFA
Tom Sepezca0273392018-05-25 23:37:50 +00001592#define FPDF_FORMFIELD_COUNT 8
Ryan Harrison2056fac2018-01-16 16:06:45 +00001593#endif // PDF_ENABLE_XFA
1594
1595#ifdef PDF_ENABLE_XFA
Ryan Harrisonc3cc2ab2018-06-21 21:09:54 +00001596#define IS_XFA_FORMFIELD(type) \
1597 (((type) == FPDF_FORMFIELD_XFA) || \
1598 ((type) == FPDF_FORMFIELD_XFA_CHECKBOX) || \
1599 ((type) == FPDF_FORMFIELD_XFA_COMBOBOX) || \
1600 ((type) == FPDF_FORMFIELD_XFA_IMAGEFIELD) || \
1601 ((type) == FPDF_FORMFIELD_XFA_LISTBOX) || \
1602 ((type) == FPDF_FORMFIELD_XFA_PUSHBUTTON) || \
1603 ((type) == FPDF_FORMFIELD_XFA_SIGNATURE) || \
1604 ((type) == FPDF_FORMFIELD_XFA_TEXTFIELD))
Tom Sepezc46d0002015-11-30 15:46:36 -08001605#endif // PDF_ENABLE_XFA
Tom Sepez9857e202015-05-13 17:09:26 -07001606
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001607/**
Lei Zhangbdf72c32015-08-14 19:24:08 -07001608 * Function: FPDFPage_HasFormFieldAtPoint
1609 * Get the form field type by point.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001610 * Parameters:
Lei Zhangbdf72c32015-08-14 19:24:08 -07001611 * hHandle - Handle to the form fill module. Returned by
1612 * FPDFDOC_InitFormFillEnvironment().
1613 * page - Handle to the page. Returned by FPDF_LoadPage().
1614 * page_x - X position in PDF "user space".
1615 * page_y - Y position in PDF "user space".
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001616 * Return Value:
Lei Zhangbdf72c32015-08-14 19:24:08 -07001617 * Return the type of the form field; -1 indicates no field.
1618 * See field types above.
1619 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001620FPDF_EXPORT int FPDF_CALLCONV
1621FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
1622 FPDF_PAGE page,
1623 double page_x,
1624 double page_y);
Lei Zhangbdf72c32015-08-14 19:24:08 -07001625
1626/**
Lei Zhangbdf72c32015-08-14 19:24:08 -07001627 * Function: FPDFPage_FormFieldZOrderAtPoint
1628 * Get the form field z-order by point.
1629 * Parameters:
1630 * hHandle - Handle to the form fill module. Returned by
1631 * FPDFDOC_InitFormFillEnvironment().
1632 * page - Handle to the page. Returned by FPDF_LoadPage().
1633 * page_x - X position in PDF "user space".
1634 * page_y - Y position in PDF "user space".
1635 * Return Value:
1636 * Return the z-order of the form field; -1 indicates no field.
1637 * Higher numbers are closer to the front.
1638 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001639FPDF_EXPORT int FPDF_CALLCONV
1640FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle,
1641 FPDF_PAGE page,
1642 double page_x,
1643 double page_y);
Lei Zhangbdf72c32015-08-14 19:24:08 -07001644
1645/**
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001646 * Function: FPDF_SetFormFieldHighlightColor
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001647 * Set the highlight color of specified or all the form fields in the
1648 *document.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001649 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001650 * hHandle - Handle to the form fill module. Returned by
1651 *FPDFDOC_InitFormFillEnvironment.
1652 * doc - Handle to the document. Returned by
1653 *FPDF_LoadDocument function.
1654 * fieldType - A 32-bit integer indicating the type of a form
1655 *field(defined above).
1656 * color - The highlight color of the form field.Constructed by
1657 *0xxxrrggbb.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001658 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001659 * NONE.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001660 * Comments:
Ryan Harrison9baf31f2018-01-12 18:36:30 +00001661 * When the parameter fieldType is set to FPDF_FORMFIELD_UNKNOWN, the
1662 * highlight color will be applied to all the form fields in the
Tom Sepez9857e202015-05-13 17:09:26 -07001663 * document.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001664 * Please refresh the client window to show the highlight immediately
Ryan Harrison9baf31f2018-01-12 18:36:30 +00001665 * if necessary.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001666 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001667FPDF_EXPORT void FPDF_CALLCONV
1668FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle,
1669 int fieldType,
1670 unsigned long color);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001671
1672/**
1673 * Function: FPDF_SetFormFieldHighlightAlpha
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001674 * Set the transparency of the form field highlight color in the
1675 *document.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001676 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001677 * hHandle - Handle to the form fill module. Returned by
1678 *FPDFDOC_InitFormFillEnvironment.
1679 * doc - Handle to the document. Returned by
1680 *FPDF_LoadDocument function.
1681 * alpha - The transparency of the form field highlight color.
1682 *between 0-255.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001683 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001684 * NONE.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001685 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001686FPDF_EXPORT void FPDF_CALLCONV
1687FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001688
1689/**
1690 * Function: FPDF_RemoveFormFieldHighlight
Tom Sepez9857e202015-05-13 17:09:26 -07001691 * Remove the form field highlight color in the document.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001692 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001693 * hHandle - Handle to the form fill module. Returned by
1694 *FPDFDOC_InitFormFillEnvironment.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001695 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001696 * NONE.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001697 * Comments:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001698 * Please refresh the client window to remove the highlight immediately
1699 *if necessary.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001700 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001701FPDF_EXPORT void FPDF_CALLCONV
1702FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001703
1704/**
1705* Function: FPDF_FFLDraw
jaepark75f84a52016-09-09 15:39:09 -07001706* Render FormFields and popup window on a page to a device independent
1707*bitmap.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001708* Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001709* hHandle - Handle to the form fill module. Returned by
1710*FPDFDOC_InitFormFillEnvironment.
1711* bitmap - Handle to the device independent bitmap (as the
1712*output buffer).
1713* Bitmap handle can be created by FPDFBitmap_Create
1714*function.
1715* page - Handle to the page. Returned by FPDF_LoadPage
1716*function.
1717* start_x - Left pixel position of the display area in the
1718*device coordinate.
1719* start_y - Top pixel position of the display area in the device
1720*coordinate.
Tom Sepez9857e202015-05-13 17:09:26 -07001721* size_x - Horizontal size (in pixels) for displaying the page.
1722* size_y - Vertical size (in pixels) for displaying the page.
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001723* rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
1724*clockwise),
1725* 2 (rotated 180 degrees), 3 (rotated 90 degrees
1726*counter-clockwise).
1727* flags - 0 for normal display, or combination of flags
1728*defined above.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001729* Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001730* None.
1731* Comments:
jaepark75f84a52016-09-09 15:39:09 -07001732* This function is designed to render annotations that are
1733*user-interactive, which are widget annotation (for FormFields) and popup
1734*annotation.
1735* With FPDF_ANNOT flag, this function will render popup annotation
1736*when users mouse-hover on non-widget annotation. Regardless of FPDF_ANNOT flag,
1737*this function will always render widget annotations for FormFields.
1738* In order to implement the FormFill functions, implementation should
1739*call this function after rendering functions, such as FPDF_RenderPageBitmap or
1740*FPDF_RenderPageBitmap_Start, finish rendering the page contents.
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001741**/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001742FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
1743 FPDF_BITMAP bitmap,
1744 FPDF_PAGE page,
1745 int start_x,
1746 int start_y,
1747 int size_x,
1748 int size_y,
1749 int rotate,
1750 int flags);
Tom Sepezc46d0002015-11-30 15:46:36 -08001751
Cary Clark399be5b2016-03-14 16:51:29 -04001752#ifdef _SKIA_SUPPORT_
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001753FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLRecord(FPDF_FORMHANDLE hHandle,
1754 FPDF_RECORDER recorder,
1755 FPDF_PAGE page,
1756 int start_x,
1757 int start_y,
1758 int size_x,
1759 int size_y,
1760 int rotate,
1761 int flags);
Cary Clark399be5b2016-03-14 16:51:29 -04001762#endif
1763
Jun Fange118ce92015-02-17 06:50:08 -08001764/**
Ryan Harrison854d71c2017-10-18 12:28:14 -04001765 * Experimental API
1766 * Function: FPDF_GetFormType
Lei Zhangd6e92bd2018-01-29 19:01:26 +00001767 * Returns the type of form contained in the PDF document.
Jun Fange118ce92015-02-17 06:50:08 -08001768 * Parameters:
Lei Zhangd6e92bd2018-01-29 19:01:26 +00001769 * document - Handle to document.
Jun Fange118ce92015-02-17 06:50:08 -08001770 * Return Value:
Lei Zhangd6e92bd2018-01-29 19:01:26 +00001771 * Integer value representing one of the FORMTYPE_ values.
1772 * Comments:
1773 * If |document| is NULL, then the return value is FORMTYPE_NONE.
Jun Fange118ce92015-02-17 06:50:08 -08001774 **/
Ryan Harrison854d71c2017-10-18 12:28:14 -04001775FPDF_EXPORT int FPDF_CALLCONV FPDF_GetFormType(FPDF_DOCUMENT document);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001776
rycsmitha5230e22019-02-21 17:33:03 +00001777/**
1778 * Experimental API
1779 * Function: FORM_SetIndexSelected
1780 * Selects/deselects the value at the given |index| of the focused
1781 * annotation.
1782 * Parameters:
1783 * hHandle - Handle to the form fill module. Returned by
1784 * FPDFDOC_InitFormFillEnvironment.
1785 * page - Handle to the page. Returned by FPDF_LoadPage
1786 * index - 0-based index of value to be set as
1787 * selected/unselected
1788 * selected - true to select, false to deselect
1789 * Return Value:
1790 * TRUE if the operation succeeded.
1791 * FALSE if the operation failed or widget is not a supported type.
1792 * Comments:
1793 * Intended for use with listbox/combobox widget types. Comboboxes
1794 * have at most a single value selected at a time which cannot be
1795 * deselected. Deselect on a combobox is a no-op that returns false.
1796 * Default implementation is a no-op that will return false for
1797 * other types.
1798 * Not currently supported for XFA forms - will return false.
1799 **/
1800FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1801FORM_SetIndexSelected(FPDF_FORMHANDLE hHandle,
1802 FPDF_PAGE page,
1803 int index,
1804 FPDF_BOOL selected);
1805
1806/**
1807 * Experimental API
1808 * Function: FORM_IsIndexSelected
1809 * Returns whether or not the value at |index| of the focused
1810 * annotation is currently selected.
1811 * Parameters:
1812 * hHandle - Handle to the form fill module. Returned by
1813 * FPDFDOC_InitFormFillEnvironment.
1814 * page - Handle to the page. Returned by FPDF_LoadPage
1815 * index - 0-based Index of value to check
1816 * Return Value:
1817 * TRUE if value at |index| is currently selected.
1818 * FALSE if value at |index| is not selected or widget is not a
1819 * supported type.
1820 * Comments:
1821 * Intended for use with listbox/combobox widget types. Default
1822 * implementation is a no-op that will return false for other types.
1823 * Not currently supported for XFA forms - will return false.
1824 **/
1825FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1826FORM_IsIndexSelected(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int index);
1827
Ryan Harrisona74a6272017-10-16 10:57:48 -04001828#ifdef PDF_ENABLE_XFA
Bo Xufdc00a72014-10-28 23:03:33 -07001829/**
1830 * Function: FPDF_LoadXFA
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001831 * If the document consists of XFA fields, there should call this
1832 *method to load XFA fields.
Bo Xufdc00a72014-10-28 23:03:33 -07001833 * Parameters:
Nico Weber9d8ec5a2015-08-04 13:00:21 -07001834 * document - Handle to document. Returned by
1835 *FPDF_LoadDocument function.
Bo Xufdc00a72014-10-28 23:03:33 -07001836 * Return Value:
Tom Sepez9857e202015-05-13 17:09:26 -07001837 * TRUE indicates success,otherwise FALSE.
Bo Xufdc00a72014-10-28 23:03:33 -07001838 **/
Dan Sinclair00d2ad12017-08-10 14:13:02 -04001839FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_LoadXFA(FPDF_DOCUMENT document);
Tom Sepezc46d0002015-11-30 15:46:36 -08001840#endif // PDF_ENABLE_XFA
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001841
1842#ifdef __cplusplus
Tom Sepez9857e202015-05-13 17:09:26 -07001843}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001844#endif
1845
Tom Sepez9857e202015-05-13 17:09:26 -07001846#endif // PUBLIC_FPDF_FORMFILL_H_