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_JAVASCRIPT_PUBLICMETHODS_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_PUBLICMETHODS_H_ |
8 #define FPDFSDK_JAVASCRIPT_PUBLICMETHODS_H_ | 8 #define FPDFSDK_JAVASCRIPT_PUBLICMETHODS_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "fpdfsdk/javascript/JS_Define.h" | 13 #include "fpdfsdk/javascript/JS_Define.h" |
14 | 14 |
15 class CJS_PublicMethods : public CJS_Object { | 15 class CJS_PublicMethods : public CJS_Object { |
16 public: | 16 public: |
17 explicit CJS_PublicMethods(v8::Local<v8::Object> pObject) | 17 explicit CJS_PublicMethods(v8::Local<v8::Object> pObject) |
18 : CJS_Object(pObject) {} | 18 : CJS_Object(pObject) {} |
19 ~CJS_PublicMethods() override {} | 19 ~CJS_PublicMethods() override {} |
20 | 20 |
21 static FX_BOOL AFNumber_Format(IJS_Context* cc, | 21 static bool AFNumber_Format(IJS_Context* cc, |
| 22 const std::vector<CJS_Value>& params, |
| 23 CJS_Value& vRet, |
| 24 CFX_WideString& sError); |
| 25 static bool AFNumber_Keystroke(IJS_Context* cc, |
22 const std::vector<CJS_Value>& params, | 26 const std::vector<CJS_Value>& params, |
23 CJS_Value& vRet, | 27 CJS_Value& vRet, |
24 CFX_WideString& sError); | 28 CFX_WideString& sError); |
25 static FX_BOOL AFNumber_Keystroke(IJS_Context* cc, | 29 static bool AFPercent_Format(IJS_Context* cc, |
26 const std::vector<CJS_Value>& params, | 30 const std::vector<CJS_Value>& params, |
27 CJS_Value& vRet, | 31 CJS_Value& vRet, |
28 CFX_WideString& sError); | 32 CFX_WideString& sError); |
29 static FX_BOOL AFPercent_Format(IJS_Context* cc, | 33 static bool AFPercent_Keystroke(IJS_Context* cc, |
30 const std::vector<CJS_Value>& params, | 34 const std::vector<CJS_Value>& params, |
31 CJS_Value& vRet, | 35 CJS_Value& vRet, |
32 CFX_WideString& sError); | 36 CFX_WideString& sError); |
33 static FX_BOOL AFPercent_Keystroke(IJS_Context* cc, | 37 static bool AFDate_FormatEx(IJS_Context* cc, |
34 const std::vector<CJS_Value>& params, | 38 const std::vector<CJS_Value>& params, |
35 CJS_Value& vRet, | 39 CJS_Value& vRet, |
36 CFX_WideString& sError); | 40 CFX_WideString& sError); |
37 static FX_BOOL AFDate_FormatEx(IJS_Context* cc, | 41 static bool AFDate_KeystrokeEx(IJS_Context* cc, |
38 const std::vector<CJS_Value>& params, | 42 const std::vector<CJS_Value>& params, |
39 CJS_Value& vRet, | 43 CJS_Value& vRet, |
40 CFX_WideString& sError); | 44 CFX_WideString& sError); |
41 static FX_BOOL AFDate_KeystrokeEx(IJS_Context* cc, | 45 static bool AFDate_Format(IJS_Context* cc, |
42 const std::vector<CJS_Value>& params, | 46 const std::vector<CJS_Value>& params, |
43 CJS_Value& vRet, | 47 CJS_Value& vRet, |
44 CFX_WideString& sError); | 48 CFX_WideString& sError); |
45 static FX_BOOL AFDate_Format(IJS_Context* cc, | 49 static bool AFDate_Keystroke(IJS_Context* cc, |
46 const std::vector<CJS_Value>& params, | 50 const std::vector<CJS_Value>& params, |
47 CJS_Value& vRet, | 51 CJS_Value& vRet, |
48 CFX_WideString& sError); | 52 CFX_WideString& sError); |
49 static FX_BOOL AFDate_Keystroke(IJS_Context* cc, | 53 static bool AFTime_FormatEx(IJS_Context* cc, |
| 54 const std::vector<CJS_Value>& params, |
| 55 CJS_Value& vRet, |
| 56 CFX_WideString& sError); // |
| 57 static bool AFTime_KeystrokeEx(IJS_Context* cc, |
| 58 const std::vector<CJS_Value>& params, |
| 59 CJS_Value& vRet, |
| 60 CFX_WideString& sError); |
| 61 static bool AFTime_Format(IJS_Context* cc, |
| 62 const std::vector<CJS_Value>& params, |
| 63 CJS_Value& vRet, |
| 64 CFX_WideString& sError); |
| 65 static bool AFTime_Keystroke(IJS_Context* cc, |
| 66 const std::vector<CJS_Value>& params, |
| 67 CJS_Value& vRet, |
| 68 CFX_WideString& sError); |
| 69 static bool AFSpecial_Format(IJS_Context* cc, |
| 70 const std::vector<CJS_Value>& params, |
| 71 CJS_Value& vRet, |
| 72 CFX_WideString& sError); |
| 73 static bool AFSpecial_Keystroke(IJS_Context* cc, |
50 const std::vector<CJS_Value>& params, | 74 const std::vector<CJS_Value>& params, |
51 CJS_Value& vRet, | 75 CJS_Value& vRet, |
52 CFX_WideString& sError); | 76 CFX_WideString& sError); |
53 static FX_BOOL AFTime_FormatEx(IJS_Context* cc, | 77 static bool AFSpecial_KeystrokeEx(IJS_Context* cc, |
| 78 const std::vector<CJS_Value>& params, |
| 79 CJS_Value& vRet, |
| 80 CFX_WideString& sError); // |
| 81 static bool AFSimple(IJS_Context* cc, |
| 82 const std::vector<CJS_Value>& params, |
| 83 CJS_Value& vRet, |
| 84 CFX_WideString& sError); |
| 85 static bool AFMakeNumber(IJS_Context* cc, |
| 86 const std::vector<CJS_Value>& params, |
| 87 CJS_Value& vRet, |
| 88 CFX_WideString& sError); |
| 89 static bool AFSimple_Calculate(IJS_Context* cc, |
54 const std::vector<CJS_Value>& params, | 90 const std::vector<CJS_Value>& params, |
55 CJS_Value& vRet, | 91 CJS_Value& vRet, |
56 CFX_WideString& sError); // | 92 CFX_WideString& sError); |
57 static FX_BOOL AFTime_KeystrokeEx(IJS_Context* cc, | 93 static bool AFRange_Validate(IJS_Context* cc, |
58 const std::vector<CJS_Value>& params, | |
59 CJS_Value& vRet, | |
60 CFX_WideString& sError); | |
61 static FX_BOOL AFTime_Format(IJS_Context* cc, | |
62 const std::vector<CJS_Value>& params, | 94 const std::vector<CJS_Value>& params, |
63 CJS_Value& vRet, | 95 CJS_Value& vRet, |
64 CFX_WideString& sError); | 96 CFX_WideString& sError); |
65 static FX_BOOL AFTime_Keystroke(IJS_Context* cc, | 97 static bool AFMergeChange(IJS_Context* cc, |
66 const std::vector<CJS_Value>& params, | 98 const std::vector<CJS_Value>& params, |
67 CJS_Value& vRet, | 99 CJS_Value& vRet, |
68 CFX_WideString& sError); | 100 CFX_WideString& sError); |
69 static FX_BOOL AFSpecial_Format(IJS_Context* cc, | 101 static bool AFParseDateEx(IJS_Context* cc, |
70 const std::vector<CJS_Value>& params, | 102 const std::vector<CJS_Value>& params, |
71 CJS_Value& vRet, | 103 CJS_Value& vRet, |
72 CFX_WideString& sError); | 104 CFX_WideString& sError); |
73 static FX_BOOL AFSpecial_Keystroke(IJS_Context* cc, | 105 static bool AFExtractNums(IJS_Context* cc, |
74 const std::vector<CJS_Value>& params, | 106 const std::vector<CJS_Value>& params, |
75 CJS_Value& vRet, | 107 CJS_Value& vRet, |
76 CFX_WideString& sError); | 108 CFX_WideString& sError); |
77 static FX_BOOL AFSpecial_KeystrokeEx(IJS_Context* cc, | |
78 const std::vector<CJS_Value>& params, | |
79 CJS_Value& vRet, | |
80 CFX_WideString& sError); // | |
81 static FX_BOOL AFSimple(IJS_Context* cc, | |
82 const std::vector<CJS_Value>& params, | |
83 CJS_Value& vRet, | |
84 CFX_WideString& sError); | |
85 static FX_BOOL AFMakeNumber(IJS_Context* cc, | |
86 const std::vector<CJS_Value>& params, | |
87 CJS_Value& vRet, | |
88 CFX_WideString& sError); | |
89 static FX_BOOL AFSimple_Calculate(IJS_Context* cc, | |
90 const std::vector<CJS_Value>& params, | |
91 CJS_Value& vRet, | |
92 CFX_WideString& sError); | |
93 static FX_BOOL AFRange_Validate(IJS_Context* cc, | |
94 const std::vector<CJS_Value>& params, | |
95 CJS_Value& vRet, | |
96 CFX_WideString& sError); | |
97 static FX_BOOL AFMergeChange(IJS_Context* cc, | |
98 const std::vector<CJS_Value>& params, | |
99 CJS_Value& vRet, | |
100 CFX_WideString& sError); | |
101 static FX_BOOL AFParseDateEx(IJS_Context* cc, | |
102 const std::vector<CJS_Value>& params, | |
103 CJS_Value& vRet, | |
104 CFX_WideString& sError); | |
105 static FX_BOOL AFExtractNums(IJS_Context* cc, | |
106 const std::vector<CJS_Value>& params, | |
107 CJS_Value& vRet, | |
108 CFX_WideString& sError); | |
109 | 109 |
110 JS_STATIC_GLOBAL_FUN(AFNumber_Format); | 110 JS_STATIC_GLOBAL_FUN(AFNumber_Format); |
111 JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke); | 111 JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke); |
112 JS_STATIC_GLOBAL_FUN(AFPercent_Format); | 112 JS_STATIC_GLOBAL_FUN(AFPercent_Format); |
113 JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke); | 113 JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke); |
114 JS_STATIC_GLOBAL_FUN(AFDate_FormatEx); | 114 JS_STATIC_GLOBAL_FUN(AFDate_FormatEx); |
115 JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx); | 115 JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx); |
116 JS_STATIC_GLOBAL_FUN(AFDate_Format); | 116 JS_STATIC_GLOBAL_FUN(AFDate_Format); |
117 JS_STATIC_GLOBAL_FUN(AFDate_Keystroke); | 117 JS_STATIC_GLOBAL_FUN(AFDate_Keystroke); |
118 JS_STATIC_GLOBAL_FUN(AFTime_FormatEx); | 118 JS_STATIC_GLOBAL_FUN(AFTime_FormatEx); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 static bool maskSatisfied(wchar_t c_Change, wchar_t c_Mask); | 153 static bool maskSatisfied(wchar_t c_Change, wchar_t c_Mask); |
154 static bool isReservedMaskChar(wchar_t ch); | 154 static bool isReservedMaskChar(wchar_t ch); |
155 | 155 |
156 static double AF_Simple(const FX_WCHAR* sFuction, | 156 static double AF_Simple(const FX_WCHAR* sFuction, |
157 double dValue1, | 157 double dValue1, |
158 double dValue2); | 158 double dValue2); |
159 static CJS_Array AF_MakeArrayFromList(CJS_Runtime* pRuntime, CJS_Value val); | 159 static CJS_Array AF_MakeArrayFromList(CJS_Runtime* pRuntime, CJS_Value val); |
160 }; | 160 }; |
161 | 161 |
162 #endif // FPDFSDK_JAVASCRIPT_PUBLICMETHODS_H_ | 162 #endif // FPDFSDK_JAVASCRIPT_PUBLICMETHODS_H_ |
OLD | NEW |