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