OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_PUBLICMETHODS_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_PUBLICMETHODS_H_ |
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_PUBLICMETHODS_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_PUBLICMETHODS_H_ |
9 | 9 |
10 #include "JS_Define.h" | 10 #include "JS_Define.h" |
11 | 11 |
12 class CJS_PublicMethods : public CJS_Object | 12 class CJS_PublicMethods : public CJS_Object { |
13 { | 13 public: |
14 public: | 14 CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject){}; |
15 » CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject) {}; | 15 virtual ~CJS_PublicMethods(void){}; |
16 » virtual ~CJS_PublicMethods(void){}; | |
17 | 16 |
18 public: | 17 public: |
19 » static FX_BOOL AFNumber_Format(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, CFX_WideString& sError); | 18 static FX_BOOL AFNumber_Format(IFXJS_Context* cc, |
20 » static FX_BOOL AFNumber_Keystroke(IFXJS_Context* cc, const CJS_Parameter
s& params, CJS_Value& vRet, CFX_WideString& sError); | 19 const CJS_Parameters& params, |
21 » static FX_BOOL AFPercent_Format(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, CFX_WideString& sError); | 20 CJS_Value& vRet, |
22 » static FX_BOOL AFPercent_Keystroke(IFXJS_Context* cc, const CJS_Paramete
rs& params, CJS_Value& vRet, CFX_WideString& sError); | 21 CFX_WideString& sError); |
23 » static FX_BOOL AFDate_FormatEx(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, CFX_WideString& sError); | 22 static FX_BOOL AFNumber_Keystroke(IFXJS_Context* cc, |
24 » static FX_BOOL AFDate_KeystrokeEx(IFXJS_Context* cc, const CJS_Parameter
s& params, CJS_Value& vRet, CFX_WideString& sError); | 23 const CJS_Parameters& params, |
25 » static FX_BOOL AFDate_Format(IFXJS_Context* cc, const CJS_Parameters& pa
rams, CJS_Value& vRet, CFX_WideString& sError); | 24 CJS_Value& vRet, |
26 » static FX_BOOL AFDate_Keystroke(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, CFX_WideString& sError); | 25 CFX_WideString& sError); |
27 » static FX_BOOL AFTime_FormatEx(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, CFX_WideString& sError); // | 26 static FX_BOOL AFPercent_Format(IFXJS_Context* cc, |
28 » static FX_BOOL AFTime_KeystrokeEx(IFXJS_Context* cc, const CJS_Parameter
s& params, CJS_Value& vRet, CFX_WideString& sError); | 27 const CJS_Parameters& params, |
29 » static FX_BOOL AFTime_Format(IFXJS_Context* cc, const CJS_Parameters& pa
rams, CJS_Value& vRet, CFX_WideString& sError); | 28 CJS_Value& vRet, |
30 » static FX_BOOL AFTime_Keystroke(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, CFX_WideString& sError); | 29 CFX_WideString& sError); |
31 » static FX_BOOL AFSpecial_Format(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, CFX_WideString& sError); | 30 static FX_BOOL AFPercent_Keystroke(IFXJS_Context* cc, |
32 » static FX_BOOL AFSpecial_Keystroke(IFXJS_Context* cc, const CJS_Paramete
rs& params, CJS_Value& vRet, CFX_WideString& sError); | 31 const CJS_Parameters& params, |
33 » static FX_BOOL AFSpecial_KeystrokeEx(IFXJS_Context* cc, const CJS_Parame
ters& params, CJS_Value& vRet, CFX_WideString& sError);// | 32 CJS_Value& vRet, |
34 » static FX_BOOL AFSimple(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError); | 33 CFX_WideString& sError); |
35 » static FX_BOOL AFMakeNumber(IFXJS_Context* cc, const CJS_Parameters& par
ams, CJS_Value& vRet, CFX_WideString& sError); | 34 static FX_BOOL AFDate_FormatEx(IFXJS_Context* cc, |
36 » static FX_BOOL AFSimple_Calculate(IFXJS_Context* cc, const CJS_Parameter
s& params, CJS_Value& vRet, CFX_WideString& sError); | 35 const CJS_Parameters& params, |
37 » static FX_BOOL AFRange_Validate(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, CFX_WideString& sError); | 36 CJS_Value& vRet, |
38 » static FX_BOOL AFMergeChange(IFXJS_Context* cc, const CJS_Parameters& pa
rams, CJS_Value& vRet, CFX_WideString& sError); | 37 CFX_WideString& sError); |
39 » static FX_BOOL AFParseDateEx(IFXJS_Context* cc, const CJS_Parameters& pa
rams, CJS_Value& vRet, CFX_WideString& sError); | 38 static FX_BOOL AFDate_KeystrokeEx(IFXJS_Context* cc, |
40 » static FX_BOOL AFExtractNums(IFXJS_Context* cc, const CJS_Parameters& pa
rams, CJS_Value& vRet, CFX_WideString& sError); | 39 const CJS_Parameters& params, |
| 40 CJS_Value& vRet, |
| 41 CFX_WideString& sError); |
| 42 static FX_BOOL AFDate_Format(IFXJS_Context* cc, |
| 43 const CJS_Parameters& params, |
| 44 CJS_Value& vRet, |
| 45 CFX_WideString& sError); |
| 46 static FX_BOOL AFDate_Keystroke(IFXJS_Context* cc, |
| 47 const CJS_Parameters& params, |
| 48 CJS_Value& vRet, |
| 49 CFX_WideString& sError); |
| 50 static FX_BOOL AFTime_FormatEx(IFXJS_Context* cc, |
| 51 const CJS_Parameters& params, |
| 52 CJS_Value& vRet, |
| 53 CFX_WideString& sError); // |
| 54 static FX_BOOL AFTime_KeystrokeEx(IFXJS_Context* cc, |
| 55 const CJS_Parameters& params, |
| 56 CJS_Value& vRet, |
| 57 CFX_WideString& sError); |
| 58 static FX_BOOL AFTime_Format(IFXJS_Context* cc, |
| 59 const CJS_Parameters& params, |
| 60 CJS_Value& vRet, |
| 61 CFX_WideString& sError); |
| 62 static FX_BOOL AFTime_Keystroke(IFXJS_Context* cc, |
| 63 const CJS_Parameters& params, |
| 64 CJS_Value& vRet, |
| 65 CFX_WideString& sError); |
| 66 static FX_BOOL AFSpecial_Format(IFXJS_Context* cc, |
| 67 const CJS_Parameters& params, |
| 68 CJS_Value& vRet, |
| 69 CFX_WideString& sError); |
| 70 static FX_BOOL AFSpecial_Keystroke(IFXJS_Context* cc, |
| 71 const CJS_Parameters& params, |
| 72 CJS_Value& vRet, |
| 73 CFX_WideString& sError); |
| 74 static FX_BOOL AFSpecial_KeystrokeEx(IFXJS_Context* cc, |
| 75 const CJS_Parameters& params, |
| 76 CJS_Value& vRet, |
| 77 CFX_WideString& sError); // |
| 78 static FX_BOOL AFSimple(IFXJS_Context* cc, |
| 79 const CJS_Parameters& params, |
| 80 CJS_Value& vRet, |
| 81 CFX_WideString& sError); |
| 82 static FX_BOOL AFMakeNumber(IFXJS_Context* cc, |
| 83 const CJS_Parameters& params, |
| 84 CJS_Value& vRet, |
| 85 CFX_WideString& sError); |
| 86 static FX_BOOL AFSimple_Calculate(IFXJS_Context* cc, |
| 87 const CJS_Parameters& params, |
| 88 CJS_Value& vRet, |
| 89 CFX_WideString& sError); |
| 90 static FX_BOOL AFRange_Validate(IFXJS_Context* cc, |
| 91 const CJS_Parameters& params, |
| 92 CJS_Value& vRet, |
| 93 CFX_WideString& sError); |
| 94 static FX_BOOL AFMergeChange(IFXJS_Context* cc, |
| 95 const CJS_Parameters& params, |
| 96 CJS_Value& vRet, |
| 97 CFX_WideString& sError); |
| 98 static FX_BOOL AFParseDateEx(IFXJS_Context* cc, |
| 99 const CJS_Parameters& params, |
| 100 CJS_Value& vRet, |
| 101 CFX_WideString& sError); |
| 102 static FX_BOOL AFExtractNums(IFXJS_Context* cc, |
| 103 const CJS_Parameters& params, |
| 104 CJS_Value& vRet, |
| 105 CFX_WideString& sError); |
41 | 106 |
42 public: | 107 public: |
43 » JS_STATIC_GLOBAL_FUN(AFNumber_Format); | 108 JS_STATIC_GLOBAL_FUN(AFNumber_Format); |
44 » JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke); | 109 JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke); |
45 » JS_STATIC_GLOBAL_FUN(AFPercent_Format); | 110 JS_STATIC_GLOBAL_FUN(AFPercent_Format); |
46 » JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke); | 111 JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke); |
47 » JS_STATIC_GLOBAL_FUN(AFDate_FormatEx); | 112 JS_STATIC_GLOBAL_FUN(AFDate_FormatEx); |
48 » JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx); | 113 JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx); |
49 » JS_STATIC_GLOBAL_FUN(AFDate_Format); | 114 JS_STATIC_GLOBAL_FUN(AFDate_Format); |
50 » JS_STATIC_GLOBAL_FUN(AFDate_Keystroke); | 115 JS_STATIC_GLOBAL_FUN(AFDate_Keystroke); |
51 » JS_STATIC_GLOBAL_FUN(AFTime_FormatEx); | 116 JS_STATIC_GLOBAL_FUN(AFTime_FormatEx); |
52 » JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx); | 117 JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx); |
53 » JS_STATIC_GLOBAL_FUN(AFTime_Format); | 118 JS_STATIC_GLOBAL_FUN(AFTime_Format); |
54 » JS_STATIC_GLOBAL_FUN(AFTime_Keystroke); | 119 JS_STATIC_GLOBAL_FUN(AFTime_Keystroke); |
55 » JS_STATIC_GLOBAL_FUN(AFSpecial_Format); | 120 JS_STATIC_GLOBAL_FUN(AFSpecial_Format); |
56 » JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke); | 121 JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke); |
57 » JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx); | 122 JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx); |
58 » JS_STATIC_GLOBAL_FUN(AFSimple); | 123 JS_STATIC_GLOBAL_FUN(AFSimple); |
59 » JS_STATIC_GLOBAL_FUN(AFMakeNumber); | 124 JS_STATIC_GLOBAL_FUN(AFMakeNumber); |
60 » JS_STATIC_GLOBAL_FUN(AFSimple_Calculate); | 125 JS_STATIC_GLOBAL_FUN(AFSimple_Calculate); |
61 » JS_STATIC_GLOBAL_FUN(AFRange_Validate); | 126 JS_STATIC_GLOBAL_FUN(AFRange_Validate); |
62 » JS_STATIC_GLOBAL_FUN(AFMergeChange); | 127 JS_STATIC_GLOBAL_FUN(AFMergeChange); |
63 » JS_STATIC_GLOBAL_FUN(AFParseDateEx); | 128 JS_STATIC_GLOBAL_FUN(AFParseDateEx); |
64 » JS_STATIC_GLOBAL_FUN(AFExtractNums); | 129 JS_STATIC_GLOBAL_FUN(AFExtractNums); |
65 | 130 |
66 » JS_STATIC_DECLARE_GLOBAL_FUN(); | 131 JS_STATIC_DECLARE_GLOBAL_FUN(); |
67 | 132 |
68 public: | 133 public: |
69 » static int» » » » ParseStringInteger(const CFX_Wid
eString & string,int nStart,int & nSkip, int nMaxStep); | 134 static int ParseStringInteger(const CFX_WideString& string, |
70 » static CFX_WideString» ParseStringString(const CFX_WideString& string,
int nStart, int& nSkip); | 135 int nStart, |
71 » static double» » » MakeRegularDate(const CFX_WideString & v
alue,const CFX_WideString & format, FX_BOOL& bWrongFormat); | 136 int& nSkip, |
72 » static CFX_WideString» MakeFormatDate(double dDate,const CFX_WideString
& format); | 137 int nMaxStep); |
73 » static FX_BOOL» » » ConvertStringToNumber(const FX_WCHAR* sw
Source, double & dRet, FX_BOOL & bDot); | 138 static CFX_WideString ParseStringString(const CFX_WideString& string, |
74 » static double» » » ParseStringToNumber(const FX_WCHAR* swSo
urce); | 139 int nStart, |
75 » static double» » » ParseNormalDate(const CFX_WideString & v
alue, FX_BOOL& bWrongFormat); | 140 int& nSkip); |
76 » static double MakeInterDate(CFX_WideString strValue); | 141 static double MakeRegularDate(const CFX_WideString& value, |
77 » static double» » » ParseNumber(const FX_WCHAR* swSource, FX
_BOOL& bAllDigits, FX_BOOL& bDot, FX_BOOL& bSign, FX_BOOL& bKXJS); | 142 const CFX_WideString& format, |
| 143 FX_BOOL& bWrongFormat); |
| 144 static CFX_WideString MakeFormatDate(double dDate, |
| 145 const CFX_WideString& format); |
| 146 static FX_BOOL ConvertStringToNumber(const FX_WCHAR* swSource, |
| 147 double& dRet, |
| 148 FX_BOOL& bDot); |
| 149 static double ParseStringToNumber(const FX_WCHAR* swSource); |
| 150 static double ParseNormalDate(const CFX_WideString& value, |
| 151 FX_BOOL& bWrongFormat); |
| 152 static double MakeInterDate(CFX_WideString strValue); |
| 153 static double ParseNumber(const FX_WCHAR* swSource, |
| 154 FX_BOOL& bAllDigits, |
| 155 FX_BOOL& bDot, |
| 156 FX_BOOL& bSign, |
| 157 FX_BOOL& bKXJS); |
78 | 158 |
79 public: | 159 public: |
80 » static CFX_WideString» StrLTrim(const FX_WCHAR* pStr); | 160 static CFX_WideString StrLTrim(const FX_WCHAR* pStr); |
81 » static CFX_WideString» StrRTrim(const FX_WCHAR* pStr); | 161 static CFX_WideString StrRTrim(const FX_WCHAR* pStr); |
82 » static CFX_WideString» StrTrim(const FX_WCHAR* pStr); | 162 static CFX_WideString StrTrim(const FX_WCHAR* pStr); |
83 | 163 |
84 » static CFX_ByteString» StrLTrim(const FX_CHAR* pStr); | 164 static CFX_ByteString StrLTrim(const FX_CHAR* pStr); |
85 » static CFX_ByteString» StrRTrim(const FX_CHAR* pStr); | 165 static CFX_ByteString StrRTrim(const FX_CHAR* pStr); |
86 » static CFX_ByteString» StrTrim(const FX_CHAR* pStr); | 166 static CFX_ByteString StrTrim(const FX_CHAR* pStr); |
87 | 167 |
88 » static FX_BOOL» » » IsNumber(const FX_CHAR* string); | 168 static FX_BOOL IsNumber(const FX_CHAR* string); |
89 » static FX_BOOL» » » IsNumber(const FX_WCHAR* string); | 169 static FX_BOOL IsNumber(const FX_WCHAR* string); |
90 | 170 |
91 » static FX_BOOL» » » IsDigit(char ch); | 171 static FX_BOOL IsDigit(char ch); |
92 » static FX_BOOL» » » IsDigit(wchar_t ch); | 172 static FX_BOOL IsDigit(wchar_t ch); |
93 » static FX_BOOL» » » IsAlphabetic(wchar_t ch); | 173 static FX_BOOL IsAlphabetic(wchar_t ch); |
94 » static FX_BOOL» » » IsAlphaNumeric(wchar_t ch); | 174 static FX_BOOL IsAlphaNumeric(wchar_t ch); |
95 | 175 |
96 » static FX_BOOL» » » maskSatisfied(wchar_t c_Change,wchar_t c
_Mask); | 176 static FX_BOOL maskSatisfied(wchar_t c_Change, wchar_t c_Mask); |
97 » static FX_BOOL» » » isReservedMaskChar(wchar_t ch); | 177 static FX_BOOL isReservedMaskChar(wchar_t ch); |
98 | 178 |
99 » static double» » » AF_Simple(const FX_WCHAR* sFuction, doub
le dValue1, double dValue2); | 179 static double AF_Simple(const FX_WCHAR* sFuction, |
100 » static CJS_Array» » AF_MakeArrayFromList(v8::Isolate* isolat
e, CJS_Value val); | 180 double dValue1, |
| 181 double dValue2); |
| 182 static CJS_Array AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Value val); |
101 }; | 183 }; |
102 | 184 |
103 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_PUBLICMETHODS_H_ | 185 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_PUBLICMETHODS_H_ |
OLD | NEW |