blob: 1263f0b775386705b9ec2caa02f645a2dc98a96b [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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 Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Dan Sinclaire0345a42017-10-30 20:20:42 +00007#ifndef FXJS_CJS_FIELD_H_
8#define FXJS_CJS_FIELD_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Dan Sinclair3ebd1212016-03-09 09:59:23 -050010#include <string>
11#include <vector>
Tom Sepez9a3f8122015-04-07 15:35:48 -070012
Tom Sepez2cbae732018-06-26 15:11:28 +000013#include "fxjs/cjs_document.h"
Tom Sepez221f0b32018-06-04 22:11:27 +000014#include "fxjs/js_define.h"
Tom Sepez9a3f8122015-04-07 15:35:48 -070015
Dan Sinclair51230322017-10-30 15:36:02 +000016class CPDF_FormControl;
Tom Sepez37458412015-10-06 11:33:46 -070017class CPDFSDK_Widget;
Dan Sinclair51230322017-10-30 15:36:02 +000018struct CJS_DelayData;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070019
Nico Weber9d8ec5a2015-08-04 13:00:21 -070020enum FIELD_PROP {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070021 FP_BORDERSTYLE,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070022 FP_CURRENTVALUEINDICES,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070023 FP_DISPLAY,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070024 FP_HIDDEN,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070025 FP_LINEWIDTH,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070026 FP_RECT,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070027 FP_VALUE
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070028};
29
Dan Sinclairf7435522018-02-05 22:27:22 +000030class CJS_Field : public CJS_Object {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070031 public:
Dan Sinclairf7435522018-02-05 22:27:22 +000032 static int GetObjDefnID();
33 static void DefineJSObjects(CFXJS_Engine* pEngine);
dan sinclair111488c2017-10-19 14:30:15 -040034 static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
35 CJS_DelayData* pData);
36
Tom Sepez36aae4f2018-06-04 19:44:37 +000037 CJS_Field(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
Dan Sinclairf7435522018-02-05 22:27:22 +000038 ~CJS_Field() override;
39
Dan Sinclairf7435522018-02-05 22:27:22 +000040 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-Malek3f3b45c2014-05-23 17:28:10 -0700180
Dan Sinclair8f524d62017-10-25 13:30:31 -0400181 CJS_Return get_alignment(CJS_Runtime* pRuntime);
182 CJS_Return set_alignment(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400183
Dan Sinclair8f524d62017-10-25 13:30:31 -0400184 CJS_Return get_border_style(CJS_Runtime* pRuntime);
185 CJS_Return set_border_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400186
Dan Sinclair8f524d62017-10-25 13:30:31 -0400187 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 sinclaircbe23db2017-10-19 14:29:33 -0400189
Dan Sinclair8f524d62017-10-25 13:30:31 -0400190 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 sinclaircbe23db2017-10-19 14:29:33 -0400192
Dan Sinclair8f524d62017-10-25 13:30:31 -0400193 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 sinclaircbe23db2017-10-19 14:29:33 -0400196
Dan Sinclair8f524d62017-10-25 13:30:31 -0400197 CJS_Return get_button_position(CJS_Runtime* pRuntime);
198 CJS_Return set_button_position(CJS_Runtime* pRuntime,
199 v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400200
Dan Sinclair8f524d62017-10-25 13:30:31 -0400201 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 sinclaircbe23db2017-10-19 14:29:33 -0400204
Dan Sinclair8f524d62017-10-25 13:30:31 -0400205 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 sinclaircbe23db2017-10-19 14:29:33 -0400208
Dan Sinclair8f524d62017-10-25 13:30:31 -0400209 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 sinclaircbe23db2017-10-19 14:29:33 -0400212
Dan Sinclair8f524d62017-10-25 13:30:31 -0400213 CJS_Return get_char_limit(CJS_Runtime* pRuntime);
214 CJS_Return set_char_limit(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400215
Dan Sinclair8f524d62017-10-25 13:30:31 -0400216 CJS_Return get_comb(CJS_Runtime* pRuntime);
217 CJS_Return set_comb(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400218
Dan Sinclair8f524d62017-10-25 13:30:31 -0400219 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 sinclaircbe23db2017-10-19 14:29:33 -0400222
Dan Sinclair8f524d62017-10-25 13:30:31 -0400223 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 sinclaircbe23db2017-10-19 14:29:33 -0400226
Dan Sinclair8f524d62017-10-25 13:30:31 -0400227 CJS_Return get_default_style(CJS_Runtime* pRuntime);
228 CJS_Return set_default_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400229
Dan Sinclair8f524d62017-10-25 13:30:31 -0400230 CJS_Return get_default_value(CJS_Runtime* pRuntime);
231 CJS_Return set_default_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400232
Dan Sinclair8f524d62017-10-25 13:30:31 -0400233 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 sinclaircbe23db2017-10-19 14:29:33 -0400235
Dan Sinclair8f524d62017-10-25 13:30:31 -0400236 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 sinclaircbe23db2017-10-19 14:29:33 -0400239
Dan Sinclair8f524d62017-10-25 13:30:31 -0400240 CJS_Return get_delay(CJS_Runtime* pRuntime);
241 CJS_Return set_delay(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400242
Dan Sinclair8f524d62017-10-25 13:30:31 -0400243 CJS_Return get_display(CJS_Runtime* pRuntime);
244 CJS_Return set_display(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400245
Dan Sinclair8f524d62017-10-25 13:30:31 -0400246 CJS_Return get_doc(CJS_Runtime* pRuntime);
247 CJS_Return set_doc(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400248
Dan Sinclair8f524d62017-10-25 13:30:31 -0400249 CJS_Return get_editable(CJS_Runtime* pRuntime);
250 CJS_Return set_editable(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400251
Dan Sinclair8f524d62017-10-25 13:30:31 -0400252 CJS_Return get_export_values(CJS_Runtime* pRuntime);
253 CJS_Return set_export_values(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400254
Dan Sinclair8f524d62017-10-25 13:30:31 -0400255 CJS_Return get_file_select(CJS_Runtime* pRuntime);
256 CJS_Return set_file_select(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400257
Dan Sinclair8f524d62017-10-25 13:30:31 -0400258 CJS_Return get_fill_color(CJS_Runtime* pRuntime);
259 CJS_Return set_fill_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400260
Dan Sinclair8f524d62017-10-25 13:30:31 -0400261 CJS_Return get_hidden(CJS_Runtime* pRuntime);
262 CJS_Return set_hidden(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400263
Dan Sinclair8f524d62017-10-25 13:30:31 -0400264 CJS_Return get_highlight(CJS_Runtime* pRuntime);
265 CJS_Return set_highlight(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400266
Dan Sinclair8f524d62017-10-25 13:30:31 -0400267 CJS_Return get_line_width(CJS_Runtime* pRuntime);
268 CJS_Return set_line_width(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400269
Dan Sinclair8f524d62017-10-25 13:30:31 -0400270 CJS_Return get_multiline(CJS_Runtime* pRuntime);
271 CJS_Return set_multiline(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400272
Dan Sinclair8f524d62017-10-25 13:30:31 -0400273 CJS_Return get_multiple_selection(CJS_Runtime* pRuntime);
274 CJS_Return set_multiple_selection(CJS_Runtime* pRuntime,
275 v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400276
Dan Sinclair8f524d62017-10-25 13:30:31 -0400277 CJS_Return get_name(CJS_Runtime* pRuntime);
278 CJS_Return set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400279
Dan Sinclair8f524d62017-10-25 13:30:31 -0400280 CJS_Return get_num_items(CJS_Runtime* pRuntime);
281 CJS_Return set_num_items(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400282
Dan Sinclair8f524d62017-10-25 13:30:31 -0400283 CJS_Return get_page(CJS_Runtime* pRuntime);
284 CJS_Return set_page(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400285
Dan Sinclair8f524d62017-10-25 13:30:31 -0400286 CJS_Return get_password(CJS_Runtime* pRuntime);
287 CJS_Return set_password(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400288
Dan Sinclair8f524d62017-10-25 13:30:31 -0400289 CJS_Return get_print(CJS_Runtime* pRuntime);
290 CJS_Return set_print(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400291
Dan Sinclair8f524d62017-10-25 13:30:31 -0400292 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 sinclaircbe23db2017-10-19 14:29:33 -0400295
Dan Sinclair8f524d62017-10-25 13:30:31 -0400296 CJS_Return get_readonly(CJS_Runtime* pRuntime);
297 CJS_Return set_readonly(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400298
Dan Sinclair8f524d62017-10-25 13:30:31 -0400299 CJS_Return get_rect(CJS_Runtime* pRuntime);
300 CJS_Return set_rect(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400301
Dan Sinclair8f524d62017-10-25 13:30:31 -0400302 CJS_Return get_required(CJS_Runtime* pRuntime);
303 CJS_Return set_required(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400304
Dan Sinclair8f524d62017-10-25 13:30:31 -0400305 CJS_Return get_rich_text(CJS_Runtime* pRuntime);
306 CJS_Return set_rich_text(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400307
Dan Sinclair8f524d62017-10-25 13:30:31 -0400308 CJS_Return get_rich_value(CJS_Runtime* pRuntime);
309 CJS_Return set_rich_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400310
Dan Sinclair8f524d62017-10-25 13:30:31 -0400311 CJS_Return get_rotation(CJS_Runtime* pRuntime);
312 CJS_Return set_rotation(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400313
Dan Sinclair8f524d62017-10-25 13:30:31 -0400314 CJS_Return get_stroke_color(CJS_Runtime* pRuntime);
315 CJS_Return set_stroke_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400316
Dan Sinclair8f524d62017-10-25 13:30:31 -0400317 CJS_Return get_style(CJS_Runtime* pRuntime);
318 CJS_Return set_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400319
Dan Sinclair8f524d62017-10-25 13:30:31 -0400320 CJS_Return get_submit_name(CJS_Runtime* pRuntime);
321 CJS_Return set_submit_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400322
Dan Sinclair8f524d62017-10-25 13:30:31 -0400323 CJS_Return get_text_font(CJS_Runtime* pRuntime);
324 CJS_Return set_text_font(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400325
Dan Sinclair8f524d62017-10-25 13:30:31 -0400326 CJS_Return get_text_size(CJS_Runtime* pRuntime);
327 CJS_Return set_text_size(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400328
Dan Sinclair8f524d62017-10-25 13:30:31 -0400329 CJS_Return get_type(CJS_Runtime* pRuntime);
330 CJS_Return set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400331
Dan Sinclair8f524d62017-10-25 13:30:31 -0400332 CJS_Return get_user_name(CJS_Runtime* pRuntime);
333 CJS_Return set_user_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400334
Dan Sinclair8f524d62017-10-25 13:30:31 -0400335 CJS_Return get_value(CJS_Runtime* pRuntime);
336 CJS_Return set_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
dan sinclaircbe23db2017-10-19 14:29:33 -0400337
Dan Sinclair8f524d62017-10-25 13:30:31 -0400338 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 sinclaircbe23db2017-10-19 14:29:33 -0400341
Dan Sinclair8f524d62017-10-25 13:30:31 -0400342 CJS_Return get_source(CJS_Runtime* pRuntime);
343 CJS_Return set_source(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700344
Dan Sinclair8f524d62017-10-25 13:30:31 -0400345 CJS_Return browseForFileToSubmit(
dan sinclair80435cb2017-10-24 21:40:24 -0400346 CJS_Runtime* pRuntime,
Dan Sinclair8f524d62017-10-25 13:30:31 -0400347 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-Malek3f3b45c2014-05-23 17:28:10 -0700401
tsepez4cf55152016-11-02 14:37:54 -0700402 void SetDelay(bool bDelay);
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700403 void ParseFieldName(const std::wstring& strFieldNameParsed,
404 std::wstring& strFieldName,
405 int& iControlNo);
Lei Zhangd88a3642015-11-10 09:38:57 -0800406 std::vector<CPDF_FormField*> GetFormFields(
Ryan Harrison275e2602017-09-18 14:23:18 -0400407 const WideString& csFieldName) const;
Lei Zhang4c7ad662018-07-12 20:29:40 +0000408 CPDF_FormField* GetFirstFormField() const;
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700409 CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
Ryan Harrison275e2602017-09-18 14:23:18 -0400410 bool ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700411
tsepez41a53ad2016-03-28 16:59:30 -0700412 void AddDelay_Int(FIELD_PROP prop, int32_t n);
413 void AddDelay_Bool(FIELD_PROP prop, bool b);
Ryan Harrison275e2602017-09-18 14:23:18 -0400414 void AddDelay_String(FIELD_PROP prop, const ByteString& string);
tsepez41a53ad2016-03-28 16:59:30 -0700415 void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect);
tsepez41a53ad2016-03-28 16:59:30 -0700416 void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array);
417 void AddDelay_WideStringArray(FIELD_PROP prop,
Ryan Harrison275e2602017-09-18 14:23:18 -0400418 const std::vector<WideString>& array);
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700419
420 void DoDelay();
421
Tom Sepez2cbae732018-06-26 15:11:28 +0000422 CJS_Document::ObservedPtr m_pJSDoc;
dsinclair3a7741a2016-10-11 10:39:49 -0700423 CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
Ryan Harrison275e2602017-09-18 14:23:18 -0400424 WideString m_FieldName;
Tom Sepez36aae4f2018-06-04 19:44:37 +0000425 int m_nFormControlIndex = -1;
426 bool m_bCanSet = false;
427 bool m_bDelay = false;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700428};
429
Dan Sinclaire0345a42017-10-30 20:20:42 +0000430#endif // FXJS_CJS_FIELD_H_