| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_FIELD_H_ | |
| 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_FIELD_H_ | |
| 9 | |
| 10 #include <string> // For std::wstring. | |
| 11 | |
| 12 #include "../pdfwindow/PWL_Wnd.h" // For CPWL_Color. | |
| 13 #include "JS_Define.h" | |
| 14 | |
| 15 class Document; | |
| 16 | |
| 17 enum FIELD_PROP { | |
| 18 FP_ALIGNMENT, | |
| 19 FP_BORDERSTYLE, | |
| 20 FP_BUTTONALIGNX, | |
| 21 FP_BUTTONALIGNY, | |
| 22 FP_BUTTONFITBOUNDS, | |
| 23 FP_BUTTONPOSITION, | |
| 24 FP_BUTTONSCALEHOW, | |
| 25 FP_BUTTONSCALEWHEN, | |
| 26 FP_CALCORDERINDEX, | |
| 27 FP_CHARLIMIT, | |
| 28 FP_COMB, | |
| 29 FP_COMMITONSELCHANGE, | |
| 30 FP_CURRENTVALUEINDICES, | |
| 31 FP_DEFAULTVALUE, | |
| 32 FP_DONOTSCROLL, | |
| 33 FP_DISPLAY, | |
| 34 FP_FILLCOLOR, | |
| 35 FP_HIDDEN, | |
| 36 FP_HIGHLIGHT, | |
| 37 FP_LINEWIDTH, | |
| 38 FP_MULTILINE, | |
| 39 FP_MULTIPLESELECTION, | |
| 40 FP_PASSWORD, | |
| 41 FP_RECT, | |
| 42 FP_RICHTEXT, | |
| 43 FP_RICHVALUE, | |
| 44 FP_ROTATION, | |
| 45 FP_STROKECOLOR, | |
| 46 FP_STYLE, | |
| 47 FP_TEXTCOLOR, | |
| 48 FP_TEXTFONT, | |
| 49 FP_TEXTSIZE, | |
| 50 FP_USERNAME, | |
| 51 FP_VALUE | |
| 52 }; | |
| 53 | |
| 54 class CJS_WideStringArray { | |
| 55 public: | |
| 56 CJS_WideStringArray() {} | |
| 57 virtual ~CJS_WideStringArray() { | |
| 58 for (int i = 0, sz = m_Data.GetSize(); i < sz; i++) | |
| 59 delete m_Data.GetAt(i); | |
| 60 m_Data.RemoveAll(); | |
| 61 } | |
| 62 | |
| 63 void Add(const CFX_WideString& string) { | |
| 64 m_Data.Add(new CFX_WideString(string)); | |
| 65 } | |
| 66 | |
| 67 int GetSize() const { return m_Data.GetSize(); } | |
| 68 | |
| 69 CFX_WideString GetAt(int i) const { return *m_Data.GetAt(i); } | |
| 70 | |
| 71 private: | |
| 72 CFX_ArrayTemplate<CFX_WideString*> m_Data; | |
| 73 }; | |
| 74 | |
| 75 struct CJS_DelayData { | |
| 76 CFX_WideString sFieldName; | |
| 77 int nControlIndex; | |
| 78 enum FIELD_PROP eProp; | |
| 79 int32_t num; | |
| 80 bool b; | |
| 81 CFX_ByteString string; | |
| 82 CFX_WideString widestring; | |
| 83 CPDF_Rect rect; | |
| 84 CPWL_Color color; | |
| 85 CFX_DWordArray wordarray; | |
| 86 CJS_WideStringArray widestringarray; | |
| 87 }; | |
| 88 | |
| 89 class Field : public CJS_EmbedObj { | |
| 90 public: | |
| 91 Field(CJS_Object* pJSObject); | |
| 92 ~Field() override; | |
| 93 | |
| 94 FX_BOOL alignment(IFXJS_Context* cc, | |
| 95 CJS_PropValue& vp, | |
| 96 CFX_WideString& sError); | |
| 97 FX_BOOL borderStyle(IFXJS_Context* cc, | |
| 98 CJS_PropValue& vp, | |
| 99 CFX_WideString& sError); | |
| 100 FX_BOOL buttonAlignX(IFXJS_Context* cc, | |
| 101 CJS_PropValue& vp, | |
| 102 CFX_WideString& sError); | |
| 103 FX_BOOL buttonAlignY(IFXJS_Context* cc, | |
| 104 CJS_PropValue& vp, | |
| 105 CFX_WideString& sError); | |
| 106 FX_BOOL buttonFitBounds(IFXJS_Context* cc, | |
| 107 CJS_PropValue& vp, | |
| 108 CFX_WideString& sError); | |
| 109 FX_BOOL buttonPosition(IFXJS_Context* cc, | |
| 110 CJS_PropValue& vp, | |
| 111 CFX_WideString& sError); | |
| 112 FX_BOOL buttonScaleHow(IFXJS_Context* cc, | |
| 113 CJS_PropValue& vp, | |
| 114 CFX_WideString& sError); | |
| 115 FX_BOOL buttonScaleWhen(IFXJS_Context* cc, | |
| 116 CJS_PropValue& vp, | |
| 117 CFX_WideString& sError); | |
| 118 FX_BOOL calcOrderIndex(IFXJS_Context* cc, | |
| 119 CJS_PropValue& vp, | |
| 120 CFX_WideString& sError); | |
| 121 FX_BOOL charLimit(IFXJS_Context* cc, | |
| 122 CJS_PropValue& vp, | |
| 123 CFX_WideString& sError); | |
| 124 FX_BOOL comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 125 FX_BOOL commitOnSelChange(IFXJS_Context* cc, | |
| 126 CJS_PropValue& vp, | |
| 127 CFX_WideString& sError); | |
| 128 FX_BOOL currentValueIndices(IFXJS_Context* cc, | |
| 129 CJS_PropValue& vp, | |
| 130 CFX_WideString& sError); | |
| 131 FX_BOOL defaultStyle(IFXJS_Context* cc, | |
| 132 CJS_PropValue& vp, | |
| 133 CFX_WideString& sError); | |
| 134 FX_BOOL defaultValue(IFXJS_Context* cc, | |
| 135 CJS_PropValue& vp, | |
| 136 CFX_WideString& sError); | |
| 137 FX_BOOL doNotScroll(IFXJS_Context* cc, | |
| 138 CJS_PropValue& vp, | |
| 139 CFX_WideString& sError); | |
| 140 FX_BOOL doNotSpellCheck(IFXJS_Context* cc, | |
| 141 CJS_PropValue& vp, | |
| 142 CFX_WideString& sError); | |
| 143 FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 144 FX_BOOL display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 145 FX_BOOL doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 146 FX_BOOL editable(IFXJS_Context* cc, | |
| 147 CJS_PropValue& vp, | |
| 148 CFX_WideString& sError); | |
| 149 FX_BOOL exportValues(IFXJS_Context* cc, | |
| 150 CJS_PropValue& vp, | |
| 151 CFX_WideString& sError); | |
| 152 FX_BOOL fileSelect(IFXJS_Context* cc, | |
| 153 CJS_PropValue& vp, | |
| 154 CFX_WideString& sError); | |
| 155 FX_BOOL fillColor(IFXJS_Context* cc, | |
| 156 CJS_PropValue& vp, | |
| 157 CFX_WideString& sError); | |
| 158 FX_BOOL hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 159 FX_BOOL highlight(IFXJS_Context* cc, | |
| 160 CJS_PropValue& vp, | |
| 161 CFX_WideString& sError); | |
| 162 FX_BOOL lineWidth(IFXJS_Context* cc, | |
| 163 CJS_PropValue& vp, | |
| 164 CFX_WideString& sError); | |
| 165 FX_BOOL multiline(IFXJS_Context* cc, | |
| 166 CJS_PropValue& vp, | |
| 167 CFX_WideString& sError); | |
| 168 FX_BOOL multipleSelection(IFXJS_Context* cc, | |
| 169 CJS_PropValue& vp, | |
| 170 CFX_WideString& sError); | |
| 171 FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 172 FX_BOOL numItems(IFXJS_Context* cc, | |
| 173 CJS_PropValue& vp, | |
| 174 CFX_WideString& sError); | |
| 175 FX_BOOL page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 176 FX_BOOL password(IFXJS_Context* cc, | |
| 177 CJS_PropValue& vp, | |
| 178 CFX_WideString& sError); | |
| 179 FX_BOOL print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 180 FX_BOOL radiosInUnison(IFXJS_Context* cc, | |
| 181 CJS_PropValue& vp, | |
| 182 CFX_WideString& sError); | |
| 183 FX_BOOL readonly(IFXJS_Context* cc, | |
| 184 CJS_PropValue& vp, | |
| 185 CFX_WideString& sError); | |
| 186 FX_BOOL rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 187 FX_BOOL required(IFXJS_Context* cc, | |
| 188 CJS_PropValue& vp, | |
| 189 CFX_WideString& sError); | |
| 190 FX_BOOL richText(IFXJS_Context* cc, | |
| 191 CJS_PropValue& vp, | |
| 192 CFX_WideString& sError); | |
| 193 FX_BOOL richValue(IFXJS_Context* cc, | |
| 194 CJS_PropValue& vp, | |
| 195 CFX_WideString& sError); | |
| 196 FX_BOOL rotation(IFXJS_Context* cc, | |
| 197 CJS_PropValue& vp, | |
| 198 CFX_WideString& sError); | |
| 199 FX_BOOL strokeColor(IFXJS_Context* cc, | |
| 200 CJS_PropValue& vp, | |
| 201 CFX_WideString& sError); | |
| 202 FX_BOOL style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 203 FX_BOOL submitName(IFXJS_Context* cc, | |
| 204 CJS_PropValue& vp, | |
| 205 CFX_WideString& sError); | |
| 206 FX_BOOL textColor(IFXJS_Context* cc, | |
| 207 CJS_PropValue& vp, | |
| 208 CFX_WideString& sError); | |
| 209 FX_BOOL textFont(IFXJS_Context* cc, | |
| 210 CJS_PropValue& vp, | |
| 211 CFX_WideString& sError); | |
| 212 FX_BOOL textSize(IFXJS_Context* cc, | |
| 213 CJS_PropValue& vp, | |
| 214 CFX_WideString& sError); | |
| 215 FX_BOOL type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 216 FX_BOOL userName(IFXJS_Context* cc, | |
| 217 CJS_PropValue& vp, | |
| 218 CFX_WideString& sError); | |
| 219 FX_BOOL value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 220 FX_BOOL valueAsString(IFXJS_Context* cc, | |
| 221 CJS_PropValue& vp, | |
| 222 CFX_WideString& sError); | |
| 223 FX_BOOL source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 224 | |
| 225 FX_BOOL browseForFileToSubmit(IFXJS_Context* cc, | |
| 226 const CJS_Parameters& params, | |
| 227 CJS_Value& vRet, | |
| 228 CFX_WideString& sError); | |
| 229 FX_BOOL buttonGetCaption(IFXJS_Context* cc, | |
| 230 const CJS_Parameters& params, | |
| 231 CJS_Value& vRet, | |
| 232 CFX_WideString& sError); | |
| 233 FX_BOOL buttonGetIcon(IFXJS_Context* cc, | |
| 234 const CJS_Parameters& params, | |
| 235 CJS_Value& vRet, | |
| 236 CFX_WideString& sError); | |
| 237 FX_BOOL buttonImportIcon(IFXJS_Context* cc, | |
| 238 const CJS_Parameters& params, | |
| 239 CJS_Value& vRet, | |
| 240 CFX_WideString& sError); | |
| 241 FX_BOOL buttonSetCaption(IFXJS_Context* cc, | |
| 242 const CJS_Parameters& params, | |
| 243 CJS_Value& vRet, | |
| 244 CFX_WideString& sError); | |
| 245 FX_BOOL buttonSetIcon(IFXJS_Context* cc, | |
| 246 const CJS_Parameters& params, | |
| 247 CJS_Value& vRet, | |
| 248 CFX_WideString& sError); | |
| 249 FX_BOOL checkThisBox(IFXJS_Context* cc, | |
| 250 const CJS_Parameters& params, | |
| 251 CJS_Value& vRet, | |
| 252 CFX_WideString& sError); | |
| 253 FX_BOOL clearItems(IFXJS_Context* cc, | |
| 254 const CJS_Parameters& params, | |
| 255 CJS_Value& vRet, | |
| 256 CFX_WideString& sError); | |
| 257 FX_BOOL defaultIsChecked(IFXJS_Context* cc, | |
| 258 const CJS_Parameters& params, | |
| 259 CJS_Value& vRet, | |
| 260 CFX_WideString& sError); | |
| 261 FX_BOOL deleteItemAt(IFXJS_Context* cc, | |
| 262 const CJS_Parameters& params, | |
| 263 CJS_Value& vRet, | |
| 264 CFX_WideString& sError); | |
| 265 FX_BOOL getArray(IFXJS_Context* cc, | |
| 266 const CJS_Parameters& params, | |
| 267 CJS_Value& vRet, | |
| 268 CFX_WideString& sError); | |
| 269 FX_BOOL getItemAt(IFXJS_Context* cc, | |
| 270 const CJS_Parameters& params, | |
| 271 CJS_Value& vRet, | |
| 272 CFX_WideString& sError); | |
| 273 FX_BOOL getLock(IFXJS_Context* cc, | |
| 274 const CJS_Parameters& params, | |
| 275 CJS_Value& vRet, | |
| 276 CFX_WideString& sError); | |
| 277 FX_BOOL insertItemAt(IFXJS_Context* cc, | |
| 278 const CJS_Parameters& params, | |
| 279 CJS_Value& vRet, | |
| 280 CFX_WideString& sError); | |
| 281 FX_BOOL isBoxChecked(IFXJS_Context* cc, | |
| 282 const CJS_Parameters& params, | |
| 283 CJS_Value& vRet, | |
| 284 CFX_WideString& sError); | |
| 285 FX_BOOL isDefaultChecked(IFXJS_Context* cc, | |
| 286 const CJS_Parameters& params, | |
| 287 CJS_Value& vRet, | |
| 288 CFX_WideString& sError); | |
| 289 FX_BOOL setAction(IFXJS_Context* cc, | |
| 290 const CJS_Parameters& params, | |
| 291 CJS_Value& vRet, | |
| 292 CFX_WideString& sError); | |
| 293 FX_BOOL setFocus(IFXJS_Context* cc, | |
| 294 const CJS_Parameters& params, | |
| 295 CJS_Value& vRet, | |
| 296 CFX_WideString& sError); | |
| 297 FX_BOOL setItems(IFXJS_Context* cc, | |
| 298 const CJS_Parameters& params, | |
| 299 CJS_Value& vRet, | |
| 300 CFX_WideString& sError); | |
| 301 FX_BOOL setLock(IFXJS_Context* cc, | |
| 302 const CJS_Parameters& params, | |
| 303 CJS_Value& vRet, | |
| 304 CFX_WideString& sError); | |
| 305 FX_BOOL signatureGetModifications(IFXJS_Context* cc, | |
| 306 const CJS_Parameters& params, | |
| 307 CJS_Value& vRet, | |
| 308 CFX_WideString& sError); | |
| 309 FX_BOOL signatureGetSeedValue(IFXJS_Context* cc, | |
| 310 const CJS_Parameters& params, | |
| 311 CJS_Value& vRet, | |
| 312 CFX_WideString& sError); | |
| 313 FX_BOOL signatureInfo(IFXJS_Context* cc, | |
| 314 const CJS_Parameters& params, | |
| 315 CJS_Value& vRet, | |
| 316 CFX_WideString& sError); | |
| 317 FX_BOOL signatureSetSeedValue(IFXJS_Context* cc, | |
| 318 const CJS_Parameters& params, | |
| 319 CJS_Value& vRet, | |
| 320 CFX_WideString& sError); | |
| 321 FX_BOOL signatureSign(IFXJS_Context* cc, | |
| 322 const CJS_Parameters& params, | |
| 323 CJS_Value& vRet, | |
| 324 CFX_WideString& sError); | |
| 325 FX_BOOL signatureValidate(IFXJS_Context* cc, | |
| 326 const CJS_Parameters& params, | |
| 327 CJS_Value& vRet, | |
| 328 CFX_WideString& sError); | |
| 329 | |
| 330 public: | |
| 331 static void SetAlignment(CPDFSDK_Document* pDocument, | |
| 332 const CFX_WideString& swFieldName, | |
| 333 int nControlIndex, | |
| 334 const CFX_ByteString& string); | |
| 335 static void SetBorderStyle(CPDFSDK_Document* pDocument, | |
| 336 const CFX_WideString& swFieldName, | |
| 337 int nControlIndex, | |
| 338 const CFX_ByteString& string); | |
| 339 static void SetButtonAlignX(CPDFSDK_Document* pDocument, | |
| 340 const CFX_WideString& swFieldName, | |
| 341 int nControlIndex, | |
| 342 int number); | |
| 343 static void SetButtonAlignY(CPDFSDK_Document* pDocument, | |
| 344 const CFX_WideString& swFieldName, | |
| 345 int nControlIndex, | |
| 346 int number); | |
| 347 static void SetButtonFitBounds(CPDFSDK_Document* pDocument, | |
| 348 const CFX_WideString& swFieldName, | |
| 349 int nControlIndex, | |
| 350 bool b); | |
| 351 static void SetButtonPosition(CPDFSDK_Document* pDocument, | |
| 352 const CFX_WideString& swFieldName, | |
| 353 int nControlIndex, | |
| 354 int number); | |
| 355 static void SetButtonScaleHow(CPDFSDK_Document* pDocument, | |
| 356 const CFX_WideString& swFieldName, | |
| 357 int nControlIndex, | |
| 358 int number); | |
| 359 static void SetButtonScaleWhen(CPDFSDK_Document* pDocument, | |
| 360 const CFX_WideString& swFieldName, | |
| 361 int nControlIndex, | |
| 362 int number); | |
| 363 static void SetCalcOrderIndex(CPDFSDK_Document* pDocument, | |
| 364 const CFX_WideString& swFieldName, | |
| 365 int nControlIndex, | |
| 366 int number); | |
| 367 static void SetCharLimit(CPDFSDK_Document* pDocument, | |
| 368 const CFX_WideString& swFieldName, | |
| 369 int nControlIndex, | |
| 370 int number); | |
| 371 static void SetComb(CPDFSDK_Document* pDocument, | |
| 372 const CFX_WideString& swFieldName, | |
| 373 int nControlIndex, | |
| 374 bool b); | |
| 375 static void SetCommitOnSelChange(CPDFSDK_Document* pDocument, | |
| 376 const CFX_WideString& swFieldName, | |
| 377 int nControlIndex, | |
| 378 bool b); | |
| 379 static void SetCurrentValueIndices(CPDFSDK_Document* pDocument, | |
| 380 const CFX_WideString& swFieldName, | |
| 381 int nControlIndex, | |
| 382 const CFX_DWordArray& array); | |
| 383 static void SetDefaultStyle(CPDFSDK_Document* pDocument, | |
| 384 const CFX_WideString& swFieldName, | |
| 385 int nControlIndex); | |
| 386 static void SetDefaultValue(CPDFSDK_Document* pDocument, | |
| 387 const CFX_WideString& swFieldName, | |
| 388 int nControlIndex, | |
| 389 const CFX_WideString& string); | |
| 390 static void SetDoNotScroll(CPDFSDK_Document* pDocument, | |
| 391 const CFX_WideString& swFieldName, | |
| 392 int nControlIndex, | |
| 393 bool b); | |
| 394 static void SetDisplay(CPDFSDK_Document* pDocument, | |
| 395 const CFX_WideString& swFieldName, | |
| 396 int nControlIndex, | |
| 397 int number); | |
| 398 static void SetFillColor(CPDFSDK_Document* pDocument, | |
| 399 const CFX_WideString& swFieldName, | |
| 400 int nControlIndex, | |
| 401 const CPWL_Color& color); | |
| 402 static void SetHidden(CPDFSDK_Document* pDocument, | |
| 403 const CFX_WideString& swFieldName, | |
| 404 int nControlIndex, | |
| 405 bool b); | |
| 406 static void SetHighlight(CPDFSDK_Document* pDocument, | |
| 407 const CFX_WideString& swFieldName, | |
| 408 int nControlIndex, | |
| 409 const CFX_ByteString& string); | |
| 410 static void SetLineWidth(CPDFSDK_Document* pDocument, | |
| 411 const CFX_WideString& swFieldName, | |
| 412 int nControlIndex, | |
| 413 int number); | |
| 414 static void SetMultiline(CPDFSDK_Document* pDocument, | |
| 415 const CFX_WideString& swFieldName, | |
| 416 int nControlIndex, | |
| 417 bool b); | |
| 418 static void SetMultipleSelection(CPDFSDK_Document* pDocument, | |
| 419 const CFX_WideString& swFieldName, | |
| 420 int nControlIndex, | |
| 421 bool b); | |
| 422 static void SetPassword(CPDFSDK_Document* pDocument, | |
| 423 const CFX_WideString& swFieldName, | |
| 424 int nControlIndex, | |
| 425 bool b); | |
| 426 static void SetRect(CPDFSDK_Document* pDocument, | |
| 427 const CFX_WideString& swFieldName, | |
| 428 int nControlIndex, | |
| 429 const CPDF_Rect& rect); | |
| 430 static void SetRichText(CPDFSDK_Document* pDocument, | |
| 431 const CFX_WideString& swFieldName, | |
| 432 int nControlIndex, | |
| 433 bool b); | |
| 434 static void SetRichValue(CPDFSDK_Document* pDocument, | |
| 435 const CFX_WideString& swFieldName, | |
| 436 int nControlIndex); | |
| 437 static void SetRotation(CPDFSDK_Document* pDocument, | |
| 438 const CFX_WideString& swFieldName, | |
| 439 int nControlIndex, | |
| 440 int number); | |
| 441 static void SetStrokeColor(CPDFSDK_Document* pDocument, | |
| 442 const CFX_WideString& swFieldName, | |
| 443 int nControlIndex, | |
| 444 const CPWL_Color& color); | |
| 445 static void SetStyle(CPDFSDK_Document* pDocument, | |
| 446 const CFX_WideString& swFieldName, | |
| 447 int nControlIndex, | |
| 448 const CFX_ByteString& string); | |
| 449 static void SetTextColor(CPDFSDK_Document* pDocument, | |
| 450 const CFX_WideString& swFieldName, | |
| 451 int nControlIndex, | |
| 452 const CPWL_Color& color); | |
| 453 static void SetTextFont(CPDFSDK_Document* pDocument, | |
| 454 const CFX_WideString& swFieldName, | |
| 455 int nControlIndex, | |
| 456 const CFX_ByteString& string); | |
| 457 static void SetTextSize(CPDFSDK_Document* pDocument, | |
| 458 const CFX_WideString& swFieldName, | |
| 459 int nControlIndex, | |
| 460 int number); | |
| 461 static void SetUserName(CPDFSDK_Document* pDocument, | |
| 462 const CFX_WideString& swFieldName, | |
| 463 int nControlIndex, | |
| 464 const CFX_WideString& string); | |
| 465 static void SetValue(CPDFSDK_Document* pDocument, | |
| 466 const CFX_WideString& swFieldName, | |
| 467 int nControlIndex, | |
| 468 const CJS_WideStringArray& strArray); | |
| 469 | |
| 470 public: | |
| 471 static void AddField(CPDFSDK_Document* pDocument, | |
| 472 int nPageIndex, | |
| 473 int nFieldType, | |
| 474 const CFX_WideString& sName, | |
| 475 const CPDF_Rect& rcCoords); | |
| 476 | |
| 477 public: | |
| 478 static void UpdateFormField(CPDFSDK_Document* pDocument, | |
| 479 CPDF_FormField* pFormField, | |
| 480 FX_BOOL bChangeMark, | |
| 481 FX_BOOL bResetAP, | |
| 482 FX_BOOL bRefresh); | |
| 483 static void UpdateFormControl(CPDFSDK_Document* pDocument, | |
| 484 CPDF_FormControl* pFormControl, | |
| 485 FX_BOOL bChangeMark, | |
| 486 FX_BOOL bResetAP, | |
| 487 FX_BOOL bRefresh); | |
| 488 | |
| 489 static CPDFSDK_Widget* GetWidget(CPDFSDK_Document* pDocument, | |
| 490 CPDF_FormControl* pFormControl); | |
| 491 static void GetFormFields(CPDFSDK_Document* pDocument, | |
| 492 const CFX_WideString& csFieldName, | |
| 493 CFX_PtrArray& FieldsArray); | |
| 494 | |
| 495 static void DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData); | |
| 496 | |
| 497 public: | |
| 498 FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName); | |
| 499 void SetDelay(FX_BOOL bDelay); | |
| 500 void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; } | |
| 501 | |
| 502 protected: | |
| 503 void ParseFieldName(const std::wstring& strFieldNameParsed, | |
| 504 std::wstring& strFieldName, | |
| 505 int& iControlNo); | |
| 506 void GetFormFields(const CFX_WideString& csFieldName, | |
| 507 CFX_PtrArray& FieldsArray); | |
| 508 CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField); | |
| 509 FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel); | |
| 510 | |
| 511 void AddDelay_Int(enum FIELD_PROP prop, int32_t n); | |
| 512 void AddDelay_Bool(enum FIELD_PROP prop, bool b); | |
| 513 void AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string); | |
| 514 void AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string); | |
| 515 void AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect); | |
| 516 void AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color); | |
| 517 void AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array); | |
| 518 void AddDelay_WideStringArray(enum FIELD_PROP prop, | |
| 519 const CJS_WideStringArray& array); | |
| 520 | |
| 521 void DoDelay(); | |
| 522 | |
| 523 public: | |
| 524 Document* m_pJSDoc; | |
| 525 CPDFSDK_Document* m_pDocument; | |
| 526 CFX_WideString m_FieldName; | |
| 527 int m_nFormControlIndex; | |
| 528 FX_BOOL m_bCanSet; | |
| 529 | |
| 530 FX_BOOL m_bDelay; | |
| 531 v8::Isolate* m_isolate; | |
| 532 }; | |
| 533 | |
| 534 class CJS_Field : public CJS_Object { | |
| 535 public: | |
| 536 CJS_Field(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} | |
| 537 ~CJS_Field(void) override {} | |
| 538 | |
| 539 FX_BOOL InitInstance(IFXJS_Context* cc) override; | |
| 540 | |
| 541 DECLARE_JS_CLASS(CJS_Field); | |
| 542 | |
| 543 JS_STATIC_PROP(alignment, Field); | |
| 544 JS_STATIC_PROP(borderStyle, Field); | |
| 545 JS_STATIC_PROP(buttonAlignX, Field); | |
| 546 JS_STATIC_PROP(buttonAlignY, Field); | |
| 547 JS_STATIC_PROP(buttonFitBounds, Field); | |
| 548 JS_STATIC_PROP(buttonPosition, Field); | |
| 549 JS_STATIC_PROP(buttonScaleHow, Field); | |
| 550 JS_STATIC_PROP(buttonScaleWhen, Field); | |
| 551 JS_STATIC_PROP(calcOrderIndex, Field); | |
| 552 JS_STATIC_PROP(charLimit, Field); | |
| 553 JS_STATIC_PROP(comb, Field); | |
| 554 JS_STATIC_PROP(commitOnSelChange, Field); | |
| 555 JS_STATIC_PROP(currentValueIndices, Field); | |
| 556 JS_STATIC_PROP(defaultStyle, Field); | |
| 557 JS_STATIC_PROP(defaultValue, Field); | |
| 558 JS_STATIC_PROP(doNotScroll, Field); | |
| 559 JS_STATIC_PROP(doNotSpellCheck, Field); | |
| 560 JS_STATIC_PROP(delay, Field); | |
| 561 JS_STATIC_PROP(display, Field); | |
| 562 JS_STATIC_PROP(doc, Field); | |
| 563 JS_STATIC_PROP(editable, Field); | |
| 564 JS_STATIC_PROP(exportValues, Field); | |
| 565 JS_STATIC_PROP(fileSelect, Field); | |
| 566 JS_STATIC_PROP(fillColor, Field); | |
| 567 JS_STATIC_PROP(hidden, Field); | |
| 568 JS_STATIC_PROP(highlight, Field); | |
| 569 JS_STATIC_PROP(lineWidth, Field); | |
| 570 JS_STATIC_PROP(multiline, Field); | |
| 571 JS_STATIC_PROP(multipleSelection, Field); | |
| 572 JS_STATIC_PROP(name, Field); | |
| 573 JS_STATIC_PROP(numItems, Field); | |
| 574 JS_STATIC_PROP(page, Field); | |
| 575 JS_STATIC_PROP(password, Field); | |
| 576 JS_STATIC_PROP(print, Field); | |
| 577 JS_STATIC_PROP(radiosInUnison, Field); | |
| 578 JS_STATIC_PROP(readonly, Field); | |
| 579 JS_STATIC_PROP(rect, Field); | |
| 580 JS_STATIC_PROP(required, Field); | |
| 581 JS_STATIC_PROP(richText, Field); | |
| 582 JS_STATIC_PROP(richValue, Field); | |
| 583 JS_STATIC_PROP(rotation, Field); | |
| 584 JS_STATIC_PROP(strokeColor, Field); | |
| 585 JS_STATIC_PROP(style, Field); | |
| 586 JS_STATIC_PROP(submitName, Field); | |
| 587 JS_STATIC_PROP(textColor, Field); | |
| 588 JS_STATIC_PROP(textFont, Field); | |
| 589 JS_STATIC_PROP(textSize, Field); | |
| 590 JS_STATIC_PROP(type, Field); | |
| 591 JS_STATIC_PROP(userName, Field); | |
| 592 JS_STATIC_PROP(value, Field); | |
| 593 JS_STATIC_PROP(valueAsString, Field); | |
| 594 JS_STATIC_PROP(source, Field); | |
| 595 | |
| 596 JS_STATIC_METHOD(browseForFileToSubmit, Field); | |
| 597 JS_STATIC_METHOD(buttonGetCaption, Field); | |
| 598 JS_STATIC_METHOD(buttonGetIcon, Field); | |
| 599 JS_STATIC_METHOD(buttonImportIcon, Field); | |
| 600 JS_STATIC_METHOD(buttonSetCaption, Field); | |
| 601 JS_STATIC_METHOD(buttonSetIcon, Field); | |
| 602 JS_STATIC_METHOD(checkThisBox, Field); | |
| 603 JS_STATIC_METHOD(clearItems, Field); | |
| 604 JS_STATIC_METHOD(defaultIsChecked, Field); | |
| 605 JS_STATIC_METHOD(deleteItemAt, Field); | |
| 606 JS_STATIC_METHOD(getArray, Field); | |
| 607 JS_STATIC_METHOD(getItemAt, Field); | |
| 608 JS_STATIC_METHOD(getLock, Field); | |
| 609 JS_STATIC_METHOD(insertItemAt, Field); | |
| 610 JS_STATIC_METHOD(isBoxChecked, Field); | |
| 611 JS_STATIC_METHOD(isDefaultChecked, Field); | |
| 612 JS_STATIC_METHOD(setAction, Field); | |
| 613 JS_STATIC_METHOD(setFocus, Field); | |
| 614 JS_STATIC_METHOD(setItems, Field); | |
| 615 JS_STATIC_METHOD(setLock, Field); | |
| 616 JS_STATIC_METHOD(signatureGetModifications, Field); | |
| 617 JS_STATIC_METHOD(signatureGetSeedValue, Field); | |
| 618 JS_STATIC_METHOD(signatureInfo, Field); | |
| 619 JS_STATIC_METHOD(signatureSetSeedValue, Field); | |
| 620 JS_STATIC_METHOD(signatureSign, Field); | |
| 621 JS_STATIC_METHOD(signatureValidate, Field); | |
| 622 }; | |
| 623 | |
| 624 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_FIELD_H_ | |
| OLD | NEW |