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