Change version of FPDF_FORMFILLINFO to 2; Add #define PDF_USE_XFA
[pdfium.git] / fpdfsdk / include / fpdfformfill.h
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
8 #ifndef _FPDFORMFILL_H
9 #define _FPDFORMFILL_H
10 #include "fpdfview.h"
11
12 typedef void* FPDF_FORMHANDLE;
13
14 // Exported Functions
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 typedef struct _IPDF_JsPlatform
20 {
21 /**
22 * Version number of the interface. Currently must be 1.
23         **/
24         int version;
25         
26         /** 
27         * Method: app_alert
28         *                       pop up a dialog to show warning or hint.
29         * Interface Version:
30         *                       1
31         * Implementation Required:
32         *                       yes
33         * Parameters:
34         *                       pThis           -       Pointer to the interface structure itself
35         *                       Msg                     -       A string containing the message to be displayed.
36         *                       Title           -   The title of the dialog.
37         *                       Type            -       The stype of button group. 
38         *                                                       0-OK(default);
39         *                                                       1-OK,Cancel;
40         *                                                       2-Yes,NO; 
41         *                                                       3-Yes, NO, Cancel.
42         *           nIcon               -   The Icon type. 
43         *                                                       0-Error(default);
44         *                                                       1-Warning;
45         *                                                       2-Question;
46         *                                                       3-Status.
47         *                                                       4-Asterisk
48
49         * Return Value:
50         *                       The return value could be the folowing type:
51         *                                                       1-OK;
52         *                                                       2-Cancel; 
53         *                                                       3-NO;
54         *                                                       4-Yes;
55         */
56         int (*app_alert)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon);
57         
58         /** 
59         * Method: app_beep
60         *                       Causes the system to play a sound. 
61         * Interface Version:
62         *                       1
63         * Implementation Required:
64         *                       yes
65         * Parameters:
66         *                       pThis           -       Pointer to the interface structure itself
67         *                       nType           -       The sound type.
68         *                                                       0 - Error
69         *                                                       1 - Warning
70         *                                                       2 - Question
71         *                                                       3 - Status
72         *                                                       4 - Default (default value)
73         * Return Value:
74         *                       None
75         */
76         void (*app_beep)(struct _IPDF_JsPlatform* pThis,  int nType);
77
78         /** 
79         * Method: app_response
80         *                       Displays a dialog box containing a question and an entry field for the user to reply to the question.
81         * Interface Version:
82         *                       1
83         * Implementation Required:
84         *                       yes
85         * Parameters:
86         *                       pThis           -       Pointer to the interface structure itself
87         *                       Question        -       The question to be posed to the user.
88         *                       Title           -       The title of the dialog box.
89         *                       Default         -       A default value for the answer to the question. If not specified, no default value is presented.
90         *                       cLabel          -       A short string to appear in front of and on the same line as the edit text field.
91         *                       bPassword       -       If true, indicates that the user's response should show as asterisks (*) or bullets (?) to mask the response, which might be sensitive information. The default is false.
92         *                       response        -       A string buffer allocated by SDK, to receive the user's response.
93         *                       length          -   The length of the buffer, number of bytes. Currently, It's always be 2048.
94         * Return Value:
95         *               Number of bytes the complete user input would actually require, not including trailing zeros, regardless of the value of the length
96         *               parameter or the presence of the response buffer.
97         * Comments:
98         *               No matter on what platform, the response buffer should be always written using UTF-16LE encoding. If a response buffer is
99         *               present and the size of the user input exceeds the capacity of the buffer as specified by the length parameter, only the
100         *               first "length" bytes of the user input are to be written to the buffer.
101         */
102         int (*app_response)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Question, FPDF_WIDESTRING Title, FPDF_WIDESTRING Default, FPDF_WIDESTRING cLabel, FPDF_BOOL bPassword, void* response, int length);
103
104         /*
105         * Method: Doc_getFilePath
106         *                       Get the file path of the current document. 
107         * Interface Version:
108         *                       1
109         * Implementation Required:
110         *                       yes
111         * Parameters:
112         *                       pThis           -       Pointer to the interface structure itself
113         *                       filePath        -       The string buffer to receive the file path. Can be NULL.
114         *                       length          -   The length of the buffer, number of bytes. Can be 0.
115         * Return Value:
116         *               Number of bytes the filePath consumes, including trailing zeros.
117         * Comments:
118         *               The filePath should be always input in local encoding.
119         *
120         *               The return value always indicated number of bytes required for the buffer, even when there is
121         *               no buffer specified, or the buffer size is less then required. In this case, the buffer will not
122         *               be modified.
123         */
124         int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis, void* filePath, int length);
125         
126         
127         /*
128         * Method: Doc_mail
129         *                       Mails the data buffer as an attachment to all recipients, with or without user interaction. 
130         * Interface Version:
131         *                       1
132         * Implementation Required:
133         *                       yes
134         * Parameters:
135         *                       pThis           -       Pointer to the interface structure itself
136         *                       mailData        -       Pointer to the data buffer to be sent.Can be NULL.
137         *                       length          -       The size,in bytes, of the buffer pointed by mailData parameter.Can be 0.
138         *                       bUI                     -   If true, the rest of the parameters are used in a compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional.
139         *                       To                      -       A semicolon-delimited list of recipients for the message.
140         *                       Subject         -   The subject of the message. The length limit is 64 KB.
141         *                       CC                      -       A semicolon-delimited list of CC recipients for the message. 
142         *                       BCC                     -   A semicolon-delimited list of BCC recipients for the message. 
143         *                       Msg                     -   The content of the message. The length limit is 64 KB.
144         * Return Value:
145         *                       None.
146         * Comments:
147         *                       If the parameter mailData is NULL or length is 0, the current document will be mailed as an attachment to all recipients.
148         */
149         void (*Doc_mail)(struct _IPDF_JsPlatform* pThis,void* mailData, int length,FPDF_BOOL bUI, FPDF_WIDESTRING To, FPDF_WIDESTRING Subject, FPDF_WIDESTRING CC, FPDF_WIDESTRING BCC, FPDF_WIDESTRING Msg); 
150         
151
152         /*
153         * Method: Doc_print
154         *                       Prints all or a specific number of pages of the document.
155         * Interface Version:
156         *                       1
157         * Implementation Required:
158         *                       yes
159         * Parameters:
160         *                       pThis           -       Pointer to the interface structure itself.
161         *                       bUI                     -       If true, will cause a UI to be presented to the user to obtain printing information and confirm the action.
162         *                       nStart          -       A 0-based index that defines the start of an inclusive range of pages.
163         *                       nEnd            -   A 0-based index that defines the end of an inclusive page range.
164         *                       bSilent         -   If true, suppresses the cancel dialog box while the document is printing. The default is false.
165         *                       bShrinkToFit    -       If true, the page is shrunk (if necessary) to fit within the imageable area of the printed page.
166         *                       bPrintAsImage   -       If true, print pages as an image.
167         *                       bReverse        -       If true, print from nEnd to nStart.
168         *                       bAnnotations    -       If true (the default), annotations are printed.
169         */
170         void (*Doc_print)(struct _IPDF_JsPlatform* pThis, FPDF_BOOL bUI, int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations);
171
172         /*
173         * Method: Doc_submitForm
174         *                       Send the form data to a specified URL.
175         * Interface Version:
176         *                       1
177         * Implementation Required:
178         *                       yes
179         * Parameters:
180         *                       pThis           -       Pointer to the interface structure itself
181         *                       formData        -       Pointer to the data buffer to be sent.
182         *                       length          -       The size,in bytes, of the buffer pointed by formData parameter.
183         *                       URL                     -       The URL to send to.
184         * Return Value:
185         *                       None.
186         *
187         */
188         void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis,void* formData, int length, FPDF_WIDESTRING URL);
189         
190         /*
191         * Method: Doc_gotoPage
192         *                       Jump to a specified page.
193         * Interface Version:
194         *                       1
195         * Implementation Required:
196         *                       yes
197         * Parameters:
198         *                       pThis           -       Pointer to the interface structure itself
199         *                       nPageNum        -       The specified page number, zero for the first page.
200         * Return Value:
201         *                       None.
202         *
203         */
204         void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum);
205         /*
206         * Method: Field_browse
207         *                       Show a file selection dialog, and return the selected file path.
208         * Interface Version:
209         *                       1
210         * Implementation Required:
211         *                       yes
212         * Parameters:
213         *                       pThis           -       Pointer to the interface structure itself.
214         *                       filePath        -       Pointer to the data buffer to receive the file path.Can be NULL.
215         *                       length          -   The length of the buffer, number of bytes. Can be 0.
216         * Return Value:
217         *               Number of bytes the filePath consumes, including trailing zeros.
218         * Comments:
219         *               The filePath shoule be always input in local encoding.
220         */
221         int  (*Field_browse)(struct _IPDF_JsPlatform* pThis, void* filePath, int length);
222
223         /**
224         *       pointer to FPDF_FORMFILLINFO interface.
225         **/
226         void*   m_pFormfillinfo;
227 } IPDF_JSPLATFORM;
228
229 // Flags for Cursor type
230 #define FXCT_ARROW      0
231 #define FXCT_NESW       1               
232 #define FXCT_NWSE       2               
233 #define FXCT_VBEAM      3               
234 #define FXCT_HBEAM      4       
235 #define FXCT_HAND       5
236
237 /**
238  * Declares of a pointer type to the callback function for the FFI_SetTimer method.
239  * Parameters:
240  *                      idEvent         -       Identifier of the timer. 
241  * Return value:
242  *                      None. 
243  **/    
244 typedef void    (*TimerCallback)(int idEvent);
245
246 /**
247  * Declares of a struct type to the local system time.
248 **/
249 typedef struct _FPDF_SYSTEMTIME 
250 {
251     unsigned short wYear;                       /* years since 1900 */
252     unsigned short wMonth;                      /* months since January - [0,11] */
253     unsigned short wDayOfWeek;          /* days since Sunday - [0,6] */
254     unsigned short wDay;                        /* day of the month - [1,31] */
255     unsigned short wHour;                       /* hours since midnight - [0,23] */
256     unsigned short wMinute;                     /* minutes after the hour - [0,59] */
257     unsigned short wSecond;                     /* seconds after the minute - [0,59] */
258     unsigned short wMilliseconds;       /* milliseconds after the second - [0,999] */
259 }FPDF_SYSTEMTIME;
260
261 //XFA
262 /**
263  * @name Pageview  event flags
264  */
265 /*@{*/
266 /** @brief After a new pageview is added. */
267 #define  FXFA_PAGEVIEWEVENT_POSTADDED           1
268 /** @brief After a pageview is removed. */
269 #define  FXFA_PAGEVIEWEVENT_POSTREMOVED         3
270 /*@}*/
271
272 // menu
273 /**
274  * @name Macro Definitions for Right Context Menu Features Of XFA Fields
275  */
276 /*@{*/
277 #define  FXFA_MEMU_COPY                 1
278 #define  FXFA_MEMU_CUT                  2
279 #define  FXFA_MEMU_SELECTALL    4
280 #define  FXFA_MEMU_UNDO                 8
281 #define  FXFA_MEMU_REDO                 16
282 #define  FXFA_MEMU_PASTE                32
283 /*@}*/
284
285 // file type
286 /**
287  * @name Macro Definitions for File Type.
288  */
289 /*@{*/
290 #define FXFA_SAVEAS_XML         1
291 #define FXFA_SAVEAS_XDP         2
292 /*@}*/
293
294 typedef struct  _FPDF_FORMFILLINFO
295 {
296         /**
297          * Version number of the interface. Currently must be 2 (with XFA module).
298          **/
299         int     version;
300
301                 /** 
302          * Method: Release
303          *                      Give implementation a chance to release any data after the interface is no longer used
304          * Interface Version:
305          *                      1
306          * Implementation Required:
307          *                      No
308          * Comments:
309          *                      Called by Foxit SDK during the final cleanup process.
310          * Parameters:
311          *                      pThis           -       Pointer to the interface structure itself
312          * Return Value:
313          *                      None
314          */
315
316         void (*Release)(struct _FPDF_FORMFILLINFO* pThis);
317
318         /** 
319          * Method: FFI_Invalidate
320          *                      Invalidate the client area within the specified rectangle.
321          * Interface Version:
322          *                      1
323          * Implementation Required:
324                 *                       yes
325          * Parameters:
326          *                      pThis           -       Pointer to the interface structure itself.
327          *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
328          *                      left            -       Left position of the client area in PDF page coordinate.
329          *                      top                     -       Top  position of the client area in PDF page coordinate.
330          *                      right           -       Right position of the client area in PDF page  coordinate.
331          *                      bottom          -       Bottom position of the client area in PDF page coordinate.
332          * Return Value:
333          *                      None.
334          *
335          *comments:
336          *                      All positions are measured in PDF "user space".
337          *                      Implementation should call FPDF_RenderPageBitmap() function for repainting a specified page area.
338         */
339         void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);
340         
341         /** 
342          * Method: FFI_OutputSelectedRect
343          *                      When user is taking the mouse to select texts on a form field, this callback function will keep 
344          *                      returning the selected areas to the implementation.
345          *
346          * Interface Version:
347          *                      1
348          * Implementation Required:
349          *                      No
350          * Parameters:
351          *                      pThis           -       Pointer to the interface structure itself.
352          *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
353          *                      left            -       Left position of the client area in PDF page coordinate.
354          *                      top                     -       Top  position of the client area in PDF page coordinate.
355          *                      right           -       Right position of the client area in PDF page  coordinate.
356          *                      bottom          -       Bottom position of the client area in PDF page coordinate.
357          * Return Value:
358          *                      None.
359          *
360          * comments:
361          *                      This CALLBACK function is useful for implementing special text selection effect. Implementation should
362          *                      first records the returned rectangles, then draw them one by one at the painting period, last,remove all 
363          *                      the recorded rectangles when finish painting.
364         */
365         void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);
366
367         /** 
368         * Method: FFI_SetCursor
369         *                       Set the Cursor shape.
370         * Interface Version:
371         *                       1
372         * Implementation Required:
373         *                       yes
374         * Parameters:
375         *               pThis           -       Pointer to the interface structure itself.
376         *               nCursorType     -       Cursor type. see Flags for Cursor type for the details.
377         *       Return value:
378         *               None.
379         * */
380         void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType);
381
382         /** 
383         * Method: FFI_SetTimer
384         *                       This method installs a system timer. A time-out value is specified, 
385         *                       and every time a time-out occurs, the system passes a message to
386         *                       the TimerProc callback function. 
387         * Interface Version:
388         *                       1
389         * Implementation Required:
390         *                       yes
391         * Parameters:
392         *               pThis           -       Pointer to the interface structure itself.
393         *               uElapse         -       Specifies the time-out value, in milliseconds.
394         *               lpTimerFunc     -       A pointer to the callback function-TimerCallback.
395         *       Return value:
396         *               The timer identifier of the new timer if the function is successful.
397         *               An application passes this value to the FFI_KillTimer method to kill 
398         *               the timer. Nonzero if it is successful; otherwise, it is zero.
399         * */
400         int  (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis, int uElapse, TimerCallback lpTimerFunc);
401
402         /** 
403         * Method: FFI_KillTimer
404         *                       This method kills the timer event identified by nIDEvent, set by an earlier call to FFI_SetTimer. 
405         * Interface Version:
406         *                       1
407         * Implementation Required:
408         *                       yes
409         * Parameters:
410         *               pThis           -       Pointer to the interface structure itself.
411         *               nTimerID        -       The timer ID return by FFI_SetTimer function.
412         *       Return value:
413         *               None.
414         * */
415         void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID);
416
417
418         /** 
419         * Method: FFI_GetLocalTime
420         *                       This method receives the current local time on the system. 
421         * Interface Version:
422         *                       1
423         * Implementation Required:
424         *                       yes
425         * Parameters:
426         *               pThis           -       Pointer to the interface structure itself.
427         *       Return value:
428         *               None.
429         * */
430         FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis);
431
432         /** 
433         * Method: FFI_OnChange
434         *                       This method will be invoked to notify implementation when the value of any FormField on the document had been changed.
435         * Interface Version:
436         *                       1
437         * Implementation Required:
438         *                       no
439         * Parameters:
440         *               pThis           -       Pointer to the interface structure itself.
441         *       Return value:
442         *               None.
443         * */
444         void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis);
445
446         /** 
447         * Method: FFI_GetPage
448         *                       This method receives the page pointer associated with a specified page index.
449         * Interface Version:
450         *                       1
451         * Implementation Required:
452         *                       yes
453         * Parameters:
454         *               pThis           -       Pointer to the interface structure itself.
455         *               document        -       Handle to document. Returned by FPDF_LoadDocument function.
456         *               nPageIndex  -   Index number of the page. 0 for the first page.
457         * Return value:
458         *               Handle to the page. Returned by FPDF_LoadPage function.
459         * Comments:
460         *               In some cases, the document-level JavaScript action may refer to a page which hadn't been loaded yet.
461         *               To successfully run the javascript action, implementation need to load the page for SDK.
462         * */
463         FPDF_PAGE       (*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, int nPageIndex);
464
465         /** 
466         * Method: FFI_GetCurrentPage
467         *               This method receives the current page pointer.
468         * Interface Version:
469         *                       1
470         * Implementation Required:
471         *                       yes
472         * Parameters:
473         *               pThis           -       Pointer to the interface structure itself.
474         *               document        -       Handle to document. Returned by FPDF_LoadDocument function.
475         * Return value:
476         *               Handle to the page. Returned by FPDF_LoadPage function.
477         * */
478         FPDF_PAGE       (*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document);
479
480         /** 
481         * Method: FFI_GetRotation
482         *                       This method receives currently rotation of the page view.
483         * Interface Version:
484         *                       1
485         * Implementation Required:
486         *                       yes
487         * Parameters:
488         *               pThis           -       Pointer to the interface structure itself.
489         *               page            -       Handle to page. Returned by FPDF_LoadPage function.
490         * Return value:
491         *               The page rotation. Should be 0(0 degree),1(90 degree),2(180 degree),3(270 degree), in a clockwise direction.
492         * */
493         int     (*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page);
494
495         /** 
496         * Method: FFI_ExecuteNamedAction
497         *                       This method will execute an named action.
498         * Interface Version:
499         *                       1
500         * Implementation Required:
501         *                       yes
502         * Parameters:
503         *               pThis                   -       Pointer to the interface structure itself.
504         *               namedAction             -       A byte string which indicates the named action, terminated by 0.
505         * Return value:
506         *               None.
507         * Comments:
508         *               See the named actions description of <<PDF Reference, version 1.7>> for more details.  
509         * */
510         void    (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING namedAction);
511         /** 
512         * @brief This method will be called when a text field is getting or losing a focus.
513         *
514         * @param[in] pThis              Pointer to the interface structure itself.
515         * @param[in] value              The string value of the form field, in UTF-16LE format.
516         * @param[in] valueLen   The length of the string value, number of characters (not bytes).
517         * @param[in] is_focus   True if the form field is getting a focus, False for losing a focus.
518         *
519         * @return None.
520         *
521         * @note Currently,only support text field and combobox field.
522         * */
523         void    (*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING value, FPDF_DWORD valueLen, FPDF_BOOL is_focus);
524
525         
526         /** 
527         * Method: FFI_DoURIAction
528         *                       This action resolves to a uniform resource identifier. 
529         * Interface Version:
530         *                       1
531         * Implementation Required:
532         *                       No
533         * Parameters:
534         *               pThis                   -       Pointer to the interface structure itself.
535         *               bsURI                   -       A byte string which indicates the uniform resource identifier, terminated by 0.
536         * Return value:
537         *               None.
538         * Comments:
539         *               See the URI actions description of <<PDF Reference, version 1.7>> for more details.  
540         * */
541         void    (*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING bsURI);
542         
543         /** 
544         * Method: FFI_DoGoToAction
545         *                       This action changes the view to a specified destination.
546         * Interface Version:
547         *                       1
548         * Implementation Required:
549         *                       No
550         * Parameters:
551         *               pThis                   -       Pointer to the interface structure itself.
552         *               nPageIndex              -       The index of the PDF page.
553         *               zoomMode                -       The zoom mode for viewing page.See Macros "PDFZOOM_XXX" defined in "fpdfdoc.h". 
554         *               fPosArray               -       The float array which carries the position info.
555         *               sizeofArray             -       The size of float array.
556         * Return value:
557         *               None.
558         * Comments:
559         *               See the Destinations description of <<PDF Reference, version 1.7>> in 8.2.1 for more details.  
560         **/
561         void    (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis, int nPageIndex, int zoomMode, float* fPosArray, int sizeofArray);
562
563   /**
564   *   pointer to IPDF_JSPLATFORM interface
565   **/
566   IPDF_JSPLATFORM*      m_pJsPlatform;
567
568   /**
569         * Method: FFI_DisplayCaret
570         *                       This method will show the caret at specified position.
571         * Interface Version:
572         *                       1
573         * Implementation Required:
574         *                       yes
575         * Parameters:
576         *               pThis                   -       Pointer to the interface structure itself.
577         *               page                    -       Handle to page. Returned by FPDF_LoadPage function.
578         *               left                    -       Left position of the client area in PDF page coordinate. 
579         *               top                             -       Top position of the client area in PDF page coordinate.
580         *               right                   -       Right position of the client area in PDF page coordinate.
581         *               bottom                  -       Bottom position of the client area in PDF page coordinate.
582         * Return value:
583         *               None.
584         **/
585         void    (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_BOOL bVisible, double left, double top, double right, double bottom);
586         /** 
587         * Method: FFI_GetCurrentPageIndex
588         *                       This method will get the current page index.
589         * Interface Version:
590         *                       1
591         * Implementation Required:
592         *                       yes
593         * Parameters:
594         *               pThis                   -       Pointer to the interface structure itself.
595         *               document                -       Handle to document. Returned by FPDF_LoadDocument function.
596         * Return value:
597         *               The index of current page.
598         **/
599         int             (*FFI_GetCurrentPageIndex)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document);
600         /** 
601         * Method: FFI_SetCurrentPage
602         *                       This method will set the current page.
603         * Interface Version:
604         *                       1
605         * Implementation Required:
606         *                       yes
607         * Parameters:
608         *               pThis                   -       Pointer to the interface structure itself.
609         *               document                -       Handle to document. Returned by FPDF_LoadDocument function.
610         *               iCurPage                -       The index of the PDF page.
611         * Return value:
612         *               None.
613         **/
614         void    (*FFI_SetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, int iCurPage);
615         /** 
616         * Method: FFI_GotoURL
617         *                       This method will link to the specified URL.
618         * Interface Version:
619         *                       1
620         * Implementation Required:
621         *                       no
622         * Parameters:
623         *               pThis                   -       Pointer to the interface structure itself.
624         *               document                -       Handle to document. Returned by FPDF_LoadDocument function.
625         *               wsURL                   -       The string value of the URL, in UTF-16LE format.
626         * Return value:
627         *               None.
628         **/
629         void    (*FFI_GotoURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, FPDF_WIDESTRING wsURL);
630         /** 
631         * Method: FFI_GetPageViewRect
632         *                       This method will get the current page view rectangle.
633         * Interface Version:
634         *                       1
635         * Implementation Required:
636         *                       yes
637         * Parameters:
638         *               pThis                   -       Pointer to the interface structure itself.
639         *               page                    -       Handle to page. Returned by FPDF_LoadPage function.
640         *               left                    -       The pointer to receive left position of the page view area in PDF page coordinate. 
641         *               top                             -       The pointer to receive top position of the page view area in PDF page coordinate.
642         *               right                   -       The pointer to receive right position of the client area in PDF page coordinate.
643         *               bottom                  -       The pointer to receive bottom position of the client area in PDF page coordinate.
644         * Return value:
645         *               None.
646         **/
647         void    (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, double* left, double* top, double* right, double* bottom);
648         /** 
649         * Method: FFI_PopupMenu
650         *                       This method will track the right context menu for XFA fields.
651         * Interface Version:
652         *                       1
653         * Implementation Required:
654         *                       yes
655         * Parameters:
656         *               pThis                   -       Pointer to the interface structure itself.
657         *               page                    -       Handle to page. Returned by FPDF_LoadPage function.
658         *               hWidget                 -       Handle to XFA fields.
659         *               menuFlag                -       The menu flags. Please refer to macro definition of FXFA_MEMU_XXX and this can be one or a combination of these macros.
660         *               x                               -       X position of the client area in PDF page coordinate.
661         *               y                               -       Y position of the client area in PDF page coordinate.
662         * Return value:
663         *               TRUE indicates success; otherwise false.
664         **/
665         FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_WIDGET hWidget, int menuFlag, float x, float y);
666         /** 
667         * Method: FFI_OpenFile
668         *                       This method will open the specified file with the specified mode.
669         * Interface Version
670         *                       1
671         * Implementation Required:
672         *                       yes
673         * Parameters:
674         *               pThis                   -       Pointer to the interface structure itself.
675         *               fileFlag                -       The file flag.Please refer to macro definition of FXFA_SAVEAS_XXX and this can be one of these macros.
676         *               wsURL                   -       The string value of the file URL, in UTF-16LE format.
677         *               mode                    -       The mode for open file.
678         * Return value:
679         *               The handle to FPDF_FILEHANDLER.
680         **/
681         FPDF_FILEHANDLER* (*FFI_OpenFile)(struct _FPDF_FORMFILLINFO* pThis, int fileFlag, FPDF_WIDESTRING wsURL, const char* mode);
682         /** 
683         * Method: FFI_EmailTo
684         *                       This method will email the specified file stream to the specified contacter.
685         * Interface Version:
686         *                       1
687         * Implementation Required:
688         *                       yes
689         * Parameters:
690         *               pThis                   -       Pointer to the interface structure itself.
691         *               pFileHandler    -       Handle to the FPDF_FILEHANDLER.
692         *               pTo                             -       A semicolon-delimited list of recipients for the message,in UTF-16LE format.
693         *               pSubject                -   The subject of the message,in UTF-16LE format. 
694         *               pCC                             -       A semicolon-delimited list of CC recipients for the message,in UTF-16LE format.
695         *               pBcc                    -       A semicolon-delimited list of BCC recipients for the message,in UTF-16LE format. 
696         *               pMsg                    -       Pointer to the data buffer to be sent.Can be NULL,in UTF-16LE format.
697         * Return value:
698         *               None.
699         **/
700         void    (*FFI_EmailTo)(struct _FPDF_FORMFILLINFO* pThis, FPDF_FILEHANDLER* fileHandler, FPDF_WIDESTRING pTo, FPDF_WIDESTRING pSubject, FPDF_WIDESTRING pCC, FPDF_WIDESTRING pBcc, FPDF_WIDESTRING pMsg);
701         /** 
702         * Method: FFI_UploadTo
703         *                       This method will get upload the specified file stream to the specified URL.
704         * Interface Version:
705         *                       1
706         * Implementation Required: 
707         *                       yes
708         * Parameters:
709         *               pThis                   -       Pointer to the interface structure itself.
710         *               pFileHandler    -       Handle to the FPDF_FILEHANDLER.
711         *               fileFlag                -       The file flag.Please refer to macro definition of FXFA_SAVEAS_XXX and this can be one of these macros.
712         *               uploadTo                -       Pointer to the URL path, in UTF-16LE format.
713         * Return value:
714         *               None.
715         **/
716         void    (*FFI_UploadTo)(struct _FPDF_FORMFILLINFO* pThis, FPDF_FILEHANDLER* fileHandler, int fileFlag, FPDF_WIDESTRING uploadTo);
717         
718         /** 
719         * Method: FFI_GetPlatform
720         *                       This method will get the current platform.
721         * Interface Version:
722         *                       1
723         * Implementation Required: 
724         *                       yes
725         * Parameters:
726         *               pThis                   -       Pointer to the interface structure itself.
727         *               platform                -       Pointer to the data buffer to receive the platform.Can be NULL,in UTF-16LE format.
728         *               length                  -   The length of the buffer, number of bytes. Can be 0.
729         * Return value:
730         *               The length of the buffer, number of bytes.
731         **/
732         int             (*FFI_GetPlatform)(struct _FPDF_FORMFILLINFO* pThis, void* platform, int length);
733         /** 
734         * Method: FFI_GetLanguage
735         *                       This method will get the current language.
736         * Interface Version:
737         *                       1
738         * Implementation Required: 
739         *                       yes
740         * Parameters:
741         *               pThis                   -       Pointer to the interface structure itself.
742         *               language                -       Pointer to the data buffer to receive the current language.Can be NULL.
743         *               length                  -   The length of the buffer, number of bytes. Can be 0.
744         * Return value:
745         *               The length of the buffer, number of bytes.
746         **/
747         int             (*FFI_GetLanguage)(struct _FPDF_FORMFILLINFO* pThis, void* language, int length);
748         /** 
749         * Method: FFI_DownloadFromURL
750         *                       This method will download the specified file from the URL.
751         * Interface Version:
752         *                       1
753         * Implementation Required: 
754         *                       yes
755         * Parameters:
756         *               pThis                   -       Pointer to the interface structure itself.
757         *               URL                             -       The string value of the file URL, in UTF-16LE format.
758         * Return value:
759         *               The handle to FPDF_FILEHANDLER.
760         **/
761         FPDF_LPFILEHANDLER      (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING URL);
762         /** 
763         * Method: FFI_PostRequestURL
764         *                       This method will post the request to the server URL.
765         * Interface Version:
766         *                       1
767         * Implementation Required: 
768         *                       yes
769         * Parameters:
770         *               pThis                   -       Pointer to the interface structure itself.
771         *               wsURL                   -       The string value of the server URL, in UTF-16LE format.
772         *               wsData                  -       The post data,in UTF-16LE format.
773         *               wsContentType   -       The content type of the request data,in UTF-16LE format.
774         *               wsEncode                -       The encode type,in UTF-16LE format.
775         *               wsHeader                -       The request header,in UTF-16LE format.
776         *               response                -       Pointer to the FPDF_BSTR to receive the response data from server,,in UTF-16LE format.
777         * Return value:
778         *               TRUE indicates success, otherwise FALSE.
779         **/
780         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);
781         /** 
782         * Method: FFI_PutRequestURL
783         *                       This method will put the request to the server URL.
784         * Interface Version:
785         *                       1
786         * Implementation Required: 
787         *                       yes
788         * Parameters:
789         *               pThis                   -       Pointer to the interface structure itself.
790         *               wsURL                   -       The string value of the server URL, in UTF-16LE format.
791         *               wsData                  -       The put data, in UTF-16LE format.
792         *               wsEncode                -       The encode type, in UTR-16LE format.
793         * Return value:
794         *               TRUE indicates success, otherwise FALSE.
795         **/
796         FPDF_BOOL       (*FFI_PutRequestURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING wsURL, FPDF_WIDESTRING wsData, FPDF_WIDESTRING wsEncode);
797
798 } FPDF_FORMFILLINFO;
799
800
801
802 /**
803  * Function: FPDFDOC_InitFormFillEnviroument
804  *                      Init form fill environment. 
805  * Comments:
806  *                      This function should be called before any form fill operation.
807  * Parameters:
808  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
809  *                      pFormFillInfo   -       Pointer to a FPDF_FORMFILLINFO structure.
810  * Return Value:
811  *                      Return handler to the form fill module. NULL means fails. 
812  **/
813 DLLEXPORT FPDF_FORMHANDLE STDCALL FPDFDOC_InitFormFillEnviroument(FPDF_DOCUMENT document, FPDF_FORMFILLINFO* formInfo);
814
815 /**
816  * Function: FPDFDOC_ExitFormFillEnviroument
817  *                      Exit form fill environment. 
818  * Parameters:
819  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
820  * Return Value:
821  *                      NULL.
822  **/
823 DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnviroument(FPDF_FORMHANDLE hHandle);
824
825 /**
826  * Function: FORM_OnAfterLoadPage
827  *                      This method is required for implementing all the form related functions. Should be invoked after user 
828  *                      successfully loaded a PDF page, and method FPDFDOC_InitFormFillEnviroument had been invoked.
829  * Parameters:
830  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
831  * Return Value:
832  *                      NONE.
833  **/
834 DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
835
836 /**
837  * Function: FORM_OnBeforeClosePage
838  *                      This method is required for implementing all the form related functions. Should be invoked before user 
839  *                      close the PDF page.
840  * Parameters:
841  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
842  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
843  * Return Value:
844  *                      NONE.
845  **/
846 DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
847
848 /**
849 * Function: FORM_DoDocumentJSAction
850 *                       This method is required for performing Document-level JavaScript action. It should be invoked after the PDF document
851 *                       had been loaded.
852 * Parameters:
853 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
854 * Return Value:
855 *                       NONE
856 * Comments:
857 *                       If there is Document-level JavaScript action embedded in the document, this method will execute the javascript action;
858 *                       otherwise, the method will do nothing.
859 **/
860 DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle);
861
862
863 /**
864 * Function: FORM_DoDocumentOpenAction
865 *                       This method is required for performing open-action when the document is opened.
866 * Parameters:
867 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
868 * Return Value:
869 *                       NONE
870 * Comments:
871 *                       This method will do nothing if there is no open-actions embedded in the document. 
872 **/
873 DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle);
874
875
876 // additional actions type of document.
877 #define FPDFDOC_AACTION_WC              0x10            //WC, before closing document, JavaScript action.
878 #define FPDFDOC_AACTION_WS              0x11            //WS, before saving document, JavaScript action.
879 #define FPDFDOC_AACTION_DS              0x12            //DS, after saving document, JavaScript action.
880 #define FPDFDOC_AACTION_WP              0x13            //WP, before printing document, JavaScript action.
881 #define FPDFDOC_AACTION_DP              0x14            //DP, after printing document, JavaScript action. 
882 /**
883 * Function: FORM_DoDocumentAAction
884 *                       This method is required for performing the document's additional-action.
885 * Parameters:
886 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
887 *                       aaType      -   The type of the additional-actions which defined above.
888 * Return Value:
889 *                       NONE
890 * Comments:
891 *                       This method will do nothing if there is no document additional-action corresponding to the specified aaType.
892 **/
893
894 DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, int aaType);
895
896 // Additional-action types of page object
897 #define FPDFPAGE_AACTION_OPEN           0               // /O -- An action to be performed when the page is opened
898 #define FPDFPAGE_AACTION_CLOSE          1               // /C -- An action to be performed when the page is closed
899
900 /**
901 * Function: FORM_DoPageAAction
902 *                       This method is required for performing the page object's additional-action when opened or closed.
903 * Parameters:
904 *                       page            -       Handle to the page. Returned by FPDF_LoadPage function.
905 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
906 *                       aaType      -   The type of the page object's additional-actions which defined above.
907 * Return Value:
908 *                       NONE
909 * Comments:
910 *                       This method will do nothing if no additional-action corresponding to the specified aaType exists.
911 **/
912 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandle, int aaType);
913
914 /**
915  * Function: FORM_OnMouseMove
916  *                      You can call this member function when the mouse cursor moves. 
917  * Parameters:
918  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
919  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
920  *                      modifier                -       Indicates whether various virtual keys are down. 
921  *                      page_x          -       Specifies the x-coordinate of the cursor in PDF user space. 
922  *                      page_y          -       Specifies the y-coordinate of the cursor in PDF user space.
923  * Return Value:
924  *                      TRUE indicates success; otherwise false.
925  **/
926 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
927
928 /**
929  * Function: FORM_OnLButtonDown
930  *                      You can call this member function when the user presses the left mouse button.
931  * Parameters:
932  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
933  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
934  *                      modifier                -       Indicates whether various virtual keys are down. 
935  *                      page_x          -       Specifies the x-coordinate of the cursor in PDF user space. 
936  *                      page_y          -       Specifies the y-coordinate of the cursor in PDF user space.
937  * Return Value:
938  *                      TRUE indicates success; otherwise false.
939  **/
940 DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
941
942 /**
943  * Function: FORM_OnLButtonUp
944  *                      You can call this member function when the user releases the left mouse button.
945  * Parameters:
946  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
947  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
948  *                      modifier        -       Indicates whether various virtual keys are down. 
949  *                      page_x          -       Specifies the x-coordinate of the cursor in device. 
950  *                      page_y          -       Specifies the y-coordinate of the cursor in device.
951  * Return Value:
952  *                      TRUE indicates success; otherwise false.
953  **/
954 DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
955
956 DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y);
957 DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y);
958
959 /**
960  * Function: FORM_OnKeyDown
961  *                      You can call this member function when a nonsystem key is pressed. 
962  * Parameters:
963  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
964  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
965  *                      nKeyCode        -       Indicates whether various virtual keys are down. 
966  *                      modifier        -       Contains the scan code, key-transition code, previous key state, and context code.
967  * Return Value:
968  *                      TRUE indicates success; otherwise false.
969  **/
970 DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
971
972 /**
973  * Function: FORM_OnKeyUp
974  *                      You can call this member function when a nonsystem key is released. 
975  * Parameters:
976  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
977  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
978  *                      nKeyCode        -       The virtual-key code of the given key.
979  *                      modifier        -       Contains the scan code, key-transition code, previous key state, and context code.
980  * Return Value:
981  *                      TRUE indicates success; otherwise false.
982  **/
983 DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
984
985 /**
986  * Function: FORM_OnChar
987  *                      You can call this member function when a keystroke translates to a nonsystem character.
988  * Parameters:
989  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
990  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
991  *                      nChar           -       The character code value of the key.  
992  *                      modifier        -       Contains the scan code, key-transition code, previous key state, and context code.
993  * Return Value:
994  *                      TRUE indicates success; otherwise false.
995  **/
996 DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nChar, int modifier);
997
998 /**
999  * Function: FORM_ForceToKillFocus.
1000  *                      You can call this member function to force to kill the focus of the form field which got focus.
1001  *                      It would kill the focus on the form field, save the value of form field if it's changed by user.
1002  * Parameters:
1003  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1004  * Return Value:
1005  *                      TRUE indicates success; otherwise false.
1006  **/
1007 DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle);
1008
1009 // Field Types
1010 #define FPDF_FORMFIELD_UNKNOWN          0               // Unknown.
1011 #define FPDF_FORMFIELD_PUSHBUTTON       1               // push button type.
1012 #define FPDF_FORMFIELD_CHECKBOX         2               // check box type.
1013 #define FPDF_FORMFIELD_RADIOBUTTON      3               // radio button type.
1014 #define FPDF_FORMFIELD_COMBOBOX         4               // combo box type.
1015 #define FPDF_FORMFIELD_LISTBOX          5               // list box type.
1016 #define FPDF_FORMFIELD_TEXTFIELD        6               // text field type.
1017 #define FPDF_FORMFIELD_XFA                      7               // text field type.
1018 /**
1019  * Function: FPDPage_HasFormFieldAtPoint
1020  *                      Check the form filed position by point.
1021  * Parameters:
1022  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1023  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
1024  *                      page_x          -       X position in PDF "user space".
1025  *                      page_y          -       Y position in PDF "user space".
1026  * Return Value:
1027  *                      Return the type of the formfiled; -1 indicates no fields.
1028  **/
1029 DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,FPDF_PAGE page,double page_x, double page_y);
1030
1031 /**
1032  * Function: FPDF_SetFormFieldHighlightColor
1033  *                      Set the highlight color of specified or all the form fields in the document.
1034  * Parameters:
1035  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1036  *                      doc                     -       Handle to the document. Returned by FPDF_LoadDocument function.
1037  *                      fieldType       -       A 32-bit integer indicating the type of a form field(defined above).
1038  *                      color           -       The highlight color of the form field.Constructed by 0xxxrrggbb.
1039  * Return Value:
1040  *                      NONE.
1041  * Comments:
1042  *                      When the parameter fieldType is set to zero, the highlight color will be applied to all the form fields in the 
1043  *                      document.
1044  *                      Please refresh the client window to show the highlight immediately if necessary.
1045  **/
1046 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, unsigned long color);
1047
1048 /**
1049  * Function: FPDF_SetFormFieldHighlightAlpha
1050  *                      Set the transparency of the form field highlight color in the document.
1051  * Parameters:
1052  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1053  *                      doc                     -       Handle to the document. Returned by FPDF_LoadDocument function.
1054  *                      alpha           -       The transparency of the form field highlight color. between 0-255.
1055  * Return Value:
1056  *                      NONE.
1057  **/
1058 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha);
1059
1060
1061 /**
1062  * Function: FPDF_RemoveFormFieldHighlight
1063  *                      Remove the form field highlight color in the document.
1064  * Parameters:
1065  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1066  * Return Value:
1067  *                      NONE.
1068  * Comments:
1069  *                      Please refresh the client window to remove the highlight immediately if necessary.
1070  **/
1071 DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
1072
1073 /**
1074 * Function: FPDF_FFLDraw
1075 *                       Render FormFeilds on a page to a device independent bitmap.                     
1076 * Parameters:
1077 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1078 *                       bitmap          -       Handle to the device independent bitmap (as the output buffer).
1079 *                                                       Bitmap handle can be created by FPDFBitmap_Create function.
1080 *                       page            -       Handle to the page. Returned by FPDF_LoadPage function.
1081 *                       start_x         -       Left pixel position of the display area in the device coordinate.
1082 *                       start_y         -       Top pixel position of the display area in the device coordinate.
1083 *                       size_x          -       Horizontal size (in pixels) for displaying the page.
1084 *                       size_y          -       Vertical size (in pixels) for displaying the page.
1085 *                       rotate          -       Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
1086 *                                                               2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
1087 *                       flags           -       0 for normal display, or combination of flags defined above. 
1088 * Return Value:
1089 *                       None.
1090 * Comments: 
1091 *                       This method is designed to only render annotations and FormFields on the page. 
1092 *                       Without FPDF_ANNOT specified for flags, Rendering functions such as FPDF_RenderPageBitmap or FPDF_RenderPageBitmap_Start will only render page contents(without annotations) to a bitmap.
1093 *                       In order to implement the FormFill functions,Implementation should call this method after rendering functions finish rendering the page contents.
1094 **/
1095 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, 
1096                                                 int size_x, int size_y, int rotate, int flags);
1097
1098 /**
1099  * Function: FPDF_LoadXFA
1100  *                      If the document consists of XFA fields, there should call this method to load XFA fields.
1101  * Parameters:
1102  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1103  * Return Value:
1104  *                      TRUE indicates success,otherwise FALSE.
1105  **/
1106 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document);
1107
1108 /**
1109  * Function: FPDF_Widget_Undo
1110  *                      This method will implement the undo feature for the specified xfa field.
1111  * Parameters:
1112  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1113  *                      hWidget                 -       Handle to the xfa field.
1114  * Return Value:
1115  *                      None.
1116  **/
1117 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, FPDF_WIDGET hWidget);
1118 /**
1119  * Function: FPDF_Widget_Redo
1120  *                      This method will implement the redo feature for the specified xfa field.
1121  * Parameters:
1122  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1123  *                      hWidget                 -       Handle to the xfa field.
1124  * Return Value:
1125  *                      None.
1126  **/
1127 DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, FPDF_WIDGET hWidget);
1128 /**
1129  * Function: FPDF_Widget_SelectAll
1130  *                      This method will implement the select all feature for the specified xfa field.
1131  * Parameters:
1132  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1133  *                      hWidget                 -       Handle to the xfa field.
1134  * Return Value:
1135  *                      None.
1136  **/
1137 DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, FPDF_WIDGET hWidget);
1138 /**
1139  * Function: FPDF_Widget_Copy
1140  *                      This method will implement the copy feature for the specified xfa field.
1141  * Parameters:
1142  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1143  *                      hWidget                 -       Handle to the xfa field.
1144  *                      wsText                  -       Pointer to data buffer to receive the copied data, in UTF-16LE format.
1145  *                      size                    -       The data buffer size.
1146  * Return Value:
1147  *                      None.
1148  **/
1149 DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, FPDF_WIDESTRING wsText, FPDF_DWORD* size);
1150 /**
1151  * Function: FPDF_Widget_Cut
1152  *                      This method will implement the cut feature for the specified xfa field.
1153  * Parameters:
1154  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1155  *                      hWidget                 -       Handle to the xfa field.
1156  *                      wsText                  -       Pointer to data buffer to receive the cut data,in UTF-16LE format.
1157  *                      size                    -       The data buffer size,not the byte number.
1158  * Return Value:
1159  *                      None.
1160  **/
1161 DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, FPDF_WIDESTRING wsText, FPDF_DWORD* size);
1162 /**
1163  * Function: FPDF_Widget_Paste
1164  *                      This method will implement the paste feature for the specified xfa field.
1165  * Parameters:
1166  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1167  *                      hWidget                 -       Handle to the xfa field.
1168  *                      wsText                  -       The paste text buffer, in UTF-16LE format.
1169  *                      size                    -       The data buffer size,not the byte number.
1170  * Return Value:
1171  *                      None.
1172  **/
1173 DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, FPDF_WIDESTRING wsText, FPDF_DWORD size);
1174 /**
1175  * Function: FPDF_Widget_ReplaceSpellCheckWord
1176  *                      This method will implement the spell check feature for the specified xfa field.
1177  * Parameters:
1178  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1179  *                      hWidget                 -       Handle to the xfa field.
1180  *                      x                               -       The x value of the specified point.
1181  *                      y                               -       The y value of the specified point.
1182  *                      bsText                  -       The text buffer needed to be speck check, in UTF-16LE format.
1183  * Return Value:
1184  *                      None.
1185  **/
1186 DLLEXPORT void STDCALL FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, float x, float y, FPDF_BYTESTRING bsText);
1187 /**
1188  * Function: FPDF_Widget_GetSpellCheckWords
1189  *                      This method will implement the spell check feature for the specified xfa field.
1190  * Parameters:
1191  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1192  *                      hWidget                 -       Handle to the xfa field.
1193  *                      x                               -       The x value of the specified point.
1194  *                      y                               -       The y value of the specified point.
1195  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE to receive the speck check text buffer, in UTF-16LE format.
1196  * Return Value:
1197  *                      None.
1198  **/
1199 DLLEXPORT void STDCALL FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, float x, float y, FPDF_STRINGHANDLE* stringHandle);
1200 /**
1201  * Function: FPDF_StringHandleCounts
1202  *                      This method will get the count of the text buffer.
1203  * Parameters:
1204  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE.
1205  * Return Value:
1206  *                      None.
1207  **/
1208 DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE stringHandle);
1209 /**
1210  * Function: FPDF_StringHandleGetStringByIndex
1211  *                      This method will get the specified index of the text buffer.
1212  * Parameters:
1213  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE.
1214  *                      index                   -       The specified index of text buffer.
1215  *                      bsText                  -       Pointer to data buffer to receive the text buffer, in UTF-16LE format.
1216  *                      size                    -       The byte size of data buffer.
1217  * Return Value:
1218  *                      TRUE indicates success, otherwise FALSE.
1219  **/
1220 DLLEXPORT FPDF_BOOL STDCALL FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE stringHandle, int index, FPDF_BYTESTRING bsText, FPDF_DWORD* size);
1221 /**
1222  * Function: FPDF_StringHandleRelease
1223  *                      This method will release the FPDF_STRINGHANDLE.
1224  * Parameters:
1225  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE.
1226  * Return Value:
1227  *                      None.
1228  **/
1229 DLLEXPORT void STDCALL FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle);
1230 /**
1231  * Function: FPDF_StringHandleAddString
1232  *                      This method will add the specified text buffer.
1233  * Parameters:
1234  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE.
1235  *                      bsText                  -       Pointer to data buffer of the text buffer, in UTF-16LE format.
1236  *                      size                    -       The byte size of data buffer.
1237  * Return Value:
1238  *                      TRUE indicates success, otherwise FALSE.
1239  **/
1240 DLLEXPORT FPDF_BOOL STDCALL FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, FPDF_BYTESTRING bsText, FPDF_DWORD size);
1241
1242 #ifdef __cplusplus
1243 };
1244 #endif
1245
1246 #endif //_FPDFORMFILL_H
1247