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_APP_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_APP_H_ |
8 #define FPDFSDK_JAVASCRIPT_APP_H_ | 8 #define FPDFSDK_JAVASCRIPT_APP_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 23 matching lines...) Expand all Loading... |
34 ~CJS_TimerObj() override {} | 34 ~CJS_TimerObj() override {} |
35 | 35 |
36 DECLARE_JS_CLASS(); | 36 DECLARE_JS_CLASS(); |
37 }; | 37 }; |
38 | 38 |
39 class app : public CJS_EmbedObj { | 39 class app : public CJS_EmbedObj { |
40 public: | 40 public: |
41 app(CJS_Object* pJSObject); | 41 app(CJS_Object* pJSObject); |
42 ~app() override; | 42 ~app() override; |
43 | 43 |
44 FX_BOOL activeDocs(IJS_Context* cc, | 44 bool activeDocs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 45 bool calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 46 bool formsVersion(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 47 bool fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 48 bool fullscreen(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 49 bool language(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 50 bool media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 51 bool platform(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 52 bool runtimeHighlight(IJS_Context* cc, |
| 53 CJS_PropValue& vp, |
| 54 CFX_WideString& sError); |
| 55 bool viewerType(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 56 bool viewerVariation(IJS_Context* cc, |
| 57 CJS_PropValue& vp, |
| 58 CFX_WideString& sError); |
| 59 bool viewerVersion(IJS_Context* cc, |
45 CJS_PropValue& vp, | 60 CJS_PropValue& vp, |
46 CFX_WideString& sError); | 61 CFX_WideString& sError); |
47 FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 62 |
48 FX_BOOL formsVersion(IJS_Context* cc, | 63 bool alert(IJS_Context* cc, |
49 CJS_PropValue& vp, | 64 const std::vector<CJS_Value>& params, |
50 CFX_WideString& sError); | 65 CJS_Value& vRet, |
51 FX_BOOL fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 66 CFX_WideString& sError); |
52 FX_BOOL fullscreen(IJS_Context* cc, | 67 bool beep(IJS_Context* cc, |
53 CJS_PropValue& vp, | 68 const std::vector<CJS_Value>& params, |
| 69 CJS_Value& vRet, |
| 70 CFX_WideString& sError); |
| 71 bool browseForDoc(IJS_Context* cc, |
| 72 const std::vector<CJS_Value>& params, |
| 73 CJS_Value& vRet, |
| 74 CFX_WideString& sError); |
| 75 bool clearInterval(IJS_Context* cc, |
| 76 const std::vector<CJS_Value>& params, |
| 77 CJS_Value& vRet, |
54 CFX_WideString& sError); | 78 CFX_WideString& sError); |
55 FX_BOOL language(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 79 bool clearTimeOut(IJS_Context* cc, |
56 FX_BOOL media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 80 const std::vector<CJS_Value>& params, |
57 FX_BOOL platform(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 81 CJS_Value& vRet, |
58 FX_BOOL runtimeHighlight(IJS_Context* cc, | 82 CFX_WideString& sError); |
59 CJS_PropValue& vp, | 83 bool execDialog(IJS_Context* cc, |
60 CFX_WideString& sError); | 84 const std::vector<CJS_Value>& params, |
61 FX_BOOL viewerType(IJS_Context* cc, | 85 CJS_Value& vRet, |
62 CJS_PropValue& vp, | 86 CFX_WideString& sError); |
| 87 bool execMenuItem(IJS_Context* cc, |
| 88 const std::vector<CJS_Value>& params, |
| 89 CJS_Value& vRet, |
| 90 CFX_WideString& sError); |
| 91 bool findComponent(IJS_Context* cc, |
| 92 const std::vector<CJS_Value>& params, |
| 93 CJS_Value& vRet, |
63 CFX_WideString& sError); | 94 CFX_WideString& sError); |
64 FX_BOOL viewerVariation(IJS_Context* cc, | 95 bool goBack(IJS_Context* cc, |
65 CJS_PropValue& vp, | 96 const std::vector<CJS_Value>& params, |
66 CFX_WideString& sError); | 97 CJS_Value& vRet, |
67 FX_BOOL viewerVersion(IJS_Context* cc, | 98 CFX_WideString& sError); |
68 CJS_PropValue& vp, | 99 bool goForward(IJS_Context* cc, |
69 CFX_WideString& sError); | 100 const std::vector<CJS_Value>& params, |
70 | 101 CJS_Value& vRet, |
71 FX_BOOL alert(IJS_Context* cc, | 102 CFX_WideString& sError); |
| 103 bool launchURL(IJS_Context* cc, |
| 104 const std::vector<CJS_Value>& params, |
| 105 CJS_Value& vRet, |
| 106 CFX_WideString& sError); |
| 107 bool mailMsg(IJS_Context* cc, |
| 108 const std::vector<CJS_Value>& params, |
| 109 CJS_Value& vRet, |
| 110 CFX_WideString& sError); |
| 111 bool newFDF(IJS_Context* cc, |
| 112 const std::vector<CJS_Value>& params, |
| 113 CJS_Value& vRet, |
| 114 CFX_WideString& sError); |
| 115 bool newDoc(IJS_Context* cc, |
| 116 const std::vector<CJS_Value>& params, |
| 117 CJS_Value& vRet, |
| 118 CFX_WideString& sError); |
| 119 bool openDoc(IJS_Context* cc, |
| 120 const std::vector<CJS_Value>& params, |
| 121 CJS_Value& vRet, |
| 122 CFX_WideString& sError); |
| 123 bool openFDF(IJS_Context* cc, |
| 124 const std::vector<CJS_Value>& params, |
| 125 CJS_Value& vRet, |
| 126 CFX_WideString& sError); |
| 127 bool popUpMenuEx(IJS_Context* cc, |
| 128 const std::vector<CJS_Value>& params, |
| 129 CJS_Value& vRet, |
| 130 CFX_WideString& sError); |
| 131 bool popUpMenu(IJS_Context* cc, |
| 132 const std::vector<CJS_Value>& params, |
| 133 CJS_Value& vRet, |
| 134 CFX_WideString& sError); |
| 135 bool response(IJS_Context* cc, |
72 const std::vector<CJS_Value>& params, | 136 const std::vector<CJS_Value>& params, |
73 CJS_Value& vRet, | 137 CJS_Value& vRet, |
74 CFX_WideString& sError); | 138 CFX_WideString& sError); |
75 FX_BOOL beep(IJS_Context* cc, | 139 bool setInterval(IJS_Context* cc, |
76 const std::vector<CJS_Value>& params, | 140 const std::vector<CJS_Value>& params, |
77 CJS_Value& vRet, | 141 CJS_Value& vRet, |
78 CFX_WideString& sError); | 142 CFX_WideString& sError); |
79 FX_BOOL browseForDoc(IJS_Context* cc, | 143 bool setTimeOut(IJS_Context* cc, |
80 const std::vector<CJS_Value>& params, | |
81 CJS_Value& vRet, | |
82 CFX_WideString& sError); | |
83 FX_BOOL clearInterval(IJS_Context* cc, | |
84 const std::vector<CJS_Value>& params, | |
85 CJS_Value& vRet, | |
86 CFX_WideString& sError); | |
87 FX_BOOL clearTimeOut(IJS_Context* cc, | |
88 const std::vector<CJS_Value>& params, | |
89 CJS_Value& vRet, | |
90 CFX_WideString& sError); | |
91 FX_BOOL execDialog(IJS_Context* cc, | |
92 const std::vector<CJS_Value>& params, | |
93 CJS_Value& vRet, | |
94 CFX_WideString& sError); | |
95 FX_BOOL execMenuItem(IJS_Context* cc, | |
96 const std::vector<CJS_Value>& params, | |
97 CJS_Value& vRet, | |
98 CFX_WideString& sError); | |
99 FX_BOOL findComponent(IJS_Context* cc, | |
100 const std::vector<CJS_Value>& params, | |
101 CJS_Value& vRet, | |
102 CFX_WideString& sError); | |
103 FX_BOOL goBack(IJS_Context* cc, | |
104 const std::vector<CJS_Value>& params, | |
105 CJS_Value& vRet, | |
106 CFX_WideString& sError); | |
107 FX_BOOL goForward(IJS_Context* cc, | |
108 const std::vector<CJS_Value>& params, | |
109 CJS_Value& vRet, | |
110 CFX_WideString& sError); | |
111 FX_BOOL launchURL(IJS_Context* cc, | |
112 const std::vector<CJS_Value>& params, | |
113 CJS_Value& vRet, | |
114 CFX_WideString& sError); | |
115 FX_BOOL mailMsg(IJS_Context* cc, | |
116 const std::vector<CJS_Value>& params, | 144 const std::vector<CJS_Value>& params, |
117 CJS_Value& vRet, | 145 CJS_Value& vRet, |
118 CFX_WideString& sError); | 146 CFX_WideString& sError); |
119 FX_BOOL newFDF(IJS_Context* cc, | |
120 const std::vector<CJS_Value>& params, | |
121 CJS_Value& vRet, | |
122 CFX_WideString& sError); | |
123 FX_BOOL newDoc(IJS_Context* cc, | |
124 const std::vector<CJS_Value>& params, | |
125 CJS_Value& vRet, | |
126 CFX_WideString& sError); | |
127 FX_BOOL openDoc(IJS_Context* cc, | |
128 const std::vector<CJS_Value>& params, | |
129 CJS_Value& vRet, | |
130 CFX_WideString& sError); | |
131 FX_BOOL openFDF(IJS_Context* cc, | |
132 const std::vector<CJS_Value>& params, | |
133 CJS_Value& vRet, | |
134 CFX_WideString& sError); | |
135 FX_BOOL popUpMenuEx(IJS_Context* cc, | |
136 const std::vector<CJS_Value>& params, | |
137 CJS_Value& vRet, | |
138 CFX_WideString& sError); | |
139 FX_BOOL popUpMenu(IJS_Context* cc, | |
140 const std::vector<CJS_Value>& params, | |
141 CJS_Value& vRet, | |
142 CFX_WideString& sError); | |
143 FX_BOOL response(IJS_Context* cc, | |
144 const std::vector<CJS_Value>& params, | |
145 CJS_Value& vRet, | |
146 CFX_WideString& sError); | |
147 FX_BOOL setInterval(IJS_Context* cc, | |
148 const std::vector<CJS_Value>& params, | |
149 CJS_Value& vRet, | |
150 CFX_WideString& sError); | |
151 FX_BOOL setTimeOut(IJS_Context* cc, | |
152 const std::vector<CJS_Value>& params, | |
153 CJS_Value& vRet, | |
154 CFX_WideString& sError); | |
155 | 147 |
156 void TimerProc(GlobalTimer* pTimer); | 148 void TimerProc(GlobalTimer* pTimer); |
157 void CancelProc(GlobalTimer* pTimer); | 149 void CancelProc(GlobalTimer* pTimer); |
158 | 150 |
159 static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); | 151 static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); |
160 | 152 |
161 private: | 153 private: |
162 // CJS_EmbedObj | 154 // CJS_EmbedObj |
163 void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); | 155 void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); |
164 | 156 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 JS_STATIC_METHOD(openDoc, app); | 198 JS_STATIC_METHOD(openDoc, app); |
207 JS_STATIC_METHOD(openFDF, app); | 199 JS_STATIC_METHOD(openFDF, app); |
208 JS_STATIC_METHOD(popUpMenuEx, app); | 200 JS_STATIC_METHOD(popUpMenuEx, app); |
209 JS_STATIC_METHOD(popUpMenu, app); | 201 JS_STATIC_METHOD(popUpMenu, app); |
210 JS_STATIC_METHOD(response, app); | 202 JS_STATIC_METHOD(response, app); |
211 JS_STATIC_METHOD(setInterval, app); | 203 JS_STATIC_METHOD(setInterval, app); |
212 JS_STATIC_METHOD(setTimeOut, app); | 204 JS_STATIC_METHOD(setTimeOut, app); |
213 }; | 205 }; |
214 | 206 |
215 #endif // FPDFSDK_JAVASCRIPT_APP_H_ | 207 #endif // FPDFSDK_JAVASCRIPT_APP_H_ |
OLD | NEW |