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