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