• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 PUBLIC_FPDF_FORMFILL_H_
8 #define PUBLIC_FPDF_FORMFILL_H_
9 
10 // clang-format off
11 // NOLINTNEXTLINE(build/include)
12 #include "fpdfview.h"
13 
14 // These values are return values for a public API, so should not be changed
15 // other than the count when adding new values.
16 #define FORMTYPE_NONE 0            // Document contains no forms
17 #define FORMTYPE_ACRO_FORM 1       // Forms are specified using AcroForm spec
18 #define FORMTYPE_XFA_FULL 2        // Forms are specified using entire XFA 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
22 
23 #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 
47 // Exported Functions
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 typedef struct _IPDF_JsPlatform {
53   /*
54    * Version number of the interface. Currently must be 2.
55    */
56   int version;
57 
58   /* Version 1. */
59 
60   /*
61    * 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, one of the
72    *                       JSPLATFORM_ALERT_BUTTON_* values above.
73    *       nIcon       -   The type of the icon, one of the
74    *                       JSPLATFORM_ALERT_ICON_* above.
75    * Return Value:
76    *       Option selected by user in dialogue, one of the
77    *       JSPLATFORM_ALERT_RETURN_* values above.
78    */
79   int (*app_alert)(struct _IPDF_JsPlatform* pThis,
80                    FPDF_WIDESTRING Msg,
81                    FPDF_WIDESTRING Title,
82                    int Type,
83                    int Icon);
84 
85   /*
86    * Method: app_beep
87    *       Causes the system to play a sound.
88    * Interface Version:
89    *       1
90    * Implementation Required:
91    *       yes
92    * Parameters:
93    *       pThis       -   Pointer to the interface structure itself
94    *       nType       -   The sound type, see JSPLATFORM_BEEP_TYPE_*
95    *                       above.
96    * Return Value:
97    *       None
98    */
99   void (*app_beep)(struct _IPDF_JsPlatform* pThis, int nType);
100 
101   /*
102    * Method: app_response
103    *       Displays a dialog box containing a question and an entry field for
104    *       the user to reply to the question.
105    * Interface Version:
106    *       1
107    * Implementation Required:
108    *       yes
109    * Parameters:
110    *       pThis       -   Pointer to the interface structure itself
111    *       Question    -   The question to be posed to the user.
112    *       Title       -   The title of the dialog box.
113    *       Default     -   A default value for the answer to the question. If
114    *                       not specified, no default value is presented.
115    *       cLabel      -   A short string to appear in front of and on the
116    *                       same line as the edit text field.
117    *       bPassword   -   If true, indicates that the user's response should
118    *                       be shown as asterisks (*) or bullets (?) to mask
119    *                       the response, which might be sensitive information.
120    *       response    -   A string buffer allocated by PDFium, to receive the
121    *                       user's response.
122    *       length      -   The length of the buffer in bytes. Currently, it is
123    *                       always 2048.
124    * Return Value:
125    *       Number of bytes the complete user input would actually require, not
126    *       including trailing zeros, regardless of the value of the length
127    *       parameter or the presence of the response buffer.
128    * Comments:
129    *       No matter on what platform, the response buffer should be always
130    *       written using UTF-16LE encoding. If a response buffer is
131    *       present and the size of the user input exceeds the capacity of the
132    *       buffer as specified by the length parameter, only the
133    *       first "length" bytes of the user input are to be written to the
134    *       buffer.
135    */
136   int (*app_response)(struct _IPDF_JsPlatform* pThis,
137                       FPDF_WIDESTRING Question,
138                       FPDF_WIDESTRING Title,
139                       FPDF_WIDESTRING Default,
140                       FPDF_WIDESTRING cLabel,
141                       FPDF_BOOL bPassword,
142                       void* response,
143                       int length);
144 
145   /*
146    * Method: Doc_getFilePath
147    *       Get the file path of the current document.
148    * Interface Version:
149    *       1
150    * Implementation Required:
151    *       yes
152    * Parameters:
153    *       pThis       -   Pointer to the interface structure itself
154    *       filePath    -   The string buffer to receive the file path. Can
155    *                       be NULL.
156    *       length      -   The length of the buffer, number of bytes. Can
157    *                       be 0.
158    * Return Value:
159    *       Number of bytes the filePath consumes, including trailing zeros.
160    * Comments:
161    *       The filePath should always be provided in the local encoding.
162    *       The return value always indicated number of bytes required for
163    *       the buffer, even when there is no buffer specified, or the buffer
164    *       size is less than required. In this case, the buffer will not
165    *       be modified.
166    */
167   int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis,
168                          void* filePath,
169                          int length);
170 
171   /*
172    * Method: Doc_mail
173    *       Mails the data buffer as an attachment to all recipients, with or
174    *       without user interaction.
175    * Interface Version:
176    *       1
177    * Implementation Required:
178    *       yes
179    * Parameters:
180    *       pThis       -   Pointer to the interface structure itself
181    *       mailData    -   Pointer to the data buffer to be sent. Can be NULL.
182    *       length      -   The size,in bytes, of the buffer pointed by
183    *                       mailData parameter. Can be 0.
184    *       bUI         -   If true, the rest of the parameters are used in a
185    *                       compose-new-message window that is displayed to the
186    *                       user. If false, the cTo parameter is required and
187    *                       all others are optional.
188    *       To          -   A semicolon-delimited list of recipients for the
189    *                       message.
190    *       Subject     -   The subject of the message. The length limit is
191    *                       64 KB.
192    *       CC          -   A semicolon-delimited list of CC recipients for
193    *                       the message.
194    *       BCC         -   A semicolon-delimited list of BCC recipients for
195    *                       the message.
196    *       Msg         -   The content of the message. The length limit is
197    *                       64 KB.
198    * Return Value:
199    *       None.
200    * Comments:
201    *       If the parameter mailData is NULL or length is 0, the current
202    *       document will be mailed as an attachment to all recipients.
203    */
204   void (*Doc_mail)(struct _IPDF_JsPlatform* pThis,
205                    void* mailData,
206                    int length,
207                    FPDF_BOOL bUI,
208                    FPDF_WIDESTRING To,
209                    FPDF_WIDESTRING Subject,
210                    FPDF_WIDESTRING CC,
211                    FPDF_WIDESTRING BCC,
212                    FPDF_WIDESTRING Msg);
213 
214   /*
215    * Method: Doc_print
216    *       Prints all or a specific number of pages of the document.
217    * Interface Version:
218    *       1
219    * Implementation Required:
220    *       yes
221    * Parameters:
222    *       pThis         -   Pointer to the interface structure itself.
223    *       bUI           -   If true, will cause a UI to be presented to the
224    *                         user to obtain printing information and confirm
225    *                         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    * Return Value:
239    *       None.
240    */
241   void (*Doc_print)(struct _IPDF_JsPlatform* pThis,
242                     FPDF_BOOL bUI,
243                     int nStart,
244                     int nEnd,
245                     FPDF_BOOL bSilent,
246                     FPDF_BOOL bShrinkToFit,
247                     FPDF_BOOL bPrintAsImage,
248                     FPDF_BOOL bReverse,
249                     FPDF_BOOL bAnnotations);
250 
251   /*
252    * Method: Doc_submitForm
253    *       Send the form data to a specified URL.
254    * Interface Version:
255    *       1
256    * Implementation Required:
257    *       yes
258    * Parameters:
259    *       pThis       -   Pointer to the interface structure itself
260    *       formData    -   Pointer to the data buffer to be sent.
261    *       length      -   The size,in bytes, of the buffer pointed by
262    *                       formData parameter.
263    *       URL         -   The URL to send to.
264    * Return Value:
265    *       None.
266    */
267   void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis,
268                          void* formData,
269                          int length,
270                          FPDF_WIDESTRING URL);
271 
272   /*
273    * Method: Doc_gotoPage
274    *       Jump to a specified page.
275    * Interface Version:
276    *       1
277    * Implementation Required:
278    *       yes
279    * Parameters:
280    *       pThis       -   Pointer to the interface structure itself
281    *       nPageNum    -   The specified page number, zero for the first page.
282    * Return Value:
283    *       None.
284    *
285    */
286   void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum);
287 
288   /*
289    * Method: Field_browse
290    *       Show a file selection dialog, and return the selected file path.
291    * Interface Version:
292    *       1
293    * Implementation Required:
294    *       yes
295    * Parameters:
296    *       pThis       -   Pointer to the interface structure itself.
297    *       filePath    -   Pointer to the data buffer to receive the file
298    *                       path. Can be NULL.
299    *       length      -   The length of the buffer, in bytes. Can be 0.
300    * Return Value:
301    *       Number of bytes the filePath consumes, including trailing zeros.
302    * Comments:
303    *       The filePath shoule always be provided in local encoding.
304    */
305   int (*Field_browse)(struct _IPDF_JsPlatform* pThis,
306                       void* filePath,
307                       int length);
308 
309   /*
310    * Pointer to FPDF_FORMFILLINFO interface.
311    */
312   void* m_pFormfillinfo;
313 
314   /* Version 2. */
315 
316   void* m_isolate;               /* Unused in v3, retain for compatibility. */
317   unsigned int m_v8EmbedderSlot; /* Unused in v3, retain for compatibility. */
318 
319   /* Version 3. */
320   /* Version 3 moves m_Isolate and m_v8EmbedderSlot to FPDF_LIBRARY_CONFIG. */
321 } IPDF_JSPLATFORM;
322 
323 // Flags for Cursor type
324 #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
330 
331 /*
332  * Function signature for the callback function passed to the FFI_SetTimer
333  * method.
334  * Parameters:
335  *          idEvent     -   Identifier of the timer.
336  * Return value:
337  *          None.
338  */
339 typedef void (*TimerCallback)(int idEvent);
340 
341 /*
342  * Declares of a struct type to the local system time.
343  */
344 typedef 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;
354 
355 #ifdef PDF_ENABLE_XFA
356 
357 // Pageview event flags
358 #define FXFA_PAGEVIEWEVENT_POSTADDED 1    // After a new pageview is added.
359 #define FXFA_PAGEVIEWEVENT_POSTREMOVED 3  // After a pageview is removed.
360 
361 // Definitions for Right Context Menu Features Of XFA Fields
362 #define FXFA_MENU_COPY 1
363 #define FXFA_MENU_CUT 2
364 #define FXFA_MENU_SELECTALL 4
365 #define FXFA_MENU_UNDO 8
366 #define FXFA_MENU_REDO 16
367 #define FXFA_MENU_PASTE 32
368 
369 // Definitions for File Type.
370 #define FXFA_SAVEAS_XML 1
371 #define FXFA_SAVEAS_XDP 2
372 
373 #endif  // PDF_ENABLE_XFA
374 
375 typedef struct _FPDF_FORMFILLINFO {
376   /*
377    * Version number of the interface. Currently must be 1 (when PDFium is built
378    *  without the XFA module) or must be 2 (when built with the XFA module).
379    */
380   int version;
381 
382   /* Version 1. */
383   /*
384    * Method: Release
385    *       Give the implementation a chance to release any resources after the
386    *       interface is no longer used.
387    * Interface Version:
388    *       1
389    * Implementation Required:
390    *       No
391    * Comments:
392    *       Called by PDFium during the final cleanup process.
393    * Parameters:
394    *       pThis       -   Pointer to the interface structure itself
395    * Return Value:
396    *       None
397    */
398   void (*Release)(struct _FPDF_FORMFILLINFO* pThis);
399 
400   /*
401    * Method: FFI_Invalidate
402    *       Invalidate the client area within the specified rectangle.
403    * Interface Version:
404    *       1
405    * Implementation Required:
406    *       yes
407    * Parameters:
408    *       pThis       -   Pointer to the interface structure itself.
409    *       page        -   Handle to the page. Returned by FPDF_LoadPage().
410    *       left        -   Left position of the client area in PDF page
411    *                       coordinates.
412    *       top         -   Top position of the client area in PDF page
413    *                       coordinates.
414    *       right       -   Right position of the client area in PDF page
415    *                       coordinates.
416    *       bottom      -   Bottom position of the client area in PDF page
417    *                       coordinates.
418    * Return Value:
419    *       None.
420    * Comments:
421    *       All positions are measured in PDF "user space".
422    *       Implementation should call FPDF_RenderPageBitmap() for repainting
423    *       the specified page area.
424    */
425   void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis,
426                          FPDF_PAGE page,
427                          double left,
428                          double top,
429                          double right,
430                          double bottom);
431 
432   /*
433    * Method: FFI_OutputSelectedRect
434    *       When the user selects text in form fields with the mouse, this
435    *       callback function will be invoked with the selected areas.
436    * Interface Version:
437    *       1
438    * Implementation Required:
439    *       No
440    * Parameters:
441    *       pThis       -   Pointer to the interface structure itself.
442    *       page        -   Handle to the page. Returned by FPDF_LoadPage()/
443    *       left        -   Left position of the client area in PDF page
444    *                       coordinates.
445    *       top         -   Top position of the client area in PDF page
446    *                       coordinates.
447    *       right       -   Right position of the client area in PDF page
448    *                       coordinates.
449    *       bottom      -   Bottom position of the client area in PDF page
450    *                       coordinates.
451    * Return Value:
452    *       None.
453    * Comments:
454    *       This callback function is useful for implementing special text
455    *       selection effects. An implementation should first record the
456    *       returned rectangles, then draw them one by one during the next
457    *       painting period. Lastly, it should remove all the recorded
458    *       rectangles when finished painting.
459    */
460   void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis,
461                                  FPDF_PAGE page,
462                                  double left,
463                                  double top,
464                                  double right,
465                                  double bottom);
466 
467   /*
468    * Method: FFI_SetCursor
469    *       Set the Cursor shape.
470    * Interface Version:
471    *       1
472    * Implementation Required:
473    *       yes
474    * Parameters:
475    *       pThis       -   Pointer to the interface structure itself.
476    *       nCursorType -   Cursor type, see Flags for Cursor type for details.
477    * Return value:
478    *       None.
479    */
480   void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType);
481 
482   /*
483    * Method: FFI_SetTimer
484    *       This method installs a system timer. An interval value is specified,
485    *       and every time that interval elapses, the system must call into the
486    *       callback function with the timer ID as returned by this function.
487    * Interface Version:
488    *       1
489    * Implementation Required:
490    *       yes
491    * Parameters:
492    *       pThis       -   Pointer to the interface structure itself.
493    *       uElapse     -   Specifies the time-out value, in milliseconds.
494    *       lpTimerFunc -   A pointer to the callback function-TimerCallback.
495    * Return value:
496    *       The timer identifier of the new timer if the function is successful.
497    *       An application passes this value to the FFI_KillTimer method to kill
498    *       the timer. Nonzero if it is successful; otherwise, it is zero.
499    */
500   int (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis,
501                       int uElapse,
502                       TimerCallback lpTimerFunc);
503 
504   /*
505    * Method: FFI_KillTimer
506    *       This method uninstalls a system timer, as set by an earlier call to
507    *       FFI_SetTimer.
508    * Interface Version:
509    *       1
510    * Implementation Required:
511    *       yes
512    * Parameters:
513    *       pThis       -   Pointer to the interface structure itself.
514    *       nTimerID    -   The timer ID returned by FFI_SetTimer function.
515    * Return value:
516    *       None.
517    */
518   void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID);
519 
520   /*
521    * Method: FFI_GetLocalTime
522    *       This method receives the current local time on the system.
523    * Interface Version:
524    *       1
525    * Implementation Required:
526    *       yes
527    * Parameters:
528    *       pThis       -   Pointer to the interface structure itself.
529    * Return value:
530    *       The local time. See FPDF_SYSTEMTIME above for details.
531    * Note: Unused.
532    */
533   FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis);
534 
535   /*
536    * Method: FFI_OnChange
537    *       This method will be invoked to notify the implementation when the
538    *       value of any FormField on the document had been changed.
539    * Interface Version:
540    *       1
541    * Implementation Required:
542    *       no
543    * Parameters:
544    *       pThis       -   Pointer to the interface structure itself.
545    * Return value:
546    *       None.
547    */
548   void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis);
549 
550   /*
551    * Method: FFI_GetPage
552    *       This method receives the page handle associated with a specified
553    *       page index.
554    * Interface Version:
555    *       1
556    * Implementation Required:
557    *       yes
558    * Parameters:
559    *       pThis       -   Pointer to the interface structure itself.
560    *       document    -   Handle to document. Returned by FPDF_LoadDocument().
561    *       nPageIndex  -   Index number of the page. 0 for the first page.
562    * Return value:
563    *       Handle to the page, as previously returned to the implementation by
564    *       FPDF_LoadPage().
565    * Comments:
566    *       The implementation is expected to keep track of the page handles it
567    *       receives from PDFium, and their mappings to page numbers. In some
568    *       cases, the document-level JavaScript action may refer to a page
569    *       which hadn't been loaded yet. To successfully run the Javascript
570    *       action, the implementation needs to load the page.
571    */
572   FPDF_PAGE (*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis,
573                              FPDF_DOCUMENT document,
574                              int nPageIndex);
575 
576   /*
577    * Method: FFI_GetCurrentPage
578    *       This method receives the handle to the current page.
579    * Interface Version:
580    *       1
581    * Implementation Required:
582    *       yes
583    * Parameters:
584    *       pThis       -   Pointer to the interface structure itself.
585    *       document    -   Handle to document. Returned by FPDF_LoadDocument().
586    * Return value:
587    *       Handle to the page. Returned by FPDF_LoadPage().
588    * Comments:
589    *       The implementation is expected to keep track of the current page,
590    *       e.g. the current page can be the one that is most visible on screen.
591    */
592   FPDF_PAGE (*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis,
593                                     FPDF_DOCUMENT document);
594 
595   /*
596    * Method: FFI_GetRotation
597    *       This method receives currently rotation of the page view.
598    * Interface Version:
599    *       1
600    * Implementation Required:
601    *       yes
602    * Parameters:
603    *       pThis       -   Pointer to the interface structure itself.
604    *       page        -   Handle to page, as returned by FPDF_LoadPage().
605    * Return value:
606    *       A number to indicate the page rotation in 90 degree increments
607    *       in a clockwise direction:
608    *         0 - 0 degrees
609    *         1 - 90 degrees
610    *         2 - 180 degrees
611    *         3 - 270 degrees
612    * Note: Unused.
613    */
614   int (*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page);
615 
616   /*
617    * Method: FFI_ExecuteNamedAction
618    *       This method will execute a named action.
619    * Interface Version:
620    *       1
621    * Implementation Required:
622    *       yes
623    * Parameters:
624    *       pThis           -   Pointer to the interface structure itself.
625    *       namedAction     -   A byte string which indicates the named action,
626    *                           terminated by 0.
627    * Return value:
628    *       None.
629    * Comments:
630    *       See the named actions description of <<PDF Reference, version 1.7>>
631    *       for more details.
632    */
633   void (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis,
634                                  FPDF_BYTESTRING namedAction);
635   /*
636    * Method: FFI_SetTextFieldFocus
637    *       Called when a text field is getting or losing focus.
638    * Interface Version:
639    *       1
640    * Implementation Required:
641    *       no
642    * Parameters:
643    *       pThis           -   Pointer to the interface structure itself.
644    *       value           -   The string value of the form field, in UTF-16LE
645    *                           format.
646    *       valueLen        -   The length of the string value. This is the
647    *                           number of characters, not bytes.
648    *       is_focus        -   True if the form field is getting focus, false
649    *                           if the form field is losing focus.
650    * Return value:
651    *       None.
652    * Comments:
653    *       Only supports text fields and combobox fields.
654    */
655   void (*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis,
656                                 FPDF_WIDESTRING value,
657                                 FPDF_DWORD valueLen,
658                                 FPDF_BOOL is_focus);
659 
660   /*
661    * Method: FFI_DoURIAction
662    *       Ask the implementation to navigate to a uniform resource identifier.
663    * Interface Version:
664    *       1
665    * Implementation Required:
666    *       No
667    * Parameters:
668    *       pThis           -   Pointer to the interface structure itself.
669    *       bsURI           -   A byte string which indicates the uniform
670    *                           resource identifier, terminated by 0.
671    * Return value:
672    *       None.
673    * Comments:
674    *       See the URI actions description of <<PDF Reference, version 1.7>>
675    *       for more details.
676    */
677   void (*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis,
678                           FPDF_BYTESTRING bsURI);
679 
680   /*
681    * Method: FFI_DoGoToAction
682    *       This action changes the view to a specified destination.
683    * Interface Version:
684    *       1
685    * Implementation Required:
686    *       No
687    * Parameters:
688    *       pThis           -   Pointer to the interface structure itself.
689    *       nPageIndex      -   The index of the PDF page.
690    *       zoomMode        -   The zoom mode for viewing page. See below.
691    *       fPosArray       -   The float array which carries the position info.
692    *       sizeofArray     -   The size of float array.
693    * PDFZoom values:
694    *         - XYZ = 1
695    *         - FITPAGE = 2
696    *         - FITHORZ = 3
697    *         - FITVERT = 4
698    *         - FITRECT = 5
699    *         - FITBBOX = 6
700    *         - FITBHORZ = 7
701    *         - FITBVERT = 8
702    * Return value:
703    *       None.
704    * Comments:
705    *       See the Destinations description of <<PDF Reference, version 1.7>>
706    *       in 8.2.1 for more details.
707    */
708   void (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis,
709                            int nPageIndex,
710                            int zoomMode,
711                            float* fPosArray,
712                            int sizeofArray);
713 
714   /*
715    * Pointer to IPDF_JSPLATFORM interface.
716    * Unused if PDFium is built without V8 support. Otherwise, if NULL, then
717    * JavaScript will be prevented from executing while rendering the document.
718    */
719   IPDF_JSPLATFORM* m_pJsPlatform;
720 
721   /* Version 2 - Experimental. */
722   /*
723    * Whether the XFA module is disabled when built with the XFA module.
724    * Interface Version:
725    *       Ignored if |version| < 2.
726    */
727   FPDF_BOOL xfa_disabled;
728 
729   /*
730    * Method: FFI_DisplayCaret
731    *       This method will show the caret at specified position.
732    * Interface Version:
733    *       Ignored if |version| < 2.
734    * Implementation Required:
735    *       Required for XFA, otherwise set to NULL.
736    * Parameters:
737    *       pThis           -   Pointer to the interface structure itself.
738    *       page            -   Handle to page. Returned by FPDF_LoadPage().
739    *       left            -   Left position of the client area in PDF page
740    *                           coordinates.
741    *       top             -   Top position of the client area in PDF page
742    *                           coordinates.
743    *       right           -   Right position of the client area in PDF page
744    *                           coordinates.
745    *       bottom          -   Bottom position of the client area in PDF page
746    *                           coordinates.
747    * Return value:
748    *       None.
749    */
750   void (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis,
751                            FPDF_PAGE page,
752                            FPDF_BOOL bVisible,
753                            double left,
754                            double top,
755                            double right,
756                            double bottom);
757 
758   /*
759    * Method: FFI_GetCurrentPageIndex
760    *       This method will get the current page index.
761    * Interface Version:
762    *       Ignored if |version| < 2.
763    * Implementation Required:
764    *       Required for XFA, otherwise set to NULL.
765    * Parameters:
766    *       pThis           -   Pointer to the interface structure itself.
767    *       document        -   Handle to document from FPDF_LoadDocument().
768    * Return value:
769    *       The index of current page.
770    */
771   int (*FFI_GetCurrentPageIndex)(struct _FPDF_FORMFILLINFO* pThis,
772                                  FPDF_DOCUMENT document);
773 
774   /*
775    * Method: FFI_SetCurrentPage
776    *       This method will set the current page.
777    * Interface Version:
778    *       Ignored if |version| < 2.
779    * Implementation Required:
780    *       Required for XFA, otherwise set to NULL.
781    * Parameters:
782    *       pThis           -   Pointer to the interface structure itself.
783    *       document        -   Handle to document from FPDF_LoadDocument().
784    *       iCurPage        -   The index of the PDF page.
785    * Return value:
786    *       None.
787    */
788   void (*FFI_SetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis,
789                              FPDF_DOCUMENT document,
790                              int iCurPage);
791 
792   /*
793   * Method: FFI_GotoURL
794   *       This method will navigate to the specified URL.
795   * Interface Version:
796   *       Ignored if |version| < 2.
797   * Implementation Required:
798   *       Required for XFA, otherwise set to NULL.
799   * Parameters:
800   *       pThis            -   Pointer to the interface structure itself.
801   *       document         -   Handle to document from FPDF_LoadDocument().
802   *       wsURL            -   The string value of the URL, in UTF-16LE format.
803   * Return value:
804   *       None.
805   */
806   void (*FFI_GotoURL)(struct _FPDF_FORMFILLINFO* pThis,
807                       FPDF_DOCUMENT document,
808                       FPDF_WIDESTRING wsURL);
809 
810   /*
811    * Method: FFI_GetPageViewRect
812    *       This method will get the current page view rectangle.
813    * Interface Version:
814    *       Ignored if |version| < 2.
815    * Implementation Required:
816    *       Required for XFA, otherwise set to NULL.
817    * Parameters:
818    *       pThis           -   Pointer to the interface structure itself.
819    *       page            -   Handle to page. Returned by FPDF_LoadPage().
820    *       left            -   The pointer to receive left position of the page
821    *                           view area in PDF page coordinates.
822    *       top             -   The pointer to receive top position of the page
823    *                           view area in PDF page coordinates.
824    *       right           -   The pointer to receive right position of the
825    *                           page view area in PDF page coordinates.
826    *       bottom          -   The pointer to receive bottom position of the
827    *                           page view area in PDF page coordinates.
828    * Return value:
829    *     None.
830    */
831   void (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis,
832                               FPDF_PAGE page,
833                               double* left,
834                               double* top,
835                               double* right,
836                               double* bottom);
837 
838   /*
839    * Method: FFI_PageEvent
840    *       This method fires when pages have been added to or deleted from
841    *       the XFA document.
842    * Interface Version:
843    *       Ignored if |version| < 2.
844    * Implementation Required:
845    *       Required for XFA, otherwise set to NULL.
846    * Parameters:
847    *       pThis           -   Pointer to the interface structure itself.
848    *       page_count      -   The number of pages to be added or deleted.
849    *       event_type      -   See FXFA_PAGEVIEWEVENT_* above.
850    * Return value:
851    *       None.
852    * Comments:
853    *       The pages to be added or deleted always start from the last page
854    *       of document. This means that if parameter page_count is 2 and
855    *       event type is FXFA_PAGEVIEWEVENT_POSTADDED, 2 new pages have been
856    *       appended to the tail of document; If page_count is 2 and
857    *       event type is FXFA_PAGEVIEWEVENT_POSTREMOVED, the last 2 pages
858    *       have been deleted.
859    */
860   void (*FFI_PageEvent)(struct _FPDF_FORMFILLINFO* pThis,
861                         int page_count,
862                         FPDF_DWORD event_type);
863 
864   /*
865    * Method: FFI_PopupMenu
866    *       This method will track the right context menu for XFA fields.
867    * Interface Version:
868    *       Ignored if |version| < 2.
869    * Implementation Required:
870    *       Required for XFA, otherwise set to NULL.
871    * Parameters:
872    *       pThis           -   Pointer to the interface structure itself.
873    *       page            -   Handle to page. Returned by FPDF_LoadPage().
874    *       hWidget         -   Always null, exists for compatibility.
875    *       menuFlag        -   The menu flags. Please refer to macro definition
876    *                           of FXFA_MENU_XXX and this can be one or a
877    *                           combination of these macros.
878    *       x               -   X position of the client area in PDF page
879    *                           coordinates.
880    *       y               -   Y position of the client area in PDF page
881    *                           coordinates.
882    * Return value:
883    *       TRUE indicates success; otherwise false.
884    */
885   FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis,
886                              FPDF_PAGE page,
887                              FPDF_WIDGET hWidget,
888                              int menuFlag,
889                              float x,
890                              float y);
891 
892   /*
893    * Method: FFI_OpenFile
894    *       This method will open the specified file with the specified mode.
895    * Interface Version:
896    *       Ignored if |version| < 2.
897    * Implementation Required:
898    *       Required for XFA, otherwise set to NULL.
899    * Parameters:
900    *       pThis           -   Pointer to the interface structure itself.
901    *       fileFlag        -   The file flag. Please refer to macro definition
902    *                           of FXFA_SAVEAS_XXX and use one of these macros.
903    *       wsURL           -   The string value of the file URL, in UTF-16LE
904    *                           format.
905    *       mode            -   The mode for open file, e.g. "rb" or "wb".
906    * Return value:
907    *       The handle to FPDF_FILEHANDLER.
908    */
909   FPDF_FILEHANDLER* (*FFI_OpenFile)(struct _FPDF_FORMFILLINFO* pThis,
910                                     int fileFlag,
911                                     FPDF_WIDESTRING wsURL,
912                                     const char* mode);
913 
914   /*
915    * Method: FFI_EmailTo
916    *       This method will email the specified file stream to the specified
917    *       contact.
918    * Interface Version:
919    *       Ignored if |version| < 2.
920    * Implementation Required:
921    *       Required for XFA, otherwise set to NULL.
922    * Parameters:
923    *       pThis           -   Pointer to the interface structure itself.
924    *       pFileHandler    -   Handle to the FPDF_FILEHANDLER.
925    *       pTo             -   A semicolon-delimited list of recipients for the
926    *                           message,in UTF-16LE format.
927    *       pSubject        -   The subject of the message,in UTF-16LE format.
928    *       pCC             -   A semicolon-delimited list of CC recipients for
929    *                           the message,in UTF-16LE format.
930    *       pBcc            -   A semicolon-delimited list of BCC recipients for
931    *                           the message,in UTF-16LE format.
932    *       pMsg            -   Pointer to the data buffer to be sent.Can be
933    *                           NULL,in UTF-16LE format.
934    * Return value:
935    *       None.
936    */
937   void (*FFI_EmailTo)(struct _FPDF_FORMFILLINFO* pThis,
938                       FPDF_FILEHANDLER* fileHandler,
939                       FPDF_WIDESTRING pTo,
940                       FPDF_WIDESTRING pSubject,
941                       FPDF_WIDESTRING pCC,
942                       FPDF_WIDESTRING pBcc,
943                       FPDF_WIDESTRING pMsg);
944 
945   /*
946    * Method: FFI_UploadTo
947    *       This method will upload the specified file stream to the
948    *       specified URL.
949    * Interface Version:
950    *       Ignored if |version| < 2.
951    * Implementation Required:
952    *       Required for XFA, otherwise set to NULL.
953    * Parameters:
954    *       pThis           -   Pointer to the interface structure itself.
955    *       pFileHandler    -   Handle to the FPDF_FILEHANDLER.
956    *       fileFlag        -   The file flag. Please refer to macro definition
957    *                           of FXFA_SAVEAS_XXX and use one of these macros.
958    *       uploadTo        -   Pointer to the URL path, in UTF-16LE format.
959    * Return value:
960    *       None.
961    */
962   void (*FFI_UploadTo)(struct _FPDF_FORMFILLINFO* pThis,
963                        FPDF_FILEHANDLER* fileHandler,
964                        int fileFlag,
965                        FPDF_WIDESTRING uploadTo);
966 
967   /*
968    * Method: FFI_GetPlatform
969    *       This method will get the current platform.
970    * Interface Version:
971    *       Ignored if |version| < 2.
972    * Implementation Required:
973    *       Required for XFA, otherwise set to NULL.
974    * Parameters:
975    *       pThis           -   Pointer to the interface structure itself.
976    *       platform        -   Pointer to the data buffer to receive the
977    *                           platform,in UTF-16LE format. Can be NULL.
978    *       length          -   The length of the buffer in bytes. Can be
979    *                           0 to query the required size.
980    * Return value:
981    *       The length of the buffer, number of bytes.
982    */
983   int (*FFI_GetPlatform)(struct _FPDF_FORMFILLINFO* pThis,
984                          void* platform,
985                          int length);
986 
987   /*
988    * Method: FFI_GetLanguage
989    *       This method will get the current language.
990    * Interface Version:
991    *       Ignored if |version| < 2.
992    * Implementation Required:
993    *       Required for XFA, otherwise set to NULL.
994    * Parameters:
995    *       pThis           -   Pointer to the interface structure itself.
996    *       language        -   Pointer to the data buffer to receive the
997    *                           current language. Can be NULL.
998    *       length          -   The length of the buffer in bytes. Can be
999    *                           0 to query the required size.
1000    * Return value:
1001    *       The length of the buffer, number of bytes.
1002    */
1003   int (*FFI_GetLanguage)(struct _FPDF_FORMFILLINFO* pThis,
1004                          void* language,
1005                          int length);
1006 
1007   /*
1008   * Method: FFI_DownloadFromURL
1009   *       This method will download the specified file from the URL.
1010   * Interface Version:
1011   *       Ignored if |version| < 2.
1012   * Implementation Required:
1013   *       Required for XFA, otherwise set to NULL.
1014   * Parameters:
1015   *       pThis           -   Pointer to the interface structure itself.
1016   *       URL             -   The string value of the file URL, in UTF-16LE
1017   *                           format.
1018   * Return value:
1019   *       The handle to FPDF_FILEHANDLER.
1020   */
1021   FPDF_FILEHANDLER* (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis,
1022                                            FPDF_WIDESTRING URL);
1023   /*
1024    * Method: FFI_PostRequestURL
1025    *       This method will post the request to the server URL.
1026    * Interface Version:
1027    *       Ignored if |version| < 2.
1028    * Implementation Required:
1029    *       Required for XFA, otherwise set to NULL.
1030    * Parameters:
1031    *       pThis           -   Pointer to the interface structure itself.
1032    *       wsURL           -   The string value of the server URL, in UTF-16LE
1033    *                           format.
1034    *       wsData          -   The post data,in UTF-16LE format.
1035    *       wsContentType   -   The content type of the request data, in
1036    *                           UTF-16LE format.
1037    *       wsEncode        -   The encode type, in UTF-16LE format.
1038    *       wsHeader        -   The request header,in UTF-16LE format.
1039    *       response        -   Pointer to the FPDF_BSTR to receive the response
1040    *                           data from the server, in UTF-16LE format.
1041    * Return value:
1042    *       TRUE indicates success, otherwise FALSE.
1043    */
1044   FPDF_BOOL (*FFI_PostRequestURL)(struct _FPDF_FORMFILLINFO* pThis,
1045                                   FPDF_WIDESTRING wsURL,
1046                                   FPDF_WIDESTRING wsData,
1047                                   FPDF_WIDESTRING wsContentType,
1048                                   FPDF_WIDESTRING wsEncode,
1049                                   FPDF_WIDESTRING wsHeader,
1050                                   FPDF_BSTR* response);
1051 
1052   /*
1053    * Method: FFI_PutRequestURL
1054    *       This method will put the request to the server URL.
1055    * Interface Version:
1056    *       Ignored if |version| < 2.
1057    * Implementation Required:
1058    *       Required for XFA, otherwise set to NULL.
1059    * Parameters:
1060    *       pThis           -   Pointer to the interface structure itself.
1061    *       wsURL           -   The string value of the server URL, in UTF-16LE
1062    *                           format.
1063    *       wsData          -   The put data, in UTF-16LE format.
1064    *       wsEncode        -   The encode type, in UTR-16LE format.
1065    * Return value:
1066    *       TRUE indicates success, otherwise FALSE.
1067    */
1068   FPDF_BOOL (*FFI_PutRequestURL)(struct _FPDF_FORMFILLINFO* pThis,
1069                                    FPDF_WIDESTRING wsURL,
1070                                    FPDF_WIDESTRING wsData,
1071                                    FPDF_WIDESTRING wsEncode);
1072 } FPDF_FORMFILLINFO;
1073 
1074 /*
1075  * Function: FPDFDOC_InitFormFillEnvironment
1076  *       Initialize form fill environment.
1077  * Parameters:
1078  *       document        -   Handle to document from FPDF_LoadDocument().
1079  *       pFormFillInfo   -   Pointer to a FPDF_FORMFILLINFO structure.
1080  * Return Value:
1081  *       Handle to the form fill module, or NULL on failure.
1082  * Comments:
1083  *       This function should be called before any form fill operation.
1084  */
1085 FPDF_EXPORT FPDF_FORMHANDLE FPDF_CALLCONV
1086 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
1087                                 FPDF_FORMFILLINFO* formInfo);
1088 
1089 /*
1090  * Function: FPDFDOC_ExitFormFillEnvironment
1091  *       Take ownership of |hHandle| and exit form fill environment.
1092  * Parameters:
1093  *       hHandle     -   Handle to the form fill module, as returned by
1094  *                       FPDFDOC_InitFormFillEnvironment().
1095  * Return Value:
1096  *       None.
1097  * Comments:
1098  *       This function is a no-op when |hHandle| is null.
1099  */
1100 FPDF_EXPORT void FPDF_CALLCONV
1101 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle);
1102 
1103 /*
1104  * Function: FORM_OnAfterLoadPage
1105  *       This method is required for implementing all the form related
1106  *       functions. Should be invoked after user successfully loaded a
1107  *       PDF page, and FPDFDOC_InitFormFillEnvironment() has been invoked.
1108  * Parameters:
1109  *       hHandle     -   Handle to the form fill module, as eturned by
1110  *                       FPDFDOC_InitFormFillEnvironment().
1111  * Return Value:
1112  *       None.
1113  */
1114 FPDF_EXPORT void FPDF_CALLCONV FORM_OnAfterLoadPage(FPDF_PAGE page,
1115                                                     FPDF_FORMHANDLE hHandle);
1116 
1117 /*
1118  * Function: FORM_OnBeforeClosePage
1119  *       This method is required for implementing all the form related
1120  *       functions. Should be invoked before user closes the PDF page.
1121  * Parameters:
1122  *        page        -   Handle to the page, as returned by FPDF_LoadPage().
1123  *        hHandle     -   Handle to the form fill module, as returned by
1124  *                        FPDFDOC_InitFormFillEnvironment().
1125  * Return Value:
1126  *        None.
1127  */
1128 FPDF_EXPORT void FPDF_CALLCONV FORM_OnBeforeClosePage(FPDF_PAGE page,
1129                                                       FPDF_FORMHANDLE hHandle);
1130 
1131 /*
1132  * Function: FORM_DoDocumentJSAction
1133  *       This method is required for performing document-level JavaScript
1134  *       actions. It should be invoked after the PDF document has been loaded.
1135  * Parameters:
1136  *       hHandle     -   Handle to the form fill module, as returned by
1137  *                       FPDFDOC_InitFormFillEnvironment().
1138  * Return Value:
1139  *       None.
1140  * Comments:
1141  *       If there is document-level JavaScript action embedded in the
1142  *       document, this method will execute the JavaScript action. Otherwise,
1143  *       the method will do nothing.
1144  */
1145 FPDF_EXPORT void FPDF_CALLCONV
1146 FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle);
1147 
1148 /*
1149  * Function: FORM_DoDocumentOpenAction
1150  *       This method is required for performing open-action when the document
1151  *       is opened.
1152  * Parameters:
1153  *       hHandle     -   Handle to the form fill module, as returned by
1154  *                       FPDFDOC_InitFormFillEnvironment().
1155  * Return Value:
1156  *       None.
1157  * Comments:
1158  *       This method will do nothing if there are no open-actions embedded
1159  *       in the document.
1160  */
1161 FPDF_EXPORT void FPDF_CALLCONV
1162 FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle);
1163 
1164 // Additional actions type of document:
1165 //   WC, before closing document, JavaScript action.
1166 //   WS, before saving document, JavaScript action.
1167 //   DS, after saving document, JavaScript action.
1168 //   WP, before printing document, JavaScript action.
1169 //   DP, after printing document, JavaScript action.
1170 #define FPDFDOC_AACTION_WC 0x10
1171 #define FPDFDOC_AACTION_WS 0x11
1172 #define FPDFDOC_AACTION_DS 0x12
1173 #define FPDFDOC_AACTION_WP 0x13
1174 #define FPDFDOC_AACTION_DP 0x14
1175 
1176 /*
1177  * Function: FORM_DoDocumentAAction
1178  *       This method is required for performing the document's
1179  *       additional-action.
1180  * Parameters:
1181  *       hHandle     -   Handle to the form fill module. Returned by
1182  *                       FPDFDOC_InitFormFillEnvironment.
1183  *       aaType      -   The type of the additional-actions which defined
1184  *                       above.
1185  * Return Value:
1186  *       None.
1187  * Comments:
1188  *       This method will do nothing if there is no document
1189  *       additional-action corresponding to the specified |aaType|.
1190  */
1191 FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle,
1192                                                       int aaType);
1193 
1194 // Additional-action types of page object:
1195 //   OPEN (/O) -- An action to be performed when the page is opened
1196 //   CLOSE (/C) -- An action to be performed when the page is closed
1197 #define FPDFPAGE_AACTION_OPEN 0
1198 #define FPDFPAGE_AACTION_CLOSE 1
1199 
1200 /*
1201  * Function: FORM_DoPageAAction
1202  *       This method is required for performing the page object's
1203  *       additional-action when opened or closed.
1204  * Parameters:
1205  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1206  *       hHandle     -   Handle to the form fill module, as returned by
1207  *                       FPDFDOC_InitFormFillEnvironment().
1208  *       aaType      -   The type of the page object's additional-actions
1209  *                       which defined above.
1210  * Return Value:
1211  *       None.
1212  * Comments:
1213  *       This method will do nothing if no additional-action corresponding
1214  *       to the specified |aaType| exists.
1215  */
1216 FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page,
1217                                                   FPDF_FORMHANDLE hHandle,
1218                                                   int aaType);
1219 
1220 /*
1221  * Function: FORM_OnMouseMove
1222  *       Call this member function when the mouse cursor moves.
1223  * Parameters:
1224  *       hHandle     -   Handle to the form fill module, as returned by
1225  *                       FPDFDOC_InitFormFillEnvironment().
1226  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1227  *       modifier    -   Indicates whether various virtual keys are down.
1228  *       page_x      -   Specifies the x-coordinate of the cursor in PDF user
1229  *                       space.
1230  *       page_y      -   Specifies the y-coordinate of the cursor in PDF user
1231  *                       space.
1232  * Return Value:
1233  *       True indicates success; otherwise false.
1234  */
1235 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,
1236                                                      FPDF_PAGE page,
1237                                                      int modifier,
1238                                                      double page_x,
1239                                                      double page_y);
1240 
1241 /*
1242  * Function: FORM_OnFocus
1243  *       This function focuses the form annotation at a given point. If the
1244  *       annotation at the point already has focus, nothing happens. If there
1245  *       is no annotation at the point, removes form focus.
1246  * Parameters:
1247  *       hHandle     -   Handle to the form fill module, as returned by
1248  *                       FPDFDOC_InitFormFillEnvironment().
1249  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1250  *       modifier    -   Indicates whether various virtual keys are down.
1251  *       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.
1255  * Return Value:
1256  *       True if there is an annotation at the given point and it has focus.
1257  */
1258 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnFocus(FPDF_FORMHANDLE hHandle,
1259                                                  FPDF_PAGE page,
1260                                                  int modifier,
1261                                                  double page_x,
1262                                                  double page_y);
1263 
1264 /*
1265  * Function: FORM_OnLButtonDown
1266  *       Call this member function when the user presses the left
1267  *       mouse button.
1268  * Parameters:
1269  *       hHandle     -   Handle to the form fill module. as returned by
1270  *                       FPDFDOC_InitFormFillEnvironment().
1271  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1272  *       modifier    -   Indicates whether various virtual keys are down.
1273  *       page_x      -   Specifies the x-coordinate of the cursor in PDF user
1274  *                       space.
1275  *       page_y      -   Specifies the y-coordinate of the cursor in PDF user
1276  *                       space.
1277  * Return Value:
1278  *       True indicates success; otherwise false.
1279  */
1280 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,
1281                                                        FPDF_PAGE page,
1282                                                        int modifier,
1283                                                        double page_x,
1284                                                        double page_y);
1285 
1286 /*
1287  * Function: FORM_OnRButtonDown
1288  *       Same as above, execpt for the right mouse button.
1289  * Comments:
1290  *       At the present time, has no effect except in XFA builds, but is
1291  *       included for the sake of symmetry.
1292  */
1293 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle,
1294                                                        FPDF_PAGE page,
1295                                                        int modifier,
1296                                                        double page_x,
1297                                                        double page_y);
1298 /*
1299  * Function: FORM_OnLButtonUp
1300  *       Call this member function when the user releases the left
1301  *       mouse button.
1302  * Parameters:
1303  *       hHandle     -   Handle to the form fill module, as returned by
1304  *                       FPDFDOC_InitFormFillEnvironment().
1305  *       page        -   Handle to the page. as returned by FPDF_LoadPage().
1306  *       modifier    -   Indicates whether various virtual keys are down.
1307  *       page_x      -   Specifies the x-coordinate of the cursor in device.
1308  *       page_y      -   Specifies the y-coordinate of the cursor in device.
1309  * Return Value:
1310  *       True indicates success; otherwise false.
1311  */
1312 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,
1313                                                      FPDF_PAGE page,
1314                                                      int modifier,
1315                                                      double page_x,
1316                                                      double page_y);
1317 
1318 /*
1319  * Function: FORM_OnRButtonUp
1320  *       Same as above, execpt for the right mouse button.
1321  * Comments:
1322  *       At the present time, has no effect except in XFA builds, but is
1323  *       included for the sake of symmetry.
1324  */
1325 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle,
1326                                                      FPDF_PAGE page,
1327                                                      int modifier,
1328                                                      double page_x,
1329                                                      double page_y);
1330 
1331 /*
1332  * Function: FORM_OnLButtonDoubleClick
1333  *       Call this member function when the user double clicks the
1334  *       left mouse button.
1335  * Parameters:
1336  *       hHandle     -   Handle to the form fill module, as returned by
1337  *                       FPDFDOC_InitFormFillEnvironment().
1338  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1339  *       modifier    -   Indicates whether various virtual keys are down.
1340  *       page_x      -   Specifies the x-coordinate of the cursor in PDF user
1341  *                       space.
1342  *       page_y      -   Specifies the y-coordinate of the cursor in PDF user
1343  *                       space.
1344  * Return Value:
1345  *       True indicates success; otherwise false.
1346  */
1347 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1348 FORM_OnLButtonDoubleClick(FPDF_FORMHANDLE hHandle,
1349                           FPDF_PAGE page,
1350                           int modifier,
1351                           double page_x,
1352                           double page_y);
1353 
1354 /*
1355  * Function: FORM_OnKeyDown
1356  *       Call this member function when a nonsystem key is pressed.
1357  * Parameters:
1358  *       hHandle     -   Handle to the form fill module, aseturned by
1359  *                       FPDFDOC_InitFormFillEnvironment().
1360  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1361  *       nKeyCode    -   Indicates whether various virtual keys are down.
1362  *       modifier    -   Contains the scan code, key-transition code,
1363  *                       previous key state, and context code.
1364  * Return Value:
1365  *       True indicates success; otherwise false.
1366  */
1367 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,
1368                                                    FPDF_PAGE page,
1369                                                    int nKeyCode,
1370                                                    int modifier);
1371 
1372 /*
1373  * Function: FORM_OnKeyUp
1374  *       Call this member function when a nonsystem key is released.
1375  * Parameters:
1376  *       hHandle     -   Handle to the form fill module, as returned by
1377  *                       FPDFDOC_InitFormFillEnvironment().
1378  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1379  *       nKeyCode    -   The virtual-key code of the given key.
1380  *       modifier    -   Contains the scan code, key-transition code,
1381  *                       previous key state, and context code.
1382  * Return Value:
1383  *       True indicates success; otherwise false.
1384  */
1385 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,
1386                                                  FPDF_PAGE page,
1387                                                  int nKeyCode,
1388                                                  int modifier);
1389 
1390 /*
1391  * Function: FORM_OnChar
1392  *       Call this member function when a keystroke translates to a
1393  *       nonsystem character.
1394  * Parameters:
1395  *        hHandle    -   Handle to the form fill module, as returned by
1396  *                       FPDFDOC_InitFormFillEnvironment().
1397  *        page       -   Handle to the page, as returned by FPDF_LoadPage().
1398  *        nChar      -   The character code value of the key.
1399  *        modifier   -   Contains the scan code, key-transition code,
1400  *                       previous key state, and context code.
1401  * Return Value:
1402  *       True indicates success; otherwise false.
1403  */
1404 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle,
1405                                                 FPDF_PAGE page,
1406                                                 int nChar,
1407                                                 int modifier);
1408 
1409 /*
1410  * Experimental API
1411  * Function: FORM_GetFocusedText
1412  *       Call this function to obtain the text within the current focused
1413  *       field, if any.
1414  * Parameters:
1415  *       hHandle     -   Handle to the form fill module, as returned by
1416  *                       FPDFDOC_InitFormFillEnvironment().
1417  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1418  *       buffer      -   Buffer for holding the form text, encoded in
1419  *                       UTF-16LE. If NULL, |buffer| is not modified.
1420  *       buflen      -   Length of |buffer| in bytes. If |buflen| is less
1421  *                       than the length of the form text string, |buffer| is
1422  *                       not modified.
1423  * Return Value:
1424  *       Length in bytes for the text in the focused field.
1425  */
1426 FPDF_EXPORT unsigned long FPDF_CALLCONV
1427 FORM_GetFocusedText(FPDF_FORMHANDLE hHandle,
1428                     FPDF_PAGE page,
1429                     void* buffer,
1430                     unsigned long buflen);
1431 
1432 /*
1433  * Function: FORM_GetSelectedText
1434  *       Call this function to obtain selected text within a form text
1435  *       field or form combobox text field.
1436  * Parameters:
1437  *       hHandle     -   Handle to the form fill module, asr eturned by
1438  *                       FPDFDOC_InitFormFillEnvironment().
1439  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1440  *       buffer      -   Buffer for holding the selected text, encoded in
1441  *                       UTF-16LE. If NULL, |buffer| is not modified.
1442  *       buflen      -   Length of |buffer| in bytes. If |buflen| is less
1443  *                       than the length of the selected text string,
1444  *                       |buffer| is not modified.
1445  * Return Value:
1446  *       Length in bytes of selected text in form text field or form combobox
1447  *       text field.
1448  */
1449 FPDF_EXPORT unsigned long FPDF_CALLCONV
1450 FORM_GetSelectedText(FPDF_FORMHANDLE hHandle,
1451                      FPDF_PAGE page,
1452                      void* buffer,
1453                      unsigned long buflen);
1454 
1455 /*
1456  * Function: FORM_ReplaceSelection
1457  *       Call this function to replace the selected text in a form
1458  *       text field or user-editable form combobox text field with another
1459  *       text string (which can be empty or non-empty). If there is no
1460  *       selected text, this function will append the replacement text after
1461  *       the current caret position.
1462  * Parameters:
1463  *       hHandle     -   Handle to the form fill module, as returned by
1464  *                       FPDFDOC_InitFormFillEnvironment().
1465  *       page        -   Handle to the page, as Returned by FPDF_LoadPage().
1466  *       wsText      -   The text to be inserted, in UTF-16LE format.
1467  * Return Value:
1468  *       None.
1469  */
1470 FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceSelection(FPDF_FORMHANDLE hHandle,
1471                                                      FPDF_PAGE page,
1472                                                      FPDF_WIDESTRING wsText);
1473 
1474 /*
1475  * Function: FORM_CanUndo
1476  *       Find out if it is possible for the current focused widget in a given
1477  *       form to perform an undo operation.
1478  * Parameters:
1479  *       hHandle     -   Handle to the form fill module, as returned by
1480  *                       FPDFDOC_InitFormFillEnvironment().
1481  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1482  * Return Value:
1483  *       True if it is possible to undo.
1484  */
1485 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanUndo(FPDF_FORMHANDLE hHandle,
1486                                                  FPDF_PAGE page);
1487 
1488 /*
1489  * Function: FORM_CanRedo
1490  *       Find out if it is possible for the current focused widget in a given
1491  *       form to perform a redo operation.
1492  * Parameters:
1493  *       hHandle     -   Handle to the form fill module, as returned by
1494  *                       FPDFDOC_InitFormFillEnvironment().
1495  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1496  * Return Value:
1497  *       True if it is possible to redo.
1498  */
1499 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanRedo(FPDF_FORMHANDLE hHandle,
1500                                                  FPDF_PAGE page);
1501 
1502 /*
1503  * Function: FORM_Undo
1504  *       Make the current focussed widget perform an undo operation.
1505  * Parameters:
1506  *       hHandle     -   Handle to the form fill module. as returned by
1507  *                       FPDFDOC_InitFormFillEnvironment().
1508  *       page        -   Handle to the page, as returned by FPDF_LoadPage().
1509  * Return Value:
1510  *       True if the undo operation succeeded.
1511  */
1512 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Undo(FPDF_FORMHANDLE hHandle,
1513                                               FPDF_PAGE page);
1514 
1515 /*
1516  * Function: FORM_Redo
1517  *       Make the current focussed widget perform a redo operation.
1518  * Parameters:
1519  *       hHandle     -   Handle to the form fill module, as returned by
1520  *                       FPDFDOC_InitFormFillEnvironment().
1521  *       page        -   Handle to the page, as eturned by FPDF_LoadPage().
1522  * Return Value:
1523  *       True if the redo operation succeeded.
1524  */
1525 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Redo(FPDF_FORMHANDLE hHandle,
1526                                               FPDF_PAGE page);
1527 
1528 /*
1529  * Function: FORM_ForceToKillFocus.
1530  *       Call this member function to force to kill the focus of the form
1531  *       field which has focus. If it would kill the focus of a form field,
1532  *       save the value of form field if was changed by theuser.
1533  * Parameters:
1534  *       hHandle     -   Handle to the form fill module, as returned by
1535  *                       FPDFDOC_InitFormFillEnvironment().
1536  * Return Value:
1537  *       True indicates success; otherwise false.
1538  */
1539 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1540 FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle);
1541 
1542 // Form Field Types
1543 // The names of the defines are stable, but the specific values associated with
1544 // them are not, so do not hardcode their values.
1545 #define FPDF_FORMFIELD_UNKNOWN 0      // Unknown.
1546 #define FPDF_FORMFIELD_PUSHBUTTON 1   // push button type.
1547 #define FPDF_FORMFIELD_CHECKBOX 2     // check box type.
1548 #define FPDF_FORMFIELD_RADIOBUTTON 3  // radio button type.
1549 #define FPDF_FORMFIELD_COMBOBOX 4     // combo box type.
1550 #define FPDF_FORMFIELD_LISTBOX 5      // list box type.
1551 #define FPDF_FORMFIELD_TEXTFIELD 6    // text field type.
1552 #define FPDF_FORMFIELD_SIGNATURE 7    // text field type.
1553 #ifdef PDF_ENABLE_XFA
1554 #define FPDF_FORMFIELD_XFA 8              // Generic XFA type.
1555 #define FPDF_FORMFIELD_XFA_CHECKBOX 9     // XFA check box type.
1556 #define FPDF_FORMFIELD_XFA_COMBOBOX 10    // XFA combo box type.
1557 #define FPDF_FORMFIELD_XFA_IMAGEFIELD 11  // XFA image field type.
1558 #define FPDF_FORMFIELD_XFA_LISTBOX 12     // XFA list box type.
1559 #define FPDF_FORMFIELD_XFA_PUSHBUTTON 13  // XFA push button type.
1560 #define FPDF_FORMFIELD_XFA_SIGNATURE 14   // XFA signture field type.
1561 #define FPDF_FORMFIELD_XFA_TEXTFIELD 15   // XFA text field type.
1562 #endif                                    // PDF_ENABLE_XFA
1563 
1564 #ifdef PDF_ENABLE_XFA
1565 #define FPDF_FORMFIELD_COUNT 16
1566 #else  // PDF_ENABLE_XFA
1567 #define FPDF_FORMFIELD_COUNT 8
1568 #endif  // PDF_ENABLE_XFA
1569 
1570 #ifdef PDF_ENABLE_XFA
1571 #define IS_XFA_FORMFIELD(type)                  \
1572   (((type) == FPDF_FORMFIELD_XFA) ||            \
1573    ((type) == FPDF_FORMFIELD_XFA_CHECKBOX) ||   \
1574    ((type) == FPDF_FORMFIELD_XFA_COMBOBOX) ||   \
1575    ((type) == FPDF_FORMFIELD_XFA_IMAGEFIELD) || \
1576    ((type) == FPDF_FORMFIELD_XFA_LISTBOX) ||    \
1577    ((type) == FPDF_FORMFIELD_XFA_PUSHBUTTON) || \
1578    ((type) == FPDF_FORMFIELD_XFA_SIGNATURE) ||  \
1579    ((type) == FPDF_FORMFIELD_XFA_TEXTFIELD))
1580 #endif  // PDF_ENABLE_XFA
1581 
1582 /*
1583  * Function: FPDFPage_HasFormFieldAtPoint
1584  *     Get the form field type by point.
1585  * Parameters:
1586  *     hHandle     -   Handle to the form fill module. Returned by
1587  *                     FPDFDOC_InitFormFillEnvironment().
1588  *     page        -   Handle to the page. Returned by FPDF_LoadPage().
1589  *     page_x      -   X position in PDF "user space".
1590  *     page_y      -   Y position in PDF "user space".
1591  * Return Value:
1592  *     Return the type of the form field; -1 indicates no field.
1593  *     See field types above.
1594  */
1595 FPDF_EXPORT int FPDF_CALLCONV
1596 FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
1597                              FPDF_PAGE page,
1598                              double page_x,
1599                              double page_y);
1600 
1601 /*
1602  * Function: FPDFPage_FormFieldZOrderAtPoint
1603  *     Get the form field z-order by point.
1604  * Parameters:
1605  *     hHandle     -   Handle to the form fill module. Returned by
1606  *                     FPDFDOC_InitFormFillEnvironment().
1607  *     page        -   Handle to the page. Returned by FPDF_LoadPage().
1608  *     page_x      -   X position in PDF "user space".
1609  *     page_y      -   Y position in PDF "user space".
1610  * Return Value:
1611  *     Return the z-order of the form field; -1 indicates no field.
1612  *     Higher numbers are closer to the front.
1613  */
1614 FPDF_EXPORT int FPDF_CALLCONV
1615 FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle,
1616                                 FPDF_PAGE page,
1617                                 double page_x,
1618                                 double page_y);
1619 
1620 /*
1621  * Function: FPDF_SetFormFieldHighlightColor
1622  *       Set the highlight color of the specified (or all) form fields
1623  *       in the document.
1624  * Parameters:
1625  *       hHandle     -   Handle to the form fill module, as returned by
1626  *                       FPDFDOC_InitFormFillEnvironment().
1627  *       doc         -   Handle to the document, as returned by
1628  *                       FPDF_LoadDocument().
1629  *       fieldType   -   A 32-bit integer indicating the type of a form
1630  *                       field (defined above).
1631  *       color       -   The highlight color of the form field. Constructed by
1632  *                       0xxxrrggbb.
1633  * Return Value:
1634  *       None.
1635  * Comments:
1636  *       When the parameter fieldType is set to FPDF_FORMFIELD_UNKNOWN, the
1637  *       highlight color will be applied to all the form fields in the
1638  *       document.
1639  *       Please refresh the client window to show the highlight immediately
1640  *       if necessary.
1641  */
1642 FPDF_EXPORT void FPDF_CALLCONV
1643 FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle,
1644                                 int fieldType,
1645                                 unsigned long color);
1646 
1647 /*
1648  * Function: FPDF_SetFormFieldHighlightAlpha
1649  *       Set the transparency of the form field highlight color in the
1650  *       document.
1651  * Parameters:
1652  *       hHandle     -   Handle to the form fill module, as returned by
1653  *                       FPDFDOC_InitFormFillEnvironment().
1654  *       doc         -   Handle to the document, as returaned by
1655  *                       FPDF_LoadDocument().
1656  *       alpha       -   The transparency of the form field highlight color,
1657  *                       between 0-255.
1658  * Return Value:
1659  *       None.
1660  */
1661 FPDF_EXPORT void FPDF_CALLCONV
1662 FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha);
1663 
1664 /*
1665  * Function: FPDF_RemoveFormFieldHighlight
1666  *       Remove the form field highlight color in the document.
1667  * Parameters:
1668  *       hHandle     -   Handle to the form fill module, as returned by
1669  *                       FPDFDOC_InitFormFillEnvironment().
1670  * Return Value:
1671  *       None.
1672  * Comments:
1673  *       Please refresh the client window to remove the highlight immediately
1674  *       if necessary.
1675  */
1676 FPDF_EXPORT void FPDF_CALLCONV
1677 FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
1678 
1679 /*
1680 * Function: FPDF_FFLDraw
1681 *       Render FormFields and popup window on a page to a device independent
1682 *       bitmap.
1683 * Parameters:
1684 *       hHandle      -   Handle to the form fill module, as returned by
1685 *                        FPDFDOC_InitFormFillEnvironment().
1686 *       bitmap       -   Handle to the device independent bitmap (as the
1687 *                        output buffer). Bitmap handles can be created by
1688 *                        FPDFBitmap_Create().
1689 *       page         -   Handle to the page, as returned by FPDF_LoadPage().
1690 *       start_x      -   Left pixel position of the display area in the
1691 *                        device coordinates.
1692 *       start_y      -   Top pixel position of the display area in the device
1693 *                        coordinates.
1694 *       size_x       -   Horizontal size (in pixels) for displaying the page.
1695 *       size_y       -   Vertical size (in pixels) for displaying the page.
1696 *       rotate       -   Page orientation: 0 (normal), 1 (rotated 90 degrees
1697 *                        clockwise), 2 (rotated 180 degrees), 3 (rotated 90
1698 *                        degrees counter-clockwise).
1699 *       flags        -   0 for normal display, or combination of flags
1700 *                        defined above.
1701 * Return Value:
1702 *       None.
1703 * Comments:
1704 *       This function is designed to render annotations that are
1705 *       user-interactive, which are widget annotations (for FormFields) and
1706 *       popup annotations.
1707 *       With the FPDF_ANNOT flag, this function will render a popup annotation
1708 *       when users mouse-hover on a non-widget annotation. Regardless of
1709 *       FPDF_ANNOT flag, this function will always render widget annotations
1710 *       for FormFields.
1711 *       In order to implement the FormFill functions, implementation should
1712 *       call this function after rendering functions, such as
1713 *       FPDF_RenderPageBitmap() or FPDF_RenderPageBitmap_Start(), have
1714 *       finished rendering the page contents.
1715 */
1716 FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
1717                                             FPDF_BITMAP bitmap,
1718                                             FPDF_PAGE page,
1719                                             int start_x,
1720                                             int start_y,
1721                                             int size_x,
1722                                             int size_y,
1723                                             int rotate,
1724                                             int flags);
1725 
1726 #ifdef _SKIA_SUPPORT_
1727 FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLRecord(FPDF_FORMHANDLE hHandle,
1728                                               FPDF_RECORDER recorder,
1729                                               FPDF_PAGE page,
1730                                               int start_x,
1731                                               int start_y,
1732                                               int size_x,
1733                                               int size_y,
1734                                               int rotate,
1735                                               int flags);
1736 #endif
1737 
1738 /*
1739  * Experimental API
1740  * Function: FPDF_GetFormType
1741  *           Returns the type of form contained in the PDF document.
1742  * Parameters:
1743  *           document - Handle to document.
1744  * Return Value:
1745  *           Integer value representing one of the FORMTYPE_ values.
1746  * Comments:
1747  *           If |document| is NULL, then the return value is FORMTYPE_NONE.
1748  */
1749 FPDF_EXPORT int FPDF_CALLCONV FPDF_GetFormType(FPDF_DOCUMENT document);
1750 
1751 /*
1752  * Experimental API
1753  * Function: FORM_SetIndexSelected
1754  *           Selects/deselects the value at the given |index| of the focused
1755  *           annotation.
1756  * Parameters:
1757  *           hHandle     -   Handle to the form fill module. Returned by
1758  *                           FPDFDOC_InitFormFillEnvironment.
1759  *           page        -   Handle to the page. Returned by FPDF_LoadPage
1760  *           index       -   0-based index of value to be set as
1761  *                           selected/unselected
1762  *           selected    -   true to select, false to deselect
1763  * Return Value:
1764  *           TRUE if the operation succeeded.
1765  *           FALSE if the operation failed or widget is not a supported type.
1766  * Comments:
1767  *           Intended for use with listbox/combobox widget types. Comboboxes
1768  *           have at most a single value selected at a time which cannot be
1769  *           deselected. Deselect on a combobox is a no-op that returns false.
1770  *           Default implementation is a no-op that will return false for
1771  *           other types.
1772  *           Not currently supported for XFA forms - will return false.
1773  */
1774 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1775 FORM_SetIndexSelected(FPDF_FORMHANDLE hHandle,
1776                       FPDF_PAGE page,
1777                       int index,
1778                       FPDF_BOOL selected);
1779 
1780 /*
1781  * Experimental API
1782  * Function: FORM_IsIndexSelected
1783  *           Returns whether or not the value at |index| of the focused
1784  *           annotation is currently selected.
1785  * Parameters:
1786  *           hHandle     -   Handle to the form fill module. Returned by
1787  *                           FPDFDOC_InitFormFillEnvironment.
1788  *           page        -   Handle to the page. Returned by FPDF_LoadPage
1789  *           index       -   0-based Index of value to check
1790  * Return Value:
1791  *           TRUE if value at |index| is currently selected.
1792  *           FALSE if value at |index| is not selected or widget is not a
1793  *           supported type.
1794  * Comments:
1795  *           Intended for use with listbox/combobox widget types. Default
1796  *           implementation is a no-op that will return false for other types.
1797  *           Not currently supported for XFA forms - will return false.
1798  */
1799 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1800 FORM_IsIndexSelected(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int index);
1801 
1802 /*
1803  * Function: FPDF_LoadXFA
1804  *          If the document consists of XFA fields, call this method to
1805  *          attempt to load XFA fields.
1806  * Parameters:
1807  *          document     -   Handle to document from FPDF_LoadDocument().
1808  * Return Value:
1809  *          TRUE upon success, otherwise FALSE. If XFA support is not built
1810  *          into PDFium, performs no action and always returns FALSE.
1811  */
1812 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_LoadXFA(FPDF_DOCUMENT document);
1813 
1814 #ifdef __cplusplus
1815 }
1816 #endif
1817 
1818 #endif  // PUBLIC_FPDF_FORMFILL_H_
1819