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