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