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. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -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 | |
Dan Sinclair | e0345a4 | 2017-10-30 20:20:42 +0000 | [diff] [blame] | 7 | #ifndef FXJS_CJS_FIELD_H_ |
| 8 | #define FXJS_CJS_FIELD_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
Dan Sinclair | 3ebd121 | 2016-03-09 09:59:23 -0500 | [diff] [blame] | 10 | #include <string> |
| 11 | #include <vector> |
Tom Sepez | 9a3f812 | 2015-04-07 15:35:48 -0700 | [diff] [blame] | 12 | |
Tom Sepez | 2cbae73 | 2018-06-26 15:11:28 +0000 | [diff] [blame] | 13 | #include "fxjs/cjs_document.h" |
Tom Sepez | 221f0b3 | 2018-06-04 22:11:27 +0000 | [diff] [blame] | 14 | #include "fxjs/js_define.h" |
Tom Sepez | 9a3f812 | 2015-04-07 15:35:48 -0700 | [diff] [blame] | 15 | |
Dan Sinclair | 5123032 | 2017-10-30 15:36:02 +0000 | [diff] [blame] | 16 | class CPDF_FormControl; |
Tom Sepez | 3745841 | 2015-10-06 11:33:46 -0700 | [diff] [blame] | 17 | class CPDFSDK_Widget; |
Dan Sinclair | 5123032 | 2017-10-30 15:36:02 +0000 | [diff] [blame] | 18 | struct CJS_DelayData; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 19 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 20 | enum FIELD_PROP { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 21 | FP_BORDERSTYLE, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 22 | FP_CURRENTVALUEINDICES, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 23 | FP_DISPLAY, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 24 | FP_HIDDEN, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 25 | FP_LINEWIDTH, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 26 | FP_RECT, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 27 | FP_VALUE |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 28 | }; |
| 29 | |
Dan Sinclair | f743552 | 2018-02-05 22:27:22 +0000 | [diff] [blame] | 30 | class CJS_Field : public CJS_Object { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 31 | public: |
Dan Sinclair | f743552 | 2018-02-05 22:27:22 +0000 | [diff] [blame] | 32 | static int GetObjDefnID(); |
| 33 | static void DefineJSObjects(CFXJS_Engine* pEngine); |
dan sinclair | 111488c | 2017-10-19 14:30:15 -0400 | [diff] [blame] | 34 | static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 35 | CJS_DelayData* pData); |
| 36 | |
Tom Sepez | 36aae4f | 2018-06-04 19:44:37 +0000 | [diff] [blame] | 37 | CJS_Field(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime); |
Dan Sinclair | f743552 | 2018-02-05 22:27:22 +0000 | [diff] [blame] | 38 | ~CJS_Field() override; |
| 39 | |
Dan Sinclair | f743552 | 2018-02-05 22:27:22 +0000 | [diff] [blame] | 40 | bool AttachField(CJS_Document* pDocument, const WideString& csFieldName); |
| 41 | |
| 42 | JS_STATIC_PROP(alignment, alignment, CJS_Field); |
| 43 | JS_STATIC_PROP(borderStyle, border_style, CJS_Field); |
| 44 | JS_STATIC_PROP(buttonAlignX, button_align_x, CJS_Field); |
| 45 | JS_STATIC_PROP(buttonAlignY, button_align_y, CJS_Field); |
| 46 | JS_STATIC_PROP(buttonFitBounds, button_fit_bounds, CJS_Field); |
| 47 | JS_STATIC_PROP(buttonPosition, button_position, CJS_Field); |
| 48 | JS_STATIC_PROP(buttonScaleHow, button_scale_how, CJS_Field); |
| 49 | JS_STATIC_PROP(ButtonScaleWhen, button_scale_when, CJS_Field); |
| 50 | JS_STATIC_PROP(calcOrderIndex, calc_order_index, CJS_Field); |
| 51 | JS_STATIC_PROP(charLimit, char_limit, CJS_Field); |
| 52 | JS_STATIC_PROP(comb, comb, CJS_Field); |
| 53 | JS_STATIC_PROP(commitOnSelChange, commit_on_sel_change, CJS_Field); |
| 54 | JS_STATIC_PROP(currentValueIndices, current_value_indices, CJS_Field); |
| 55 | JS_STATIC_PROP(defaultStyle, default_style, CJS_Field); |
| 56 | JS_STATIC_PROP(defaultValue, default_value, CJS_Field); |
| 57 | JS_STATIC_PROP(doNotScroll, do_not_scroll, CJS_Field); |
| 58 | JS_STATIC_PROP(doNotSpellCheck, do_not_spell_check, CJS_Field); |
| 59 | JS_STATIC_PROP(delay, delay, CJS_Field); |
| 60 | JS_STATIC_PROP(display, display, CJS_Field); |
| 61 | JS_STATIC_PROP(doc, doc, CJS_Field); |
| 62 | JS_STATIC_PROP(editable, editable, CJS_Field); |
| 63 | JS_STATIC_PROP(exportValues, export_values, CJS_Field); |
| 64 | JS_STATIC_PROP(fileSelect, file_select, CJS_Field); |
| 65 | JS_STATIC_PROP(fillColor, fill_color, CJS_Field); |
| 66 | JS_STATIC_PROP(hidden, hidden, CJS_Field); |
| 67 | JS_STATIC_PROP(highlight, highlight, CJS_Field); |
| 68 | JS_STATIC_PROP(lineWidth, line_width, CJS_Field); |
| 69 | JS_STATIC_PROP(multiline, multiline, CJS_Field); |
| 70 | JS_STATIC_PROP(multipleSelection, multiple_selection, CJS_Field); |
| 71 | JS_STATIC_PROP(name, name, CJS_Field); |
| 72 | JS_STATIC_PROP(numItems, num_items, CJS_Field); |
| 73 | JS_STATIC_PROP(page, page, CJS_Field); |
| 74 | JS_STATIC_PROP(password, password, CJS_Field); |
| 75 | JS_STATIC_PROP(print, print, CJS_Field); |
| 76 | JS_STATIC_PROP(radiosInUnison, radios_in_unison, CJS_Field); |
| 77 | JS_STATIC_PROP(readonly, readonly, CJS_Field); |
| 78 | JS_STATIC_PROP(rect, rect, CJS_Field); |
| 79 | JS_STATIC_PROP(required, required, CJS_Field); |
| 80 | JS_STATIC_PROP(richText, rich_text, CJS_Field); |
| 81 | JS_STATIC_PROP(richValue, rich_value, CJS_Field); |
| 82 | JS_STATIC_PROP(rotation, rotation, CJS_Field); |
| 83 | JS_STATIC_PROP(strokeColor, stroke_color, CJS_Field); |
| 84 | JS_STATIC_PROP(style, style, CJS_Field); |
| 85 | JS_STATIC_PROP(submitName, submit_name, CJS_Field); |
| 86 | JS_STATIC_PROP(textColor, text_color, CJS_Field); |
| 87 | JS_STATIC_PROP(textFont, text_font, CJS_Field); |
| 88 | JS_STATIC_PROP(textSize, text_size, CJS_Field); |
| 89 | JS_STATIC_PROP(type, type, CJS_Field); |
| 90 | JS_STATIC_PROP(userName, user_name, CJS_Field); |
| 91 | JS_STATIC_PROP(value, value, CJS_Field); |
| 92 | JS_STATIC_PROP(valueAsString, value_as_string, CJS_Field); |
| 93 | JS_STATIC_PROP(source, source, CJS_Field); |
| 94 | |
| 95 | JS_STATIC_METHOD(browseForFileToSubmit, CJS_Field); |
| 96 | JS_STATIC_METHOD(buttonGetCaption, CJS_Field); |
| 97 | JS_STATIC_METHOD(buttonGetIcon, CJS_Field); |
| 98 | JS_STATIC_METHOD(buttonImportIcon, CJS_Field); |
| 99 | JS_STATIC_METHOD(buttonSetCaption, CJS_Field); |
| 100 | JS_STATIC_METHOD(buttonSetIcon, CJS_Field); |
| 101 | JS_STATIC_METHOD(checkThisBox, CJS_Field); |
| 102 | JS_STATIC_METHOD(clearItems, CJS_Field); |
| 103 | JS_STATIC_METHOD(defaultIsChecked, CJS_Field); |
| 104 | JS_STATIC_METHOD(deleteItemAt, CJS_Field); |
| 105 | JS_STATIC_METHOD(getArray, CJS_Field); |
| 106 | JS_STATIC_METHOD(getItemAt, CJS_Field); |
| 107 | JS_STATIC_METHOD(getLock, CJS_Field); |
| 108 | JS_STATIC_METHOD(insertItemAt, CJS_Field); |
| 109 | JS_STATIC_METHOD(isBoxChecked, CJS_Field); |
| 110 | JS_STATIC_METHOD(isDefaultChecked, CJS_Field); |
| 111 | JS_STATIC_METHOD(setAction, CJS_Field); |
| 112 | JS_STATIC_METHOD(setFocus, CJS_Field); |
| 113 | JS_STATIC_METHOD(setItems, CJS_Field); |
| 114 | JS_STATIC_METHOD(setLock, CJS_Field); |
| 115 | JS_STATIC_METHOD(signatureGetModifications, CJS_Field); |
| 116 | JS_STATIC_METHOD(signatureGetSeedValue, CJS_Field); |
| 117 | JS_STATIC_METHOD(signatureInfo, CJS_Field); |
| 118 | JS_STATIC_METHOD(signatureSetSeedValue, CJS_Field); |
| 119 | JS_STATIC_METHOD(signatureSign, CJS_Field); |
| 120 | JS_STATIC_METHOD(signatureValidate, CJS_Field); |
| 121 | |
| 122 | CJS_Return get_text_color(CJS_Runtime* pRuntime); |
| 123 | CJS_Return set_text_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
| 124 | |
| 125 | private: |
| 126 | static int ObjDefnID; |
| 127 | static const char kName[]; |
| 128 | static const JSPropertySpec PropertySpecs[]; |
| 129 | static const JSMethodSpec MethodSpecs[]; |
| 130 | |
| 131 | static void SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 132 | const WideString& swFieldName, |
| 133 | int nControlIndex, |
| 134 | const ByteString& string); |
| 135 | static void SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 136 | const WideString& swFieldName, |
| 137 | int nControlIndex, |
| 138 | const std::vector<uint32_t>& array); |
| 139 | static void SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 140 | const WideString& swFieldName, |
| 141 | int nControlIndex, |
| 142 | int number); |
| 143 | static void SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 144 | const WideString& swFieldName, |
| 145 | int nControlIndex, |
| 146 | bool b); |
| 147 | static void SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 148 | const WideString& swFieldName, |
| 149 | int nControlIndex, |
| 150 | int number); |
| 151 | static void SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 152 | const WideString& swFieldName, |
| 153 | int nControlIndex, |
| 154 | bool b); |
| 155 | static void SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 156 | const WideString& swFieldName, |
| 157 | int nControlIndex, |
| 158 | const CFX_FloatRect& rect); |
| 159 | static void SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 160 | const WideString& swFieldName, |
| 161 | int nControlIndex, |
| 162 | const std::vector<WideString>& strArray); |
| 163 | |
| 164 | static void UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 165 | CPDF_FormField* pFormField, |
| 166 | bool bChangeMark, |
| 167 | bool bResetAP, |
| 168 | bool bRefresh); |
| 169 | static void UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 170 | CPDF_FormControl* pFormControl, |
| 171 | bool bChangeMark, |
| 172 | bool bResetAP, |
| 173 | bool bRefresh); |
| 174 | |
| 175 | static CPDFSDK_Widget* GetWidget(CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 176 | CPDF_FormControl* pFormControl); |
| 177 | static std::vector<CPDF_FormField*> GetFormFields( |
| 178 | CPDFSDK_FormFillEnvironment* pFormFillEnv, |
| 179 | const WideString& csFieldName); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 180 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 181 | CJS_Return get_alignment(CJS_Runtime* pRuntime); |
| 182 | CJS_Return set_alignment(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 183 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 184 | CJS_Return get_border_style(CJS_Runtime* pRuntime); |
| 185 | CJS_Return set_border_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 186 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 187 | CJS_Return get_button_align_x(CJS_Runtime* pRuntime); |
| 188 | CJS_Return set_button_align_x(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 189 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 190 | CJS_Return get_button_align_y(CJS_Runtime* pRuntime); |
| 191 | CJS_Return set_button_align_y(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 192 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 193 | CJS_Return get_button_fit_bounds(CJS_Runtime* pRuntime); |
| 194 | CJS_Return set_button_fit_bounds(CJS_Runtime* pRuntime, |
| 195 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 196 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 197 | CJS_Return get_button_position(CJS_Runtime* pRuntime); |
| 198 | CJS_Return set_button_position(CJS_Runtime* pRuntime, |
| 199 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 200 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 201 | CJS_Return get_button_scale_how(CJS_Runtime* pRuntime); |
| 202 | CJS_Return set_button_scale_how(CJS_Runtime* pRuntime, |
| 203 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 204 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 205 | CJS_Return get_button_scale_when(CJS_Runtime* pRuntime); |
| 206 | CJS_Return set_button_scale_when(CJS_Runtime* pRuntime, |
| 207 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 208 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 209 | CJS_Return get_calc_order_index(CJS_Runtime* pRuntime); |
| 210 | CJS_Return set_calc_order_index(CJS_Runtime* pRuntime, |
| 211 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 212 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 213 | CJS_Return get_char_limit(CJS_Runtime* pRuntime); |
| 214 | CJS_Return set_char_limit(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 215 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 216 | CJS_Return get_comb(CJS_Runtime* pRuntime); |
| 217 | CJS_Return set_comb(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 218 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 219 | CJS_Return get_commit_on_sel_change(CJS_Runtime* pRuntime); |
| 220 | CJS_Return set_commit_on_sel_change(CJS_Runtime* pRuntime, |
| 221 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 222 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 223 | CJS_Return get_current_value_indices(CJS_Runtime* pRuntime); |
| 224 | CJS_Return set_current_value_indices(CJS_Runtime* pRuntime, |
| 225 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 226 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 227 | CJS_Return get_default_style(CJS_Runtime* pRuntime); |
| 228 | CJS_Return set_default_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 229 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 230 | CJS_Return get_default_value(CJS_Runtime* pRuntime); |
| 231 | CJS_Return set_default_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 232 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 233 | CJS_Return get_do_not_scroll(CJS_Runtime* pRuntime); |
| 234 | CJS_Return set_do_not_scroll(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 235 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 236 | CJS_Return get_do_not_spell_check(CJS_Runtime* pRuntime); |
| 237 | CJS_Return set_do_not_spell_check(CJS_Runtime* pRuntime, |
| 238 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 239 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 240 | CJS_Return get_delay(CJS_Runtime* pRuntime); |
| 241 | CJS_Return set_delay(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 242 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 243 | CJS_Return get_display(CJS_Runtime* pRuntime); |
| 244 | CJS_Return set_display(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 245 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 246 | CJS_Return get_doc(CJS_Runtime* pRuntime); |
| 247 | CJS_Return set_doc(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 248 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 249 | CJS_Return get_editable(CJS_Runtime* pRuntime); |
| 250 | CJS_Return set_editable(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 251 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 252 | CJS_Return get_export_values(CJS_Runtime* pRuntime); |
| 253 | CJS_Return set_export_values(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 254 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 255 | CJS_Return get_file_select(CJS_Runtime* pRuntime); |
| 256 | CJS_Return set_file_select(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 257 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 258 | CJS_Return get_fill_color(CJS_Runtime* pRuntime); |
| 259 | CJS_Return set_fill_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 260 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 261 | CJS_Return get_hidden(CJS_Runtime* pRuntime); |
| 262 | CJS_Return set_hidden(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 263 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 264 | CJS_Return get_highlight(CJS_Runtime* pRuntime); |
| 265 | CJS_Return set_highlight(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 266 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 267 | CJS_Return get_line_width(CJS_Runtime* pRuntime); |
| 268 | CJS_Return set_line_width(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 269 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 270 | CJS_Return get_multiline(CJS_Runtime* pRuntime); |
| 271 | CJS_Return set_multiline(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 272 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 273 | CJS_Return get_multiple_selection(CJS_Runtime* pRuntime); |
| 274 | CJS_Return set_multiple_selection(CJS_Runtime* pRuntime, |
| 275 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 276 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 277 | CJS_Return get_name(CJS_Runtime* pRuntime); |
| 278 | CJS_Return set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 279 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 280 | CJS_Return get_num_items(CJS_Runtime* pRuntime); |
| 281 | CJS_Return set_num_items(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 282 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 283 | CJS_Return get_page(CJS_Runtime* pRuntime); |
| 284 | CJS_Return set_page(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 285 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 286 | CJS_Return get_password(CJS_Runtime* pRuntime); |
| 287 | CJS_Return set_password(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 288 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 289 | CJS_Return get_print(CJS_Runtime* pRuntime); |
| 290 | CJS_Return set_print(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 291 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 292 | CJS_Return get_radios_in_unison(CJS_Runtime* pRuntime); |
| 293 | CJS_Return set_radios_in_unison(CJS_Runtime* pRuntime, |
| 294 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 295 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 296 | CJS_Return get_readonly(CJS_Runtime* pRuntime); |
| 297 | CJS_Return set_readonly(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 298 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 299 | CJS_Return get_rect(CJS_Runtime* pRuntime); |
| 300 | CJS_Return set_rect(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 301 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 302 | CJS_Return get_required(CJS_Runtime* pRuntime); |
| 303 | CJS_Return set_required(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 304 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 305 | CJS_Return get_rich_text(CJS_Runtime* pRuntime); |
| 306 | CJS_Return set_rich_text(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 307 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 308 | CJS_Return get_rich_value(CJS_Runtime* pRuntime); |
| 309 | CJS_Return set_rich_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 310 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 311 | CJS_Return get_rotation(CJS_Runtime* pRuntime); |
| 312 | CJS_Return set_rotation(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 313 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 314 | CJS_Return get_stroke_color(CJS_Runtime* pRuntime); |
| 315 | CJS_Return set_stroke_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 316 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 317 | CJS_Return get_style(CJS_Runtime* pRuntime); |
| 318 | CJS_Return set_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 319 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 320 | CJS_Return get_submit_name(CJS_Runtime* pRuntime); |
| 321 | CJS_Return set_submit_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 322 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 323 | CJS_Return get_text_font(CJS_Runtime* pRuntime); |
| 324 | CJS_Return set_text_font(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 325 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 326 | CJS_Return get_text_size(CJS_Runtime* pRuntime); |
| 327 | CJS_Return set_text_size(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 328 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 329 | CJS_Return get_type(CJS_Runtime* pRuntime); |
| 330 | CJS_Return set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 331 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 332 | CJS_Return get_user_name(CJS_Runtime* pRuntime); |
| 333 | CJS_Return set_user_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 334 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 335 | CJS_Return get_value(CJS_Runtime* pRuntime); |
| 336 | CJS_Return set_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 337 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 338 | CJS_Return get_value_as_string(CJS_Runtime* pRuntime); |
| 339 | CJS_Return set_value_as_string(CJS_Runtime* pRuntime, |
| 340 | v8::Local<v8::Value> vp); |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 341 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 342 | CJS_Return get_source(CJS_Runtime* pRuntime); |
| 343 | CJS_Return set_source(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 344 | |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 345 | CJS_Return browseForFileToSubmit( |
dan sinclair | 80435cb | 2017-10-24 21:40:24 -0400 | [diff] [blame] | 346 | CJS_Runtime* pRuntime, |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 347 | const std::vector<v8::Local<v8::Value>>& params); |
| 348 | CJS_Return buttonGetCaption(CJS_Runtime* pRuntime, |
| 349 | const std::vector<v8::Local<v8::Value>>& params); |
| 350 | CJS_Return buttonGetIcon(CJS_Runtime* pRuntime, |
| 351 | const std::vector<v8::Local<v8::Value>>& params); |
| 352 | CJS_Return buttonImportIcon(CJS_Runtime* pRuntime, |
| 353 | const std::vector<v8::Local<v8::Value>>& params); |
| 354 | CJS_Return buttonSetCaption(CJS_Runtime* pRuntime, |
| 355 | const std::vector<v8::Local<v8::Value>>& params); |
| 356 | CJS_Return buttonSetIcon(CJS_Runtime* pRuntime, |
| 357 | const std::vector<v8::Local<v8::Value>>& params); |
| 358 | CJS_Return checkThisBox(CJS_Runtime* pRuntime, |
| 359 | const std::vector<v8::Local<v8::Value>>& params); |
| 360 | CJS_Return clearItems(CJS_Runtime* pRuntime, |
| 361 | const std::vector<v8::Local<v8::Value>>& params); |
| 362 | CJS_Return defaultIsChecked(CJS_Runtime* pRuntime, |
| 363 | const std::vector<v8::Local<v8::Value>>& params); |
| 364 | CJS_Return deleteItemAt(CJS_Runtime* pRuntime, |
| 365 | const std::vector<v8::Local<v8::Value>>& params); |
| 366 | CJS_Return getArray(CJS_Runtime* pRuntime, |
| 367 | const std::vector<v8::Local<v8::Value>>& params); |
| 368 | CJS_Return getItemAt(CJS_Runtime* pRuntime, |
| 369 | const std::vector<v8::Local<v8::Value>>& params); |
| 370 | CJS_Return getLock(CJS_Runtime* pRuntime, |
| 371 | const std::vector<v8::Local<v8::Value>>& params); |
| 372 | CJS_Return insertItemAt(CJS_Runtime* pRuntime, |
| 373 | const std::vector<v8::Local<v8::Value>>& params); |
| 374 | CJS_Return isBoxChecked(CJS_Runtime* pRuntime, |
| 375 | const std::vector<v8::Local<v8::Value>>& params); |
| 376 | CJS_Return isDefaultChecked(CJS_Runtime* pRuntime, |
| 377 | const std::vector<v8::Local<v8::Value>>& params); |
| 378 | CJS_Return setAction(CJS_Runtime* pRuntime, |
| 379 | const std::vector<v8::Local<v8::Value>>& params); |
| 380 | CJS_Return setFocus(CJS_Runtime* pRuntime, |
| 381 | const std::vector<v8::Local<v8::Value>>& params); |
| 382 | CJS_Return setItems(CJS_Runtime* pRuntime, |
| 383 | const std::vector<v8::Local<v8::Value>>& params); |
| 384 | CJS_Return setLock(CJS_Runtime* pRuntime, |
| 385 | const std::vector<v8::Local<v8::Value>>& params); |
| 386 | CJS_Return signatureGetModifications( |
| 387 | CJS_Runtime* pRuntime, |
| 388 | const std::vector<v8::Local<v8::Value>>& params); |
| 389 | CJS_Return signatureGetSeedValue( |
| 390 | CJS_Runtime* pRuntime, |
| 391 | const std::vector<v8::Local<v8::Value>>& params); |
| 392 | CJS_Return signatureInfo(CJS_Runtime* pRuntime, |
| 393 | const std::vector<v8::Local<v8::Value>>& params); |
| 394 | CJS_Return signatureSetSeedValue( |
| 395 | CJS_Runtime* pRuntime, |
| 396 | const std::vector<v8::Local<v8::Value>>& params); |
| 397 | CJS_Return signatureSign(CJS_Runtime* pRuntime, |
| 398 | const std::vector<v8::Local<v8::Value>>& params); |
| 399 | CJS_Return signatureValidate(CJS_Runtime* pRuntime, |
| 400 | const std::vector<v8::Local<v8::Value>>& params); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 401 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 402 | void SetDelay(bool bDelay); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 403 | void ParseFieldName(const std::wstring& strFieldNameParsed, |
| 404 | std::wstring& strFieldName, |
| 405 | int& iControlNo); |
Lei Zhang | d88a364 | 2015-11-10 09:38:57 -0800 | [diff] [blame] | 406 | std::vector<CPDF_FormField*> GetFormFields( |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 407 | const WideString& csFieldName) const; |
Lei Zhang | 4c7ad66 | 2018-07-12 20:29:40 +0000 | [diff] [blame^] | 408 | CPDF_FormField* GetFirstFormField() const; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 409 | CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField); |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 410 | bool ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 411 | |
tsepez | 41a53ad | 2016-03-28 16:59:30 -0700 | [diff] [blame] | 412 | void AddDelay_Int(FIELD_PROP prop, int32_t n); |
| 413 | void AddDelay_Bool(FIELD_PROP prop, bool b); |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 414 | void AddDelay_String(FIELD_PROP prop, const ByteString& string); |
tsepez | 41a53ad | 2016-03-28 16:59:30 -0700 | [diff] [blame] | 415 | void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect); |
tsepez | 41a53ad | 2016-03-28 16:59:30 -0700 | [diff] [blame] | 416 | void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array); |
| 417 | void AddDelay_WideStringArray(FIELD_PROP prop, |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 418 | const std::vector<WideString>& array); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 419 | |
| 420 | void DoDelay(); |
| 421 | |
Tom Sepez | 2cbae73 | 2018-06-26 15:11:28 +0000 | [diff] [blame] | 422 | CJS_Document::ObservedPtr m_pJSDoc; |
dsinclair | 3a7741a | 2016-10-11 10:39:49 -0700 | [diff] [blame] | 423 | CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv; |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 424 | WideString m_FieldName; |
Tom Sepez | 36aae4f | 2018-06-04 19:44:37 +0000 | [diff] [blame] | 425 | int m_nFormControlIndex = -1; |
| 426 | bool m_bCanSet = false; |
| 427 | bool m_bDelay = false; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 428 | }; |
| 429 | |
Dan Sinclair | e0345a4 | 2017-10-30 20:20:42 +0000 | [diff] [blame] | 430 | #endif // FXJS_CJS_FIELD_H_ |