Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[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 1.
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         * Method: FFI_DisplayCaret
564         *                       This method will show the caret at specified position.
565         * Interface Version:
566         *                       1
567         * Implementation Required:
568         *                       yes
569         * Parameters:
570         *               pThis                   -       Pointer to the interface structure itself.
571         *               page                    -       Handle to page. Returned by FPDF_LoadPage function.
572         *               left                    -       Left position of the client area in PDF page coordinate. 
573         *               top                             -       Top position of the client area in PDF page coordinate.
574         *               right                   -       Right position of the client area in PDF page coordinate.
575         *               bottom                  -       Bottom position of the client area in PDF page coordinate.
576         * Return value:
577         *               None.
578         **/
579         void    (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_BOOL bVisible, double left, double top, double right, double bottom);
580         /** 
581         * Method: FFI_GetCurrentPageIndex
582         *                       This method will get the current page index.
583         * Interface Version:
584         *                       1
585         * Implementation Required:
586         *                       yes
587         * Parameters:
588         *               pThis                   -       Pointer to the interface structure itself.
589         *               document                -       Handle to document. Returned by FPDF_LoadDocument function.
590         * Return value:
591         *               The index of current page.
592         **/
593         int             (*FFI_GetCurrentPageIndex)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document);
594         /** 
595         * Method: FFI_SetCurrentPage
596         *                       This method will set the current page.
597         * Interface Version:
598         *                       1
599         * Implementation Required:
600         *                       yes
601         * Parameters:
602         *               pThis                   -       Pointer to the interface structure itself.
603         *               document                -       Handle to document. Returned by FPDF_LoadDocument function.
604         *               iCurPage                -       The index of the PDF page.
605         * Return value:
606         *               None.
607         **/
608         void    (*FFI_SetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, int iCurPage);
609         /** 
610         * Method: FFI_GotoURL
611         *                       This method will link to the specified URL.
612         * Interface Version:
613         *                       1
614         * Implementation Required:
615         *                       no
616         * Parameters:
617         *               pThis                   -       Pointer to the interface structure itself.
618         *               document                -       Handle to document. Returned by FPDF_LoadDocument function.
619         *               wsURL                   -       The string value of the URL, in UTF-16LE format.
620         * Return value:
621         *               None.
622         **/
623         void    (*FFI_GotoURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, FPDF_WIDESTRING wsURL);
624         /** 
625         * Method: FFI_GetPageViewRect
626         *                       This method will get the current page view rectangle.
627         * Interface Version:
628         *                       1
629         * Implementation Required:
630         *                       yes
631         * Parameters:
632         *               pThis                   -       Pointer to the interface structure itself.
633         *               page                    -       Handle to page. Returned by FPDF_LoadPage function.
634         *               left                    -       The pointer to receive left position of the page view area in PDF page coordinate. 
635         *               top                             -       The pointer to receive top position of the page view area in PDF page coordinate.
636         *               right                   -       The pointer to receive right position of the client area in PDF page coordinate.
637         *               bottom                  -       The pointer to receive bottom position of the client area in PDF page coordinate.
638         * Return value:
639         *               None.
640         **/
641         void    (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, double* left, double* top, double* right, double* bottom);
642         /** 
643         * Method: FFI_PopupMenu
644         *                       This method will track the right context menu for XFA fields.
645         * Interface Version:
646         *                       1
647         * Implementation Required:
648         *                       yes
649         * Parameters:
650         *               pThis                   -       Pointer to the interface structure itself.
651         *               page                    -       Handle to page. Returned by FPDF_LoadPage function.
652         *               hWidget                 -       Handle to XFA fields.
653         *               menuFlag                -       The menu flags. Please refer to macro definition of FXFA_MEMU_XXX and this can be one or a combination of these macros.
654         *               x                               -       X position of the client area in PDF page coordinate.
655         *               y                               -       Y position of the client area in PDF page coordinate.
656         * Return value:
657         *               TRUE indicates success; otherwise false.
658         **/
659         FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_WIDGET hWidget, int menuFlag, float x, float y);
660         /** 
661         * Method: FFI_OpenFile
662         *                       This method will open the specified file with the specified mode.
663         * Interface Version
664         *                       1
665         * Implementation Required:
666         *                       yes
667         * Parameters:
668         *               pThis                   -       Pointer to the interface structure itself.
669         *               fileFlag                -       The file flag.Please refer to macro definition of FXFA_SAVEAS_XXX and this can be one of these macros.
670         *               wsURL                   -       The string value of the file URL, in UTF-16LE format.
671         *               mode                    -       The mode for open file.
672         * Return value:
673         *               The handle to FPDF_FILEHANDLER.
674         **/
675         FPDF_FILEHANDLER* (*FFI_OpenFile)(struct _FPDF_FORMFILLINFO* pThis, int fileFlag, FPDF_WIDESTRING wsURL, const char* mode);
676         /** 
677         * Method: FFI_EmailTo
678         *                       This method will email the specified file stream to the specified contacter.
679         * Interface Version:
680         *                       1
681         * Implementation Required:
682         *                       yes
683         * Parameters:
684         *               pThis                   -       Pointer to the interface structure itself.
685         *               pFileHandler    -       Handle to the FPDF_FILEHANDLER.
686         *               pTo                             -       A semicolon-delimited list of recipients for the message,in UTF-16LE format.
687         *               pSubject                -   The subject of the message,in UTF-16LE format. 
688         *               pCC                             -       A semicolon-delimited list of CC recipients for the message,in UTF-16LE format.
689         *               pBcc                    -       A semicolon-delimited list of BCC recipients for the message,in UTF-16LE format. 
690         *               pMsg                    -       Pointer to the data buffer to be sent.Can be NULL,in UTF-16LE format.
691         * Return value:
692         *               None.
693         **/
694         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);
695         /** 
696         * Method: FFI_UploadTo
697         *                       This method will get upload the specified file stream to the specified URL.
698         * Interface Version:
699         *                       1
700         * Implementation Required: 
701         *                       yes
702         * Parameters:
703         *               pThis                   -       Pointer to the interface structure itself.
704         *               pFileHandler    -       Handle to the FPDF_FILEHANDLER.
705         *               fileFlag                -       The file flag.Please refer to macro definition of FXFA_SAVEAS_XXX and this can be one of these macros.
706         *               uploadTo                -       Pointer to the URL path, in UTF-16LE format.
707         * Return value:
708         *               None.
709         **/
710         void    (*FFI_UploadTo)(struct _FPDF_FORMFILLINFO* pThis, FPDF_FILEHANDLER* fileHandler, int fileFlag, FPDF_WIDESTRING uploadTo);
711         
712         /** 
713         * Method: FFI_GetPlatform
714         *                       This method will get the current platform.
715         * Interface Version:
716         *                       1
717         * Implementation Required: 
718         *                       yes
719         * Parameters:
720         *               pThis                   -       Pointer to the interface structure itself.
721         *               platform                -       Pointer to the data buffer to receive the platform.Can be NULL,in UTF-16LE format.
722         *               length                  -   The length of the buffer, number of bytes. Can be 0.
723         * Return value:
724         *               The length of the buffer, number of bytes.
725         **/
726         int             (*FFI_GetPlatform)(struct _FPDF_FORMFILLINFO* pThis, void* platform, int length);
727         /** 
728         * Method: FFI_GetLanguage
729         *                       This method will get the current language.
730         * Interface Version:
731         *                       1
732         * Implementation Required: 
733         *                       yes
734         * Parameters:
735         *               pThis                   -       Pointer to the interface structure itself.
736         *               language                -       Pointer to the data buffer to receive the current language.Can be NULL.
737         *               length                  -   The length of the buffer, number of bytes. Can be 0.
738         * Return value:
739         *               The length of the buffer, number of bytes.
740         **/
741         int             (*FFI_GetLanguage)(struct _FPDF_FORMFILLINFO* pThis, void* language, int length);
742         /** 
743         * Method: FFI_DownloadFromURL
744         *                       This method will download the specified file from the URL.
745         * Interface Version:
746         *                       1
747         * Implementation Required: 
748         *                       yes
749         * Parameters:
750         *               pThis                   -       Pointer to the interface structure itself.
751         *               URL                             -       The string value of the file URL, in UTF-16LE format.
752         * Return value:
753         *               The handle to FPDF_FILEHANDLER.
754         **/
755         FPDF_LPFILEHANDLER      (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING URL);
756         /** 
757         * Method: FFI_PostRequestURL
758         *                       This method will post the request to the server URL.
759         * Interface Version:
760         *                       1
761         * Implementation Required: 
762         *                       yes
763         * Parameters:
764         *               pThis                   -       Pointer to the interface structure itself.
765         *               wsURL                   -       The string value of the server URL, in UTF-16LE format.
766         *               wsData                  -       The post data,in UTF-16LE format.
767         *               wsContentType   -       The content type of the request data,in UTF-16LE format.
768         *               wsEncode                -       The encode type,in UTF-16LE format.
769         *               wsHeader                -       The request header,in UTF-16LE format.
770         *               response                -       Pointer to the FPDF_BSTR to receive the response data from server,,in UTF-16LE format.
771         * Return value:
772         *               TRUE indicates success, otherwise FALSE.
773         **/
774         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);
775         /** 
776         * Method: FFI_PutRequestURL
777         *                       This method will put the request to the server URL.
778         * Interface Version:
779         *                       1
780         * Implementation Required: 
781         *                       yes
782         * Parameters:
783         *               pThis                   -       Pointer to the interface structure itself.
784         *               wsURL                   -       The string value of the server URL, in UTF-16LE format.
785         *               wsData                  -       The put data, in UTF-16LE format.
786         *               wsEncode                -       The encode type, in UTR-16LE format.
787         * Return value:
788         *               TRUE indicates success, otherwise FALSE.
789         **/
790         FPDF_BOOL       (*FFI_PutRequestURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING wsURL, FPDF_WIDESTRING wsData, FPDF_WIDESTRING wsEncode);
791                 
792         IPDF_JSPLATFORM*        m_pJsPlatform;
793
794 } FPDF_FORMFILLINFO;
795
796
797
798 /**
799  * Function: FPDFDOC_InitFormFillEnviroument
800  *                      Init form fill environment. 
801  * Comments:
802  *                      This function should be called before any form fill operation.
803  * Parameters:
804  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
805  *                      pFormFillInfo   -       Pointer to a FPDF_FORMFILLINFO structure.
806  * Return Value:
807  *                      Return handler to the form fill module. NULL means fails. 
808  **/
809 DLLEXPORT FPDF_FORMHANDLE STDCALL FPDFDOC_InitFormFillEnviroument(FPDF_DOCUMENT document, FPDF_FORMFILLINFO* formInfo);
810
811 /**
812  * Function: FPDFDOC_ExitFormFillEnviroument
813  *                      Exit form fill environment. 
814  * Parameters:
815  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
816  * Return Value:
817  *                      NULL.
818  **/
819 DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnviroument(FPDF_FORMHANDLE hHandle);
820
821 /**
822  * Function: FORM_OnAfterLoadPage
823  *                      This method is required for implementing all the form related functions. Should be invoked after user 
824  *                      successfully loaded a PDF page, and method FPDFDOC_InitFormFillEnviroument had been invoked.
825  * Parameters:
826  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
827  * Return Value:
828  *                      NONE.
829  **/
830 DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
831
832 /**
833  * Function: FORM_OnBeforeClosePage
834  *                      This method is required for implementing all the form related functions. Should be invoked before user 
835  *                      close the PDF page.
836  * Parameters:
837  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
838  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
839  * Return Value:
840  *                      NONE.
841  **/
842 DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
843
844 /**
845 * Function: FORM_DoDocumentJSAction
846 *                       This method is required for performing Document-level JavaScript action. It should be invoked after the PDF document
847 *                       had been loaded.
848 * Parameters:
849 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
850 * Return Value:
851 *                       NONE
852 * Comments:
853 *                       If there is Document-level JavaScript action embedded in the document, this method will execute the javascript action;
854 *                       otherwise, the method will do nothing.
855 **/
856 DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle);
857
858
859 /**
860 * Function: FORM_DoDocumentOpenAction
861 *                       This method is required for performing open-action when the document is opened.
862 * Parameters:
863 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
864 * Return Value:
865 *                       NONE
866 * Comments:
867 *                       This method will do nothing if there is no open-actions embedded in the document. 
868 **/
869 DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle);
870
871
872 // additional actions type of document.
873 #define FPDFDOC_AACTION_WC              0x10            //WC, before closing document, JavaScript action.
874 #define FPDFDOC_AACTION_WS              0x11            //WS, before saving document, JavaScript action.
875 #define FPDFDOC_AACTION_DS              0x12            //DS, after saving document, JavaScript action.
876 #define FPDFDOC_AACTION_WP              0x13            //WP, before printing document, JavaScript action.
877 #define FPDFDOC_AACTION_DP              0x14            //DP, after printing document, JavaScript action. 
878 /**
879 * Function: FORM_DoDocumentAAction
880 *                       This method is required for performing the document's additional-action.
881 * Parameters:
882 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
883 *                       aaType      -   The type of the additional-actions which defined above.
884 * Return Value:
885 *                       NONE
886 * Comments:
887 *                       This method will do nothing if there is no document additional-action corresponding to the specified aaType.
888 **/
889
890 DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, int aaType);
891
892 // Additional-action types of page object
893 #define FPDFPAGE_AACTION_OPEN           0               // /O -- An action to be performed when the page is opened
894 #define FPDFPAGE_AACTION_CLOSE          1               // /C -- An action to be performed when the page is closed
895
896 /**
897 * Function: FORM_DoPageAAction
898 *                       This method is required for performing the page object's additional-action when opened or closed.
899 * Parameters:
900 *                       page            -       Handle to the page. Returned by FPDF_LoadPage function.
901 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
902 *                       aaType      -   The type of the page object's additional-actions which defined above.
903 * Return Value:
904 *                       NONE
905 * Comments:
906 *                       This method will do nothing if no additional-action corresponding to the specified aaType exists.
907 **/
908 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandle, int aaType);
909
910 /**
911  * Function: FORM_OnMouseMove
912  *                      You can call this member function when the mouse cursor moves. 
913  * Parameters:
914  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
915  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
916  *                      modifier                -       Indicates whether various virtual keys are down. 
917  *                      page_x          -       Specifies the x-coordinate of the cursor in PDF user space. 
918  *                      page_y          -       Specifies the y-coordinate of the cursor in PDF user space.
919  * Return Value:
920  *                      TRUE indicates success; otherwise false.
921  **/
922 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
923
924 /**
925  * Function: FORM_OnLButtonDown
926  *                      You can call this member function when the user presses the left mouse button.
927  * Parameters:
928  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
929  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
930  *                      modifier                -       Indicates whether various virtual keys are down. 
931  *                      page_x          -       Specifies the x-coordinate of the cursor in PDF user space. 
932  *                      page_y          -       Specifies the y-coordinate of the cursor in PDF user space.
933  * Return Value:
934  *                      TRUE indicates success; otherwise false.
935  **/
936 DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
937
938 /**
939  * Function: FORM_OnLButtonUp
940  *                      You can call this member function when the user releases the left mouse button.
941  * Parameters:
942  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
943  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
944  *                      modifier        -       Indicates whether various virtual keys are down. 
945  *                      page_x          -       Specifies the x-coordinate of the cursor in device. 
946  *                      page_y          -       Specifies the y-coordinate of the cursor in device.
947  * Return Value:
948  *                      TRUE indicates success; otherwise false.
949  **/
950 DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
951
952 DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y);
953 DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y);
954
955 /**
956  * Function: FORM_OnKeyDown
957  *                      You can call this member function when a nonsystem key is pressed. 
958  * Parameters:
959  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
960  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
961  *                      nKeyCode        -       Indicates whether various virtual keys are down. 
962  *                      modifier        -       Contains the scan code, key-transition code, previous key state, and context code.
963  * Return Value:
964  *                      TRUE indicates success; otherwise false.
965  **/
966 DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
967
968 /**
969  * Function: FORM_OnKeyUp
970  *                      You can call this member function when a nonsystem key is released. 
971  * Parameters:
972  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
973  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
974  *                      nKeyCode        -       The virtual-key code of the given key.
975  *                      modifier        -       Contains the scan code, key-transition code, previous key state, and context code.
976  * Return Value:
977  *                      TRUE indicates success; otherwise false.
978  **/
979 DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
980
981 /**
982  * Function: FORM_OnChar
983  *                      You can call this member function when a keystroke translates to a nonsystem character.
984  * Parameters:
985  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
986  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
987  *                      nChar           -       The character code value of the key.  
988  *                      modifier        -       Contains the scan code, key-transition code, previous key state, and context code.
989  * Return Value:
990  *                      TRUE indicates success; otherwise false.
991  **/
992 DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nChar, int modifier);
993
994 /**
995  * Function: FORM_ForceToKillFocus.
996  *                      You can call this member function to force to kill the focus of the form field which got focus.
997  *                      It would kill the focus on the form field, save the value of form field if it's changed by user.
998  * Parameters:
999  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1000  * Return Value:
1001  *                      TRUE indicates success; otherwise false.
1002  **/
1003 DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle);
1004
1005 // Field Types
1006 #define FPDF_FORMFIELD_UNKNOWN          0               // Unknown.
1007 #define FPDF_FORMFIELD_PUSHBUTTON       1               // push button type.
1008 #define FPDF_FORMFIELD_CHECKBOX         2               // check box type.
1009 #define FPDF_FORMFIELD_RADIOBUTTON      3               // radio button type.
1010 #define FPDF_FORMFIELD_COMBOBOX         4               // combo box type.
1011 #define FPDF_FORMFIELD_LISTBOX          5               // list box type.
1012 #define FPDF_FORMFIELD_TEXTFIELD        6               // text field type.
1013 #define FPDF_FORMFIELD_XFA                      7               // text field type.
1014 /**
1015  * Function: FPDPage_HasFormFieldAtPoint
1016  *                      Check the form filed position by point.
1017  * Parameters:
1018  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1019  *                      page            -       Handle to the page. Returned by FPDF_LoadPage function.
1020  *                      page_x          -       X position in PDF "user space".
1021  *                      page_y          -       Y position in PDF "user space".
1022  * Return Value:
1023  *                      Return the type of the formfiled; -1 indicates no fields.
1024  **/
1025 DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,FPDF_PAGE page,double page_x, double page_y);
1026
1027 /**
1028  * Function: FPDF_SetFormFieldHighlightColor
1029  *                      Set the highlight color of specified or all the form fields in the document.
1030  * Parameters:
1031  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1032  *                      doc                     -       Handle to the document. Returned by FPDF_LoadDocument function.
1033  *                      fieldType       -       A 32-bit integer indicating the type of a form field(defined above).
1034  *                      color           -       The highlight color of the form field.Constructed by 0xxxrrggbb.
1035  * Return Value:
1036  *                      NONE.
1037  * Comments:
1038  *                      When the parameter fieldType is set to zero, the highlight color will be applied to all the form fields in the 
1039  *                      document.
1040  *                      Please refresh the client window to show the highlight immediately if necessary.
1041  **/
1042 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, unsigned long color);
1043
1044 /**
1045  * Function: FPDF_SetFormFieldHighlightAlpha
1046  *                      Set the transparency of the form field highlight color in the document.
1047  * Parameters:
1048  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1049  *                      doc                     -       Handle to the document. Returned by FPDF_LoadDocument function.
1050  *                      alpha           -       The transparency of the form field highlight color. between 0-255.
1051  * Return Value:
1052  *                      NONE.
1053  **/
1054 DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha);
1055
1056
1057 /**
1058  * Function: FPDF_RemoveFormFieldHighlight
1059  *                      Remove the form field highlight color in the document.
1060  * Parameters:
1061  *                      hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1062  * Return Value:
1063  *                      NONE.
1064  * Comments:
1065  *                      Please refresh the client window to remove the highlight immediately if necessary.
1066  **/
1067 DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
1068
1069 /**
1070 * Function: FPDF_FFLDraw
1071 *                       Render FormFeilds on a page to a device independent bitmap.                     
1072 * Parameters:
1073 *                       hHandle         -       Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnviroument.
1074 *                       bitmap          -       Handle to the device independent bitmap (as the output buffer).
1075 *                                                       Bitmap handle can be created by FPDFBitmap_Create function.
1076 *                       page            -       Handle to the page. Returned by FPDF_LoadPage function.
1077 *                       start_x         -       Left pixel position of the display area in the device coordinate.
1078 *                       start_y         -       Top pixel position of the display area in the device coordinate.
1079 *                       size_x          -       Horizontal size (in pixels) for displaying the page.
1080 *                       size_y          -       Vertical size (in pixels) for displaying the page.
1081 *                       rotate          -       Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
1082 *                                                               2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
1083 *                       flags           -       0 for normal display, or combination of flags defined above. 
1084 * Return Value:
1085 *                       None.
1086 * Comments: 
1087 *                       This method is designed to only render annotations and FormFields on the page. 
1088 *                       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.
1089 *                       In order to implement the FormFill functions,Implementation should call this method after rendering functions finish rendering the page contents.
1090 **/
1091 DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, 
1092                                                 int size_x, int size_y, int rotate, int flags);
1093
1094 /**
1095  * Function: FPDF_LoadXFA
1096  *                      If the document consists of XFA fields, there should call this method to load XFA fields.
1097  * Parameters:
1098  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1099  * Return Value:
1100  *                      TRUE indicates success,otherwise FALSE.
1101  **/
1102 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document);
1103
1104 /**
1105  * Function: FPDF_Widget_Undo
1106  *                      This method will implement the undo feature for the specified xfa field.
1107  * Parameters:
1108  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1109  *                      hWidget                 -       Handle to the xfa field.
1110  * Return Value:
1111  *                      None.
1112  **/
1113 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, FPDF_WIDGET hWidget);
1114 /**
1115  * Function: FPDF_Widget_Redo
1116  *                      This method will implement the redo feature for the specified xfa field.
1117  * Parameters:
1118  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1119  *                      hWidget                 -       Handle to the xfa field.
1120  * Return Value:
1121  *                      None.
1122  **/
1123 DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, FPDF_WIDGET hWidget);
1124 /**
1125  * Function: FPDF_Widget_SelectAll
1126  *                      This method will implement the select all feature for the specified xfa field.
1127  * Parameters:
1128  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1129  *                      hWidget                 -       Handle to the xfa field.
1130  * Return Value:
1131  *                      None.
1132  **/
1133 DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, FPDF_WIDGET hWidget);
1134 /**
1135  * Function: FPDF_Widget_Copy
1136  *                      This method will implement the copy feature for the specified xfa field.
1137  * Parameters:
1138  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1139  *                      hWidget                 -       Handle to the xfa field.
1140  *                      wsText                  -       Pointer to data buffer to receive the copied data, in UTF-16LE format.
1141  *                      size                    -       The data buffer size.
1142  * Return Value:
1143  *                      None.
1144  **/
1145 DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, FPDF_WIDESTRING wsText, FPDF_DWORD* size);
1146 /**
1147  * Function: FPDF_Widget_Cut
1148  *                      This method will implement the cut feature for the specified xfa field.
1149  * Parameters:
1150  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1151  *                      hWidget                 -       Handle to the xfa field.
1152  *                      wsText                  -       Pointer to data buffer to receive the cut data,in UTF-16LE format.
1153  *                      size                    -       The data buffer size,not the byte number.
1154  * Return Value:
1155  *                      None.
1156  **/
1157 DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, FPDF_WIDESTRING wsText, FPDF_DWORD* size);
1158 /**
1159  * Function: FPDF_Widget_Paste
1160  *                      This method will implement the paste feature for the specified xfa field.
1161  * Parameters:
1162  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1163  *                      hWidget                 -       Handle to the xfa field.
1164  *                      wsText                  -       The paste text buffer, in UTF-16LE format.
1165  *                      size                    -       The data buffer size,not the byte number.
1166  * Return Value:
1167  *                      None.
1168  **/
1169 DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, FPDF_WIDESTRING wsText, FPDF_DWORD size);
1170 /**
1171  * Function: FPDF_Widget_ReplaceSpellCheckWord
1172  *                      This method will implement the spell check feature for the specified xfa field.
1173  * Parameters:
1174  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1175  *                      hWidget                 -       Handle to the xfa field.
1176  *                      x                               -       The x value of the specified point.
1177  *                      y                               -       The y value of the specified point.
1178  *                      bsText                  -       The text buffer needed to be speck check, in UTF-16LE format.
1179  * Return Value:
1180  *                      None.
1181  **/
1182 DLLEXPORT void STDCALL FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, float x, float y, FPDF_BYTESTRING bsText);
1183 /**
1184  * Function: FPDF_Widget_GetSpellCheckWords
1185  *                      This method will implement the spell check feature for the specified xfa field.
1186  * Parameters:
1187  *                      document                -       Handle to document. Returned by FPDF_LoadDocument function.
1188  *                      hWidget                 -       Handle to the xfa field.
1189  *                      x                               -       The x value of the specified point.
1190  *                      y                               -       The y value of the specified point.
1191  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE to receive the speck check text buffer, in UTF-16LE format.
1192  * Return Value:
1193  *                      None.
1194  **/
1195 DLLEXPORT void STDCALL FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, float x, float y, FPDF_STRINGHANDLE* stringHandle);
1196 /**
1197  * Function: FPDF_StringHandleCounts
1198  *                      This method will get the count of the text buffer.
1199  * Parameters:
1200  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE.
1201  * Return Value:
1202  *                      None.
1203  **/
1204 DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE stringHandle);
1205 /**
1206  * Function: FPDF_StringHandleGetStringByIndex
1207  *                      This method will get the specified index of the text buffer.
1208  * Parameters:
1209  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE.
1210  *                      index                   -       The specified index of text buffer.
1211  *                      bsText                  -       Pointer to data buffer to receive the text buffer, in UTF-16LE format.
1212  *                      size                    -       The byte size of data buffer.
1213  * Return Value:
1214  *                      TRUE indicates success, otherwise FALSE.
1215  **/
1216 DLLEXPORT FPDF_BOOL STDCALL FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE stringHandle, int index, FPDF_BYTESTRING bsText, FPDF_DWORD* size);
1217 /**
1218  * Function: FPDF_StringHandleRelease
1219  *                      This method will release the FPDF_STRINGHANDLE.
1220  * Parameters:
1221  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE.
1222  * Return Value:
1223  *                      None.
1224  **/
1225 DLLEXPORT void STDCALL FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle);
1226 /**
1227  * Function: FPDF_StringHandleAddString
1228  *                      This method will add the specified text buffer.
1229  * Parameters:
1230  *                      stringHandle    -       Pointer to FPDF_STRINGHANDLE.
1231  *                      bsText                  -       Pointer to data buffer of the text buffer, in UTF-16LE format.
1232  *                      size                    -       The byte size of data buffer.
1233  * Return Value:
1234  *                      TRUE indicates success, otherwise FALSE.
1235  **/
1236 DLLEXPORT FPDF_BOOL STDCALL FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, FPDF_BYTESTRING bsText, FPDF_DWORD size);
1237
1238 #ifdef __cplusplus
1239 };
1240 #endif
1241
1242 #endif //_FPDFORMFILL_H
1243