summaryrefslogtreecommitdiff
path: root/fxjs/cjs_field.h
blob: 12fcd2a7fead43ea708d20898478c697557010c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef FXJS_CJS_FIELD_H_
#define FXJS_CJS_FIELD_H_

#include <string>
#include <vector>

#include "fxjs/cjs_document.h"
#include "fxjs/js_define.h"

class CPDF_FormControl;
class CPDFSDK_Widget;
struct CJS_DelayData;

enum FIELD_PROP {
  FP_BORDERSTYLE,
  FP_CURRENTVALUEINDICES,
  FP_DISPLAY,
  FP_HIDDEN,
  FP_LINEWIDTH,
  FP_RECT,
  FP_VALUE
};

class CJS_Field : public CJS_Object {
 public:
  static int GetObjDefnID();
  static void DefineJSObjects(CFXJS_Engine* pEngine);
  static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                      CJS_DelayData* pData);

  CJS_Field(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
  ~CJS_Field() override;

  bool AttachField(CJS_Document* pDocument, const WideString& csFieldName);

  JS_STATIC_PROP(alignment, alignment, CJS_Field);
  JS_STATIC_PROP(borderStyle, border_style, CJS_Field);
  JS_STATIC_PROP(buttonAlignX, button_align_x, CJS_Field);
  JS_STATIC_PROP(buttonAlignY, button_align_y, CJS_Field);
  JS_STATIC_PROP(buttonFitBounds, button_fit_bounds, CJS_Field);
  JS_STATIC_PROP(buttonPosition, button_position, CJS_Field);
  JS_STATIC_PROP(buttonScaleHow, button_scale_how, CJS_Field);
  JS_STATIC_PROP(ButtonScaleWhen, button_scale_when, CJS_Field);
  JS_STATIC_PROP(calcOrderIndex, calc_order_index, CJS_Field);
  JS_STATIC_PROP(charLimit, char_limit, CJS_Field);
  JS_STATIC_PROP(comb, comb, CJS_Field);
  JS_STATIC_PROP(commitOnSelChange, commit_on_sel_change, CJS_Field);
  JS_STATIC_PROP(currentValueIndices, current_value_indices, CJS_Field);
  JS_STATIC_PROP(defaultStyle, default_style, CJS_Field);
  JS_STATIC_PROP(defaultValue, default_value, CJS_Field);
  JS_STATIC_PROP(doNotScroll, do_not_scroll, CJS_Field);
  JS_STATIC_PROP(doNotSpellCheck, do_not_spell_check, CJS_Field);
  JS_STATIC_PROP(delay, delay, CJS_Field);
  JS_STATIC_PROP(display, display, CJS_Field);
  JS_STATIC_PROP(doc, doc, CJS_Field);
  JS_STATIC_PROP(editable, editable, CJS_Field);
  JS_STATIC_PROP(exportValues, export_values, CJS_Field);
  JS_STATIC_PROP(fileSelect, file_select, CJS_Field);
  JS_STATIC_PROP(fillColor, fill_color, CJS_Field);
  JS_STATIC_PROP(hidden, hidden, CJS_Field);
  JS_STATIC_PROP(highlight, highlight, CJS_Field);
  JS_STATIC_PROP(lineWidth, line_width, CJS_Field);
  JS_STATIC_PROP(multiline, multiline, CJS_Field);
  JS_STATIC_PROP(multipleSelection, multiple_selection, CJS_Field);
  JS_STATIC_PROP(name, name, CJS_Field);
  JS_STATIC_PROP(numItems, num_items, CJS_Field);
  JS_STATIC_PROP(page, page, CJS_Field);
  JS_STATIC_PROP(password, password, CJS_Field);
  JS_STATIC_PROP(print, print, CJS_Field);
  JS_STATIC_PROP(radiosInUnison, radios_in_unison, CJS_Field);
  JS_STATIC_PROP(readonly, readonly, CJS_Field);
  JS_STATIC_PROP(rect, rect, CJS_Field);
  JS_STATIC_PROP(required, required, CJS_Field);
  JS_STATIC_PROP(richText, rich_text, CJS_Field);
  JS_STATIC_PROP(richValue, rich_value, CJS_Field);
  JS_STATIC_PROP(rotation, rotation, CJS_Field);
  JS_STATIC_PROP(strokeColor, stroke_color, CJS_Field);
  JS_STATIC_PROP(style, style, CJS_Field);
  JS_STATIC_PROP(submitName, submit_name, CJS_Field);
  JS_STATIC_PROP(textColor, text_color, CJS_Field);
  JS_STATIC_PROP(textFont, text_font, CJS_Field);
  JS_STATIC_PROP(textSize, text_size, CJS_Field);
  JS_STATIC_PROP(type, type, CJS_Field);
  JS_STATIC_PROP(userName, user_name, CJS_Field);
  JS_STATIC_PROP(value, value, CJS_Field);
  JS_STATIC_PROP(valueAsString, value_as_string, CJS_Field);
  JS_STATIC_PROP(source, source, CJS_Field);

  JS_STATIC_METHOD(browseForFileToSubmit, CJS_Field);
  JS_STATIC_METHOD(buttonGetCaption, CJS_Field);
  JS_STATIC_METHOD(buttonGetIcon, CJS_Field);
  JS_STATIC_METHOD(buttonImportIcon, CJS_Field);
  JS_STATIC_METHOD(buttonSetCaption, CJS_Field);
  JS_STATIC_METHOD(buttonSetIcon, CJS_Field);
  JS_STATIC_METHOD(checkThisBox, CJS_Field);
  JS_STATIC_METHOD(clearItems, CJS_Field);
  JS_STATIC_METHOD(defaultIsChecked, CJS_Field);
  JS_STATIC_METHOD(deleteItemAt, CJS_Field);
  JS_STATIC_METHOD(getArray, CJS_Field);
  JS_STATIC_METHOD(getItemAt, CJS_Field);
  JS_STATIC_METHOD(getLock, CJS_Field);
  JS_STATIC_METHOD(insertItemAt, CJS_Field);
  JS_STATIC_METHOD(isBoxChecked, CJS_Field);
  JS_STATIC_METHOD(isDefaultChecked, CJS_Field);
  JS_STATIC_METHOD(setAction, CJS_Field);
  JS_STATIC_METHOD(setFocus, CJS_Field);
  JS_STATIC_METHOD(setItems, CJS_Field);
  JS_STATIC_METHOD(setLock, CJS_Field);
  JS_STATIC_METHOD(signatureGetModifications, CJS_Field);
  JS_STATIC_METHOD(signatureGetSeedValue, CJS_Field);
  JS_STATIC_METHOD(signatureInfo, CJS_Field);
  JS_STATIC_METHOD(signatureSetSeedValue, CJS_Field);
  JS_STATIC_METHOD(signatureSign, CJS_Field);
  JS_STATIC_METHOD(signatureValidate, CJS_Field);

  CJS_Return get_text_color(CJS_Runtime* pRuntime);
  CJS_Return set_text_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

 private:
  static int ObjDefnID;
  static const char kName[];
  static const JSPropertySpec PropertySpecs[];
  static const JSMethodSpec MethodSpecs[];

  static void SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                             const WideString& swFieldName,
                             int nControlIndex,
                             const ByteString& string);
  static void SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                                     const WideString& swFieldName,
                                     int nControlIndex,
                                     const std::vector<uint32_t>& array);
  static void SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                         const WideString& swFieldName,
                         int nControlIndex,
                         int number);
  static void SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                        const WideString& swFieldName,
                        int nControlIndex,
                        bool b);
  static void SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                           const WideString& swFieldName,
                           int nControlIndex,
                           int number);
  static void SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                           const WideString& swFieldName,
                           int nControlIndex,
                           bool b);
  static void SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                      const WideString& swFieldName,
                      int nControlIndex,
                      const CFX_FloatRect& rect);
  static void SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                       const WideString& swFieldName,
                       int nControlIndex,
                       const std::vector<WideString>& strArray);

  static void UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                              CPDF_FormField* pFormField,
                              bool bChangeMark,
                              bool bResetAP,
                              bool bRefresh);
  static void UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                                CPDF_FormControl* pFormControl,
                                bool bChangeMark,
                                bool bResetAP,
                                bool bRefresh);

  static CPDFSDK_Widget* GetWidget(CPDFSDK_FormFillEnvironment* pFormFillEnv,
                                   CPDF_FormControl* pFormControl);
  static std::vector<CPDF_FormField*> GetFormFields(
      CPDFSDK_FormFillEnvironment* pFormFillEnv,
      const WideString& csFieldName);

  CJS_Return get_alignment(CJS_Runtime* pRuntime);
  CJS_Return set_alignment(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_border_style(CJS_Runtime* pRuntime);
  CJS_Return set_border_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_button_align_x(CJS_Runtime* pRuntime);
  CJS_Return set_button_align_x(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_button_align_y(CJS_Runtime* pRuntime);
  CJS_Return set_button_align_y(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_button_fit_bounds(CJS_Runtime* pRuntime);
  CJS_Return set_button_fit_bounds(CJS_Runtime* pRuntime,
                                   v8::Local<v8::Value> vp);

  CJS_Return get_button_position(CJS_Runtime* pRuntime);
  CJS_Return set_button_position(CJS_Runtime* pRuntime,
                                 v8::Local<v8::Value> vp);

  CJS_Return get_button_scale_how(CJS_Runtime* pRuntime);
  CJS_Return set_button_scale_how(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp);

  CJS_Return get_button_scale_when(CJS_Runtime* pRuntime);
  CJS_Return set_button_scale_when(CJS_Runtime* pRuntime,
                                   v8::Local<v8::Value> vp);

  CJS_Return get_calc_order_index(CJS_Runtime* pRuntime);
  CJS_Return set_calc_order_index(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp);

  CJS_Return get_char_limit(CJS_Runtime* pRuntime);
  CJS_Return set_char_limit(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_comb(CJS_Runtime* pRuntime);
  CJS_Return set_comb(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_commit_on_sel_change(CJS_Runtime* pRuntime);
  CJS_Return set_commit_on_sel_change(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp);

  CJS_Return get_current_value_indices(CJS_Runtime* pRuntime);
  CJS_Return set_current_value_indices(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp);

  CJS_Return get_default_style(CJS_Runtime* pRuntime);
  CJS_Return set_default_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_default_value(CJS_Runtime* pRuntime);
  CJS_Return set_default_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_do_not_scroll(CJS_Runtime* pRuntime);
  CJS_Return set_do_not_scroll(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_do_not_spell_check(CJS_Runtime* pRuntime);
  CJS_Return set_do_not_spell_check(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp);

  CJS_Return get_delay(CJS_Runtime* pRuntime);
  CJS_Return set_delay(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_display(CJS_Runtime* pRuntime);
  CJS_Return set_display(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_doc(CJS_Runtime* pRuntime);
  CJS_Return set_doc(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_editable(CJS_Runtime* pRuntime);
  CJS_Return set_editable(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_export_values(CJS_Runtime* pRuntime);
  CJS_Return set_export_values(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_file_select(CJS_Runtime* pRuntime);
  CJS_Return set_file_select(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_fill_color(CJS_Runtime* pRuntime);
  CJS_Return set_fill_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_hidden(CJS_Runtime* pRuntime);
  CJS_Return set_hidden(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_highlight(CJS_Runtime* pRuntime);
  CJS_Return set_highlight(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_line_width(CJS_Runtime* pRuntime);
  CJS_Return set_line_width(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_multiline(CJS_Runtime* pRuntime);
  CJS_Return set_multiline(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_multiple_selection(CJS_Runtime* pRuntime);
  CJS_Return set_multiple_selection(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp);

  CJS_Return get_name(CJS_Runtime* pRuntime);
  CJS_Return set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_num_items(CJS_Runtime* pRuntime);
  CJS_Return set_num_items(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_page(CJS_Runtime* pRuntime);
  CJS_Return set_page(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_password(CJS_Runtime* pRuntime);
  CJS_Return set_password(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_print(CJS_Runtime* pRuntime);
  CJS_Return set_print(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_radios_in_unison(CJS_Runtime* pRuntime);
  CJS_Return set_radios_in_unison(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp);

  CJS_Return get_readonly(CJS_Runtime* pRuntime);
  CJS_Return set_readonly(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_rect(CJS_Runtime* pRuntime);
  CJS_Return set_rect(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_required(CJS_Runtime* pRuntime);
  CJS_Return set_required(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_rich_text(CJS_Runtime* pRuntime);
  CJS_Return set_rich_text(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_rich_value(CJS_Runtime* pRuntime);
  CJS_Return set_rich_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_rotation(CJS_Runtime* pRuntime);
  CJS_Return set_rotation(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_stroke_color(CJS_Runtime* pRuntime);
  CJS_Return set_stroke_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_style(CJS_Runtime* pRuntime);
  CJS_Return set_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_submit_name(CJS_Runtime* pRuntime);
  CJS_Return set_submit_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_text_font(CJS_Runtime* pRuntime);
  CJS_Return set_text_font(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_text_size(CJS_Runtime* pRuntime);
  CJS_Return set_text_size(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_type(CJS_Runtime* pRuntime);
  CJS_Return set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_user_name(CJS_Runtime* pRuntime);
  CJS_Return set_user_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_value(CJS_Runtime* pRuntime);
  CJS_Return set_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return get_value_as_string(CJS_Runtime* pRuntime);
  CJS_Return set_value_as_string(CJS_Runtime* pRuntime,
                                 v8::Local<v8::Value> vp);

  CJS_Return get_source(CJS_Runtime* pRuntime);
  CJS_Return set_source(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);

  CJS_Return browseForFileToSubmit(
      CJS_Runtime* pRuntime,
      const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return buttonGetCaption(CJS_Runtime* pRuntime,
                              const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return buttonGetIcon(CJS_Runtime* pRuntime,
                           const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return buttonImportIcon(CJS_Runtime* pRuntime,
                              const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return buttonSetCaption(CJS_Runtime* pRuntime,
                              const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return buttonSetIcon(CJS_Runtime* pRuntime,
                           const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return checkThisBox(CJS_Runtime* pRuntime,
                          const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return clearItems(CJS_Runtime* pRuntime,
                        const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return defaultIsChecked(CJS_Runtime* pRuntime,
                              const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return deleteItemAt(CJS_Runtime* pRuntime,
                          const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return getArray(CJS_Runtime* pRuntime,
                      const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return getItemAt(CJS_Runtime* pRuntime,
                       const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return getLock(CJS_Runtime* pRuntime,
                     const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return insertItemAt(CJS_Runtime* pRuntime,
                          const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return isBoxChecked(CJS_Runtime* pRuntime,
                          const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return isDefaultChecked(CJS_Runtime* pRuntime,
                              const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return setAction(CJS_Runtime* pRuntime,
                       const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return setFocus(CJS_Runtime* pRuntime,
                      const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return setItems(CJS_Runtime* pRuntime,
                      const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return setLock(CJS_Runtime* pRuntime,
                     const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return signatureGetModifications(
      CJS_Runtime* pRuntime,
      const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return signatureGetSeedValue(
      CJS_Runtime* pRuntime,
      const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return signatureInfo(CJS_Runtime* pRuntime,
                           const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return signatureSetSeedValue(
      CJS_Runtime* pRuntime,
      const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return signatureSign(CJS_Runtime* pRuntime,
                           const std::vector<v8::Local<v8::Value>>& params);
  CJS_Return signatureValidate(CJS_Runtime* pRuntime,
                               const std::vector<v8::Local<v8::Value>>& params);

  void SetDelay(bool bDelay);
  void ParseFieldName(const std::wstring& strFieldNameParsed,
                      std::wstring& strFieldName,
                      int& iControlNo);
  std::vector<CPDF_FormField*> GetFormFields() const;
  CPDF_FormField* GetFirstFormField() const;
  CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
  bool ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel) const;

  void AddDelay_Int(FIELD_PROP prop, int32_t n);
  void AddDelay_Bool(FIELD_PROP prop, bool b);
  void AddDelay_String(FIELD_PROP prop, const ByteString& string);
  void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect);
  void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array);
  void AddDelay_WideStringArray(FIELD_PROP prop,
                                const std::vector<WideString>& array);

  void DoDelay();

  CJS_Document::ObservedPtr m_pJSDoc;
  CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
  WideString m_FieldName;
  int m_nFormControlIndex = -1;
  bool m_bCanSet = false;
  bool m_bDelay = false;
};

#endif  // FXJS_CJS_FIELD_H_