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
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
|
// 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 FPDFSDK_JAVASCRIPT_FIELD_H_
#define FPDFSDK_JAVASCRIPT_FIELD_H_
#include <string>
#include <vector>
#include "core/fxcrt/observable.h"
#include "core/fxge/cfx_color.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/javascript/JS_Define.h"
class CPDFSDK_Widget;
class Document;
enum FIELD_PROP {
FP_ALIGNMENT,
FP_BORDERSTYLE,
FP_BUTTONALIGNX,
FP_BUTTONALIGNY,
FP_BUTTONFITBOUNDS,
FP_BUTTONPOSITION,
FP_BUTTONSCALEHOW,
FP_BUTTONSCALEWHEN,
FP_CALCORDERINDEX,
FP_CHARLIMIT,
FP_COMB,
FP_COMMITONSELCHANGE,
FP_CURRENTVALUEINDICES,
FP_DEFAULTVALUE,
FP_DONOTSCROLL,
FP_DISPLAY,
FP_FILLCOLOR,
FP_HIDDEN,
FP_HIGHLIGHT,
FP_LINEWIDTH,
FP_MULTILINE,
FP_MULTIPLESELECTION,
FP_PASSWORD,
FP_RECT,
FP_RICHTEXT,
FP_RICHVALUE,
FP_ROTATION,
FP_STROKECOLOR,
FP_STYLE,
FP_TEXTCOLOR,
FP_TEXTFONT,
FP_TEXTSIZE,
FP_USERNAME,
FP_VALUE
};
struct CJS_DelayData {
CJS_DelayData(FIELD_PROP prop, int idx, const WideString& name);
~CJS_DelayData();
FIELD_PROP eProp;
int nControlIndex;
WideString sFieldName;
int32_t num;
bool b;
ByteString string;
WideString widestring;
CFX_FloatRect rect;
CFX_Color color;
std::vector<uint32_t> wordarray;
std::vector<WideString> widestringarray;
};
class Field : public CJS_EmbedObj {
public:
explicit Field(CJS_Object* pJSObject);
~Field() override;
bool get_alignment(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_alignment(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_border_style(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_border_style(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_button_align_x(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_button_align_x(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_button_align_y(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_button_align_y(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_button_fit_bounds(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_button_fit_bounds(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_button_position(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_button_position(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_button_scale_how(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_button_scale_how(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_button_scale_when(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_button_scale_when(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_calc_order_index(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_calc_order_index(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_char_limit(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_char_limit(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_comb(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_comb(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_commit_on_sel_change(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_commit_on_sel_change(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_current_value_indices(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_current_value_indices(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_default_style(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_default_style(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_default_value(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_default_value(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_do_not_scroll(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_do_not_scroll(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_do_not_spell_check(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_do_not_spell_check(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_delay(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_delay(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_display(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_display(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_doc(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_doc(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_editable(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_editable(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_export_values(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_export_values(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_file_select(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_file_select(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_fill_color(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_fill_color(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_hidden(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_hidden(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_highlight(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_highlight(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_line_width(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_line_width(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_multiline(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_multiline(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_multiple_selection(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_multiple_selection(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_name(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_name(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_num_items(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_num_items(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_page(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_page(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_password(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_password(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_print(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_print(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_radios_in_unison(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_radios_in_unison(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_readonly(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_readonly(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_rect(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_rect(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_required(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_required(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_rich_text(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_rich_text(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_rich_value(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_rich_value(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_rotation(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_rotation(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_stroke_color(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_stroke_color(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_style(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_style(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_submit_name(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_submit_name(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_text_color(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_text_color(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_text_font(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_text_font(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_text_size(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_text_size(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_type(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_type(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_user_name(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_user_name(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_value(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_value(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_value_as_string(CJS_Runtime* pRuntime,
CJS_PropValue* vp,
WideString* sError);
bool set_value_as_string(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool get_source(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
bool set_source(CJS_Runtime* pRuntime,
const CJS_PropValue& vp,
WideString* sError);
bool browseForFileToSubmit(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonGetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonGetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonImportIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonSetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonSetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool checkThisBox(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool clearItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool defaultIsChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool deleteItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool getArray(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool getItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool getLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool insertItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool isBoxChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool isDefaultChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool setAction(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool setFocus(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool setItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool setLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureGetModifications(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureGetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureInfo(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureSetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureSign(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureValidate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
WideString& sError);
static void SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const ByteString& string);
static void SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const ByteString& string);
static void SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const std::vector<uint32_t>& array);
static void SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex);
static void SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const WideString& string);
static void SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color);
static void SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const ByteString& string);
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 SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetPassword(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 SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color);
static void SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const ByteString& string);
static void SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color);
static void SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const ByteString& string);
static void SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
int number);
static void SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const WideString& string);
static void SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const WideString& swFieldName,
int nControlIndex,
const std::vector<WideString>& strArray);
static void AddField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
int nPageIndex,
int nFieldType,
const WideString& sName,
const CFX_FloatRect& rcCoords);
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);
static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CJS_DelayData* pData);
bool AttachField(Document* pDocument, const WideString& csFieldName);
void SetDelay(bool bDelay);
protected:
void ParseFieldName(const std::wstring& strFieldNameParsed,
std::wstring& strFieldName,
int& iControlNo);
std::vector<CPDF_FormField*> GetFormFields(
const WideString& csFieldName) const;
CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
bool ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel);
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_WideString(FIELD_PROP prop, const WideString& string);
void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect);
void AddDelay_Color(FIELD_PROP prop, const CFX_Color& color);
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();
public:
Document* m_pJSDoc;
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
WideString m_FieldName;
int m_nFormControlIndex;
bool m_bCanSet;
bool m_bDelay;
};
class CJS_Field : public CJS_Object {
public:
explicit CJS_Field(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
~CJS_Field() override {}
void InitInstance(IJS_Runtime* pIRuntime) override;
DECLARE_JS_CLASS();
JS_STATIC_PROP(alignment, alignment, Field);
JS_STATIC_PROP(borderStyle, border_style, Field);
JS_STATIC_PROP(buttonAlignX, button_align_x, Field);
JS_STATIC_PROP(buttonAlignY, button_align_y, Field);
JS_STATIC_PROP(buttonFitBounds, button_fit_bounds, Field);
JS_STATIC_PROP(buttonPosition, button_position, Field);
JS_STATIC_PROP(buttonScaleHow, button_scale_how, Field);
JS_STATIC_PROP(ButtonScaleWhen, button_scale_when, Field);
JS_STATIC_PROP(calcOrderIndex, calc_order_index, Field);
JS_STATIC_PROP(charLimit, char_limit, Field);
JS_STATIC_PROP(comb, comb, Field);
JS_STATIC_PROP(commitOnSelChange, commit_on_sel_change, Field);
JS_STATIC_PROP(currentValueIndices, current_value_indices, Field);
JS_STATIC_PROP(defaultStyle, default_style, Field);
JS_STATIC_PROP(defaultValue, default_value, Field);
JS_STATIC_PROP(doNotScroll, do_not_scroll, Field);
JS_STATIC_PROP(doNotSpellCheck, do_not_spell_check, Field);
JS_STATIC_PROP(delay, delay, Field);
JS_STATIC_PROP(display, display, Field);
JS_STATIC_PROP(doc, doc, Field);
JS_STATIC_PROP(editable, editable, Field);
JS_STATIC_PROP(exportValues, export_values, Field);
JS_STATIC_PROP(fileSelect, file_select, Field);
JS_STATIC_PROP(fillColor, fill_color, Field);
JS_STATIC_PROP(hidden, hidden, Field);
JS_STATIC_PROP(highlight, highlight, Field);
JS_STATIC_PROP(lineWidth, line_width, Field);
JS_STATIC_PROP(multiline, multiline, Field);
JS_STATIC_PROP(multipleSelection, multiple_selection, Field);
JS_STATIC_PROP(name, name, Field);
JS_STATIC_PROP(numItems, num_items, Field);
JS_STATIC_PROP(page, page, Field);
JS_STATIC_PROP(password, password, Field);
JS_STATIC_PROP(print, print, Field);
JS_STATIC_PROP(radiosInUnison, radios_in_unison, Field);
JS_STATIC_PROP(readonly, readonly, Field);
JS_STATIC_PROP(rect, rect, Field);
JS_STATIC_PROP(required, required, Field);
JS_STATIC_PROP(richText, rich_text, Field);
JS_STATIC_PROP(richValue, rich_value, Field);
JS_STATIC_PROP(rotation, rotation, Field);
JS_STATIC_PROP(strokeColor, stroke_color, Field);
JS_STATIC_PROP(style, style, Field);
JS_STATIC_PROP(submitName, submit_name, Field);
JS_STATIC_PROP(textColor, text_color, Field);
JS_STATIC_PROP(textFont, text_font, Field);
JS_STATIC_PROP(textSize, text_size, Field);
JS_STATIC_PROP(type, type, Field);
JS_STATIC_PROP(userName, user_name, Field);
JS_STATIC_PROP(value, value, Field);
JS_STATIC_PROP(valueAsString, value_as_string, Field);
JS_STATIC_PROP(source, source, Field);
JS_STATIC_METHOD(browseForFileToSubmit, Field);
JS_STATIC_METHOD(buttonGetCaption, Field);
JS_STATIC_METHOD(buttonGetIcon, Field);
JS_STATIC_METHOD(buttonImportIcon, Field);
JS_STATIC_METHOD(buttonSetCaption, Field);
JS_STATIC_METHOD(buttonSetIcon, Field);
JS_STATIC_METHOD(checkThisBox, Field);
JS_STATIC_METHOD(clearItems, Field);
JS_STATIC_METHOD(defaultIsChecked, Field);
JS_STATIC_METHOD(deleteItemAt, Field);
JS_STATIC_METHOD(getArray, Field);
JS_STATIC_METHOD(getItemAt, Field);
JS_STATIC_METHOD(getLock, Field);
JS_STATIC_METHOD(insertItemAt, Field);
JS_STATIC_METHOD(isBoxChecked, Field);
JS_STATIC_METHOD(isDefaultChecked, Field);
JS_STATIC_METHOD(setAction, Field);
JS_STATIC_METHOD(setFocus, Field);
JS_STATIC_METHOD(setItems, Field);
JS_STATIC_METHOD(setLock, Field);
JS_STATIC_METHOD(signatureGetModifications, Field);
JS_STATIC_METHOD(signatureGetSeedValue, Field);
JS_STATIC_METHOD(signatureInfo, Field);
JS_STATIC_METHOD(signatureSetSeedValue, Field);
JS_STATIC_METHOD(signatureSign, Field);
JS_STATIC_METHOD(signatureValidate, Field);
};
#endif // FPDFSDK_JAVASCRIPT_FIELD_H_
|