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