Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cjs_field.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef FXJS_CJS_FIELD_H_
8#define FXJS_CJS_FIELD_H_
9
10#include <vector>
11
12#include "fxjs/cjs_document.h"
13#include "fxjs/cjs_object.h"
14#include "fxjs/js_define.h"
15#include "third_party/base/containers/span.h"
16
17class CFX_FloatRect;
19struct CJS_DelayData;
20
30
31class CJS_Field final : public CJS_Object {
32 public:
33 static uint32_t GetObjDefnID();
34 static void DefineJSObjects(CFXJS_Engine* pEngine);
35 static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
36 CJS_DelayData* pData);
37
38 CJS_Field(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
39 ~CJS_Field() override;
40
41 bool AttachField(CJS_Document* pDocument, const WideString& csFieldName);
42
43 JS_STATIC_PROP(alignment, alignment, CJS_Field)
44 JS_STATIC_PROP(borderStyle, border_style, CJS_Field)
45 JS_STATIC_PROP(buttonAlignX, button_align_x, CJS_Field)
46 JS_STATIC_PROP(buttonAlignY, button_align_y, CJS_Field)
47 JS_STATIC_PROP(buttonFitBounds, button_fit_bounds, CJS_Field)
48 JS_STATIC_PROP(buttonPosition, button_position, CJS_Field)
49 JS_STATIC_PROP(buttonScaleHow, button_scale_how, CJS_Field)
50 JS_STATIC_PROP(ButtonScaleWhen, button_scale_when, CJS_Field)
51 JS_STATIC_PROP(calcOrderIndex, calc_order_index, CJS_Field)
52 JS_STATIC_PROP(charLimit, char_limit, CJS_Field)
53 JS_STATIC_PROP(comb, comb, CJS_Field)
54 JS_STATIC_PROP(commitOnSelChange, commit_on_sel_change, CJS_Field)
55 JS_STATIC_PROP(currentValueIndices, current_value_indices, CJS_Field)
56 JS_STATIC_PROP(defaultStyle, default_style, CJS_Field)
57 JS_STATIC_PROP(defaultValue, default_value, CJS_Field)
58 JS_STATIC_PROP(doNotScroll, do_not_scroll, CJS_Field)
59 JS_STATIC_PROP(doNotSpellCheck, do_not_spell_check, CJS_Field)
60 JS_STATIC_PROP(delay, delay, CJS_Field)
61 JS_STATIC_PROP(display, display, CJS_Field)
62 JS_STATIC_PROP(doc, doc, CJS_Field)
63 JS_STATIC_PROP(editable, editable, CJS_Field)
64 JS_STATIC_PROP(exportValues, export_values, CJS_Field)
65 JS_STATIC_PROP(fileSelect, file_select, CJS_Field)
66 JS_STATIC_PROP(fillColor, fill_color, CJS_Field)
67 JS_STATIC_PROP(hidden, hidden, CJS_Field)
68 JS_STATIC_PROP(highlight, highlight, CJS_Field)
69 JS_STATIC_PROP(lineWidth, line_width, CJS_Field)
70 JS_STATIC_PROP(multiline, multiline, CJS_Field)
71 JS_STATIC_PROP(multipleSelection, multiple_selection, CJS_Field)
72 JS_STATIC_PROP(name, name, CJS_Field)
73 JS_STATIC_PROP(numItems, num_items, CJS_Field)
74 JS_STATIC_PROP(page, page, CJS_Field)
75 JS_STATIC_PROP(password, password, CJS_Field)
76 JS_STATIC_PROP(print, print, CJS_Field)
77 JS_STATIC_PROP(radiosInUnison, radios_in_unison, CJS_Field)
78 JS_STATIC_PROP(readonly, readonly, CJS_Field)
79 JS_STATIC_PROP(rect, rect, CJS_Field)
80 JS_STATIC_PROP(required, required, CJS_Field)
81 JS_STATIC_PROP(richText, rich_text, CJS_Field)
82 JS_STATIC_PROP(richValue, rich_value, CJS_Field)
83 JS_STATIC_PROP(rotation, rotation, CJS_Field)
84 JS_STATIC_PROP(source, source, CJS_Field)
85 JS_STATIC_PROP(strokeColor, stroke_color, CJS_Field)
86 JS_STATIC_PROP(style, style, CJS_Field)
87 JS_STATIC_PROP(submitName, submit_name, CJS_Field)
88 JS_STATIC_PROP(textColor, text_color, CJS_Field)
89 JS_STATIC_PROP(textFont, text_font, CJS_Field)
90 JS_STATIC_PROP(textSize, text_size, CJS_Field)
91 JS_STATIC_PROP(type, type, CJS_Field)
92 JS_STATIC_PROP(userName, user_name, CJS_Field)
93 JS_STATIC_PROP(value, value, CJS_Field)
94 JS_STATIC_PROP(valueAsString, value_as_string, CJS_Field)
95
96 JS_STATIC_METHOD(browseForFileToSubmit, CJS_Field)
97 JS_STATIC_METHOD(buttonGetCaption, CJS_Field)
98 JS_STATIC_METHOD(buttonGetIcon, CJS_Field)
99 JS_STATIC_METHOD(buttonImportIcon, CJS_Field)
100 JS_STATIC_METHOD(buttonSetCaption, CJS_Field)
101 JS_STATIC_METHOD(buttonSetIcon, CJS_Field)
102 JS_STATIC_METHOD(checkThisBox, CJS_Field)
103 JS_STATIC_METHOD(clearItems, CJS_Field)
104 JS_STATIC_METHOD(defaultIsChecked, CJS_Field)
105 JS_STATIC_METHOD(deleteItemAt, CJS_Field)
106 JS_STATIC_METHOD(getArray, CJS_Field)
107 JS_STATIC_METHOD(getItemAt, CJS_Field)
108 JS_STATIC_METHOD(getLock, CJS_Field)
109 JS_STATIC_METHOD(insertItemAt, CJS_Field)
110 JS_STATIC_METHOD(isBoxChecked, CJS_Field)
111 JS_STATIC_METHOD(isDefaultChecked, CJS_Field)
112 JS_STATIC_METHOD(setAction, CJS_Field)
113 JS_STATIC_METHOD(setFocus, CJS_Field)
114 JS_STATIC_METHOD(setItems, CJS_Field)
115 JS_STATIC_METHOD(setLock, CJS_Field)
116 JS_STATIC_METHOD(signatureGetModifications, CJS_Field)
117 JS_STATIC_METHOD(signatureGetSeedValue, CJS_Field)
118 JS_STATIC_METHOD(signatureInfo, CJS_Field)
119 JS_STATIC_METHOD(signatureSetSeedValue, CJS_Field)
120 JS_STATIC_METHOD(signatureSign, CJS_Field)
121 JS_STATIC_METHOD(signatureValidate, CJS_Field)
122
123 CJS_Result get_text_color(CJS_Runtime* pRuntime);
124 CJS_Result set_text_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
125
126 private:
127 static uint32_t ObjDefnID;
128 static const char kName[];
129 static const JSPropertySpec PropertySpecs[];
130 static const JSMethodSpec MethodSpecs[];
131
132 CJS_Result get_alignment(CJS_Runtime* pRuntime);
133 CJS_Result set_alignment(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
134
135 CJS_Result get_border_style(CJS_Runtime* pRuntime);
136 CJS_Result set_border_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
137
138 CJS_Result get_button_align_x(CJS_Runtime* pRuntime);
139 CJS_Result set_button_align_x(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
140
141 CJS_Result get_button_align_y(CJS_Runtime* pRuntime);
142 CJS_Result set_button_align_y(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
143
144 CJS_Result get_button_fit_bounds(CJS_Runtime* pRuntime);
145 CJS_Result set_button_fit_bounds(CJS_Runtime* pRuntime,
146 v8::Local<v8::Value> vp);
147
148 CJS_Result get_button_position(CJS_Runtime* pRuntime);
149 CJS_Result set_button_position(CJS_Runtime* pRuntime,
150 v8::Local<v8::Value> vp);
151
152 CJS_Result get_button_scale_how(CJS_Runtime* pRuntime);
153 CJS_Result set_button_scale_how(CJS_Runtime* pRuntime,
154 v8::Local<v8::Value> vp);
155
156 CJS_Result get_button_scale_when(CJS_Runtime* pRuntime);
157 CJS_Result set_button_scale_when(CJS_Runtime* pRuntime,
158 v8::Local<v8::Value> vp);
159
160 CJS_Result get_calc_order_index(CJS_Runtime* pRuntime);
161 CJS_Result set_calc_order_index(CJS_Runtime* pRuntime,
162 v8::Local<v8::Value> vp);
163
164 CJS_Result get_char_limit(CJS_Runtime* pRuntime);
165 CJS_Result set_char_limit(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
166
167 CJS_Result get_comb(CJS_Runtime* pRuntime);
168 CJS_Result set_comb(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
169
170 CJS_Result get_commit_on_sel_change(CJS_Runtime* pRuntime);
171 CJS_Result set_commit_on_sel_change(CJS_Runtime* pRuntime,
172 v8::Local<v8::Value> vp);
173
174 CJS_Result get_current_value_indices(CJS_Runtime* pRuntime);
175 CJS_Result set_current_value_indices(CJS_Runtime* pRuntime,
176 v8::Local<v8::Value> vp);
177
178 CJS_Result get_default_style(CJS_Runtime* pRuntime);
179 CJS_Result set_default_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
180
181 CJS_Result get_default_value(CJS_Runtime* pRuntime);
182 CJS_Result set_default_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
183
184 CJS_Result get_do_not_scroll(CJS_Runtime* pRuntime);
185 CJS_Result set_do_not_scroll(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
186
187 CJS_Result get_do_not_spell_check(CJS_Runtime* pRuntime);
188 CJS_Result set_do_not_spell_check(CJS_Runtime* pRuntime,
189 v8::Local<v8::Value> vp);
190
191 CJS_Result get_delay(CJS_Runtime* pRuntime);
192 CJS_Result set_delay(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
193
194 CJS_Result get_display(CJS_Runtime* pRuntime);
195 CJS_Result set_display(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
196
197 CJS_Result get_doc(CJS_Runtime* pRuntime);
198 CJS_Result set_doc(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
199
200 CJS_Result get_editable(CJS_Runtime* pRuntime);
201 CJS_Result set_editable(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
202
203 CJS_Result get_export_values(CJS_Runtime* pRuntime);
204 CJS_Result set_export_values(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
205
206 CJS_Result get_file_select(CJS_Runtime* pRuntime);
207 CJS_Result set_file_select(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
208
209 CJS_Result get_fill_color(CJS_Runtime* pRuntime);
210 CJS_Result set_fill_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
211
212 CJS_Result get_hidden(CJS_Runtime* pRuntime);
213 CJS_Result set_hidden(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
214
215 CJS_Result get_highlight(CJS_Runtime* pRuntime);
216 CJS_Result set_highlight(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
217
218 CJS_Result get_line_width(CJS_Runtime* pRuntime);
219 CJS_Result set_line_width(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
220
221 CJS_Result get_multiline(CJS_Runtime* pRuntime);
222 CJS_Result set_multiline(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
223
224 CJS_Result get_multiple_selection(CJS_Runtime* pRuntime);
225 CJS_Result set_multiple_selection(CJS_Runtime* pRuntime,
226 v8::Local<v8::Value> vp);
227
228 CJS_Result get_name(CJS_Runtime* pRuntime);
229 CJS_Result set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
230
231 CJS_Result get_num_items(CJS_Runtime* pRuntime);
232 CJS_Result set_num_items(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
233
234 CJS_Result get_page(CJS_Runtime* pRuntime);
235 CJS_Result set_page(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
236
237 CJS_Result get_password(CJS_Runtime* pRuntime);
238 CJS_Result set_password(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
239
240 CJS_Result get_print(CJS_Runtime* pRuntime);
241 CJS_Result set_print(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
242
243 CJS_Result get_radios_in_unison(CJS_Runtime* pRuntime);
244 CJS_Result set_radios_in_unison(CJS_Runtime* pRuntime,
245 v8::Local<v8::Value> vp);
246
247 CJS_Result get_readonly(CJS_Runtime* pRuntime);
248 CJS_Result set_readonly(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
249
250 CJS_Result get_rect(CJS_Runtime* pRuntime);
251 CJS_Result set_rect(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
252
253 CJS_Result get_required(CJS_Runtime* pRuntime);
254 CJS_Result set_required(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
255
256 CJS_Result get_rich_text(CJS_Runtime* pRuntime);
257 CJS_Result set_rich_text(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
258
259 CJS_Result get_rich_value(CJS_Runtime* pRuntime);
260 CJS_Result set_rich_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
261
262 CJS_Result get_rotation(CJS_Runtime* pRuntime);
263 CJS_Result set_rotation(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
264
265 CJS_Result get_stroke_color(CJS_Runtime* pRuntime);
266 CJS_Result set_stroke_color(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
267
268 CJS_Result get_style(CJS_Runtime* pRuntime);
269 CJS_Result set_style(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
270
271 CJS_Result get_submit_name(CJS_Runtime* pRuntime);
272 CJS_Result set_submit_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
273
274 CJS_Result get_text_font(CJS_Runtime* pRuntime);
275 CJS_Result set_text_font(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
276
277 CJS_Result get_text_size(CJS_Runtime* pRuntime);
278 CJS_Result set_text_size(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
279
280 CJS_Result get_type(CJS_Runtime* pRuntime);
281 CJS_Result set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
282
283 CJS_Result get_user_name(CJS_Runtime* pRuntime);
284 CJS_Result set_user_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
285
286 CJS_Result get_value(CJS_Runtime* pRuntime);
287 CJS_Result set_value(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
288
289 CJS_Result get_value_as_string(CJS_Runtime* pRuntime);
290 CJS_Result set_value_as_string(CJS_Runtime* pRuntime,
291 v8::Local<v8::Value> vp);
292
293 CJS_Result get_source(CJS_Runtime* pRuntime);
294 CJS_Result set_source(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
295
296 CJS_Result browseForFileToSubmit(CJS_Runtime* pRuntime,
297 pdfium::span<v8::Local<v8::Value>> params);
298 CJS_Result buttonGetCaption(CJS_Runtime* pRuntime,
299 pdfium::span<v8::Local<v8::Value>> params);
300 CJS_Result buttonGetIcon(CJS_Runtime* pRuntime,
301 pdfium::span<v8::Local<v8::Value>> params);
302 CJS_Result buttonImportIcon(CJS_Runtime* pRuntime,
303 pdfium::span<v8::Local<v8::Value>> params);
304 CJS_Result buttonSetCaption(CJS_Runtime* pRuntime,
305 pdfium::span<v8::Local<v8::Value>> params);
306 CJS_Result buttonSetIcon(CJS_Runtime* pRuntime,
307 pdfium::span<v8::Local<v8::Value>> params);
308 CJS_Result checkThisBox(CJS_Runtime* pRuntime,
309 pdfium::span<v8::Local<v8::Value>> params);
310 CJS_Result clearItems(CJS_Runtime* pRuntime,
311 pdfium::span<v8::Local<v8::Value>> params);
312 CJS_Result defaultIsChecked(CJS_Runtime* pRuntime,
313 pdfium::span<v8::Local<v8::Value>> params);
314 CJS_Result deleteItemAt(CJS_Runtime* pRuntime,
315 pdfium::span<v8::Local<v8::Value>> params);
316 CJS_Result getArray(CJS_Runtime* pRuntime,
317 pdfium::span<v8::Local<v8::Value>> params);
318 CJS_Result getItemAt(CJS_Runtime* pRuntime,
319 pdfium::span<v8::Local<v8::Value>> params);
320 CJS_Result getLock(CJS_Runtime* pRuntime,
321 pdfium::span<v8::Local<v8::Value>> params);
322 CJS_Result insertItemAt(CJS_Runtime* pRuntime,
323 pdfium::span<v8::Local<v8::Value>> params);
324 CJS_Result isBoxChecked(CJS_Runtime* pRuntime,
325 pdfium::span<v8::Local<v8::Value>> params);
326 CJS_Result isDefaultChecked(CJS_Runtime* pRuntime,
327 pdfium::span<v8::Local<v8::Value>> params);
328 CJS_Result setAction(CJS_Runtime* pRuntime,
329 pdfium::span<v8::Local<v8::Value>> params);
330 CJS_Result setFocus(CJS_Runtime* pRuntime,
331 pdfium::span<v8::Local<v8::Value>> params);
332 CJS_Result setItems(CJS_Runtime* pRuntime,
333 pdfium::span<v8::Local<v8::Value>> params);
334 CJS_Result setLock(CJS_Runtime* pRuntime,
335 pdfium::span<v8::Local<v8::Value>> params);
336 CJS_Result signatureGetModifications(
337 CJS_Runtime* pRuntime,
338 pdfium::span<v8::Local<v8::Value>> params);
339 CJS_Result signatureGetSeedValue(CJS_Runtime* pRuntime,
340 pdfium::span<v8::Local<v8::Value>> params);
341 CJS_Result signatureInfo(CJS_Runtime* pRuntime,
342 pdfium::span<v8::Local<v8::Value>> params);
343 CJS_Result signatureSetSeedValue(CJS_Runtime* pRuntime,
344 pdfium::span<v8::Local<v8::Value>> params);
345 CJS_Result signatureSign(CJS_Runtime* pRuntime,
346 pdfium::span<v8::Local<v8::Value>> params);
347 CJS_Result signatureValidate(CJS_Runtime* pRuntime,
348 pdfium::span<v8::Local<v8::Value>> params);
349
350 std::vector<CPDF_FormField*> GetFormFields() const;
351 CPDF_FormField* GetFirstFormField() const;
352 CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
353
354 void SetDelay(bool bDelay);
355 void AddDelay_Int(FIELD_PROP prop, int32_t n);
356 void AddDelay_Bool(FIELD_PROP prop, bool b);
357 void AddDelay_String(FIELD_PROP prop, const ByteString& str);
358 void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect);
359 void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array);
360 void AddDelay_WideStringArray(FIELD_PROP prop,
361 const std::vector<WideString>& array);
362 void DoDelay();
363
364 ObservedPtr<CJS_Document> m_pJSDoc;
365 ObservedPtr<CPDFSDK_FormFillEnvironment> m_pFormFillEnv;
366 WideString m_FieldName;
367 int m_nFormControlIndex = -1;
368 bool m_bCanSet = false;
369 bool m_bDelay = false;
370};
371
372#endif // FXJS_CJS_FIELD_H_
FIELD_PROP
Definition cjs_field.h:21
@ FP_HIDDEN
Definition cjs_field.h:25
@ FP_DISPLAY
Definition cjs_field.h:24
@ FP_LINEWIDTH
Definition cjs_field.h:26
@ FP_CURRENTVALUEINDICES
Definition cjs_field.h:23
@ FP_VALUE
Definition cjs_field.h:28
@ FP_BORDERSTYLE
Definition cjs_field.h:22
@ FP_RECT
Definition cjs_field.h:27
CJS_Result get_text_color(CJS_Runtime *pRuntime)
CJS_Result set_text_color(CJS_Runtime *pRuntime, v8::Local< v8::Value > vp)
static void DefineJSObjects(CFXJS_Engine *pEngine)
static uint32_t GetObjDefnID()
bool AttachField(CJS_Document *pDocument, const WideString &csFieldName)
CJS_Field(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
static void DoDelay(CPDFSDK_FormFillEnvironment *pFormFillEnv, CJS_DelayData *pData)
~CJS_Field() override
#define JS_STATIC_METHOD(method_name, class_name)
Definition js_define.h:155
#define JS_STATIC_PROP(err_name, prop_name, class_name)
Definition js_define.h:141
std::vector< uint32_t > wordarray
WideString sFieldName
CJS_DelayData(FIELD_PROP prop, int idx, const WideString &name)
FIELD_PROP eProp
WideString widestring
std::vector< WideString > widestringarray
CFX_FloatRect rect
CFX_Color color
ByteString bytestring