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_APP_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_APP_H_ |
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_APP_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_APP_H_ |
9 | 9 |
10 #include "JS_Define.h" | 10 #include "JS_Define.h" |
11 | 11 |
12 class CJS_Runtime; | 12 class CJS_Runtime; |
13 | 13 |
14 /* ---------------------------- TimerObj ---------------------------- */ | 14 /* ---------------------------- TimerObj ---------------------------- */ |
15 | 15 |
16 class CJS_Timer; | 16 class CJS_Timer; |
17 | 17 |
18 class TimerObj : public CJS_EmbedObj { | 18 class TimerObj : public CJS_EmbedObj { |
19 public: | 19 public: |
20 TimerObj(CJS_Object* pJSObject); | 20 TimerObj(CJS_Object* pJSObject); |
21 virtual ~TimerObj(); | 21 ~TimerObj() override; |
22 | 22 |
23 public: | 23 public: |
24 void SetTimer(CJS_Timer* pTimer); | 24 void SetTimer(CJS_Timer* pTimer); |
25 CJS_Timer* GetTimer() const; | 25 CJS_Timer* GetTimer() const; |
26 | 26 |
27 private: | 27 private: |
28 CJS_Timer* m_pTimer; | 28 CJS_Timer* m_pTimer; |
29 }; | 29 }; |
30 | 30 |
31 class CJS_TimerObj : public CJS_Object { | 31 class CJS_TimerObj : public CJS_Object { |
32 public: | 32 public: |
33 CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {} | 33 CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {} |
34 virtual ~CJS_TimerObj() {} | 34 ~CJS_TimerObj() override {} |
35 | 35 |
36 DECLARE_JS_CLASS(CJS_TimerObj); | 36 DECLARE_JS_CLASS(CJS_TimerObj); |
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 virtual ~app(); | 42 ~app() override; |
43 | 43 |
44 public: | 44 public: |
45 FX_BOOL activeDocs(IFXJS_Context* cc, | 45 FX_BOOL activeDocs(IFXJS_Context* cc, |
46 CJS_PropValue& vp, | 46 CJS_PropValue& vp, |
47 CFX_WideString& sError); | 47 CFX_WideString& sError); |
48 FX_BOOL calculate(IFXJS_Context* cc, | 48 FX_BOOL calculate(IFXJS_Context* cc, |
49 CJS_PropValue& vp, | 49 CJS_PropValue& vp, |
50 CFX_WideString& sError); | 50 CFX_WideString& sError); |
51 FX_BOOL formsVersion(IFXJS_Context* cc, | 51 FX_BOOL formsVersion(IFXJS_Context* cc, |
52 CJS_PropValue& vp, | 52 CJS_PropValue& vp, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 CFX_WideString& sError); | 153 CFX_WideString& sError); |
154 FX_BOOL setInterval(IFXJS_Context* cc, | 154 FX_BOOL setInterval(IFXJS_Context* cc, |
155 const CJS_Parameters& params, | 155 const CJS_Parameters& params, |
156 CJS_Value& vRet, | 156 CJS_Value& vRet, |
157 CFX_WideString& sError); | 157 CFX_WideString& sError); |
158 FX_BOOL setTimeOut(IFXJS_Context* cc, | 158 FX_BOOL setTimeOut(IFXJS_Context* cc, |
159 const CJS_Parameters& params, | 159 const CJS_Parameters& params, |
160 CJS_Value& vRet, | 160 CJS_Value& vRet, |
161 CFX_WideString& sError); | 161 CFX_WideString& sError); |
162 | 162 |
163 private: | |
164 void TimerProc(CJS_Timer* pTimer); | |
165 void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); | |
166 | |
167 public: | |
168 static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); | 163 static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); |
169 | 164 |
170 private: | 165 private: |
| 166 // CJS_EmbedObj |
| 167 void TimerProc(CJS_Timer* pTimer) override; |
| 168 void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); |
| 169 |
171 bool m_bCalculate; | 170 bool m_bCalculate; |
172 bool m_bRuntimeHighLight; | 171 bool m_bRuntimeHighLight; |
173 | |
174 CFX_ArrayTemplate<CJS_Timer*> m_aTimer; | 172 CFX_ArrayTemplate<CJS_Timer*> m_aTimer; |
175 }; | 173 }; |
176 | 174 |
177 class CJS_App : public CJS_Object { | 175 class CJS_App : public CJS_Object { |
178 public: | 176 public: |
179 CJS_App(JSFXObject pObject) : CJS_Object(pObject){}; | 177 explicit CJS_App(JSFXObject pObject) : CJS_Object(pObject) {} |
180 virtual ~CJS_App(void){}; | 178 ~CJS_App() override {} |
181 | 179 |
182 DECLARE_JS_CLASS(CJS_App); | 180 DECLARE_JS_CLASS(CJS_App); |
183 | 181 |
184 JS_STATIC_PROP(activeDocs, app); | 182 JS_STATIC_PROP(activeDocs, app); |
185 JS_STATIC_PROP(calculate, app); | 183 JS_STATIC_PROP(calculate, app); |
186 JS_STATIC_PROP(formsVersion, app); | 184 JS_STATIC_PROP(formsVersion, app); |
187 JS_STATIC_PROP(fs, app); | 185 JS_STATIC_PROP(fs, app); |
188 JS_STATIC_PROP(fullscreen, app); | 186 JS_STATIC_PROP(fullscreen, app); |
189 JS_STATIC_PROP(language, app); | 187 JS_STATIC_PROP(language, app); |
190 JS_STATIC_PROP(media, app); | 188 JS_STATIC_PROP(media, app); |
(...skipping 20 matching lines...) Expand all Loading... |
211 JS_STATIC_METHOD(openDoc, app); | 209 JS_STATIC_METHOD(openDoc, app); |
212 JS_STATIC_METHOD(openFDF, app); | 210 JS_STATIC_METHOD(openFDF, app); |
213 JS_STATIC_METHOD(popUpMenuEx, app); | 211 JS_STATIC_METHOD(popUpMenuEx, app); |
214 JS_STATIC_METHOD(popUpMenu, app); | 212 JS_STATIC_METHOD(popUpMenu, app); |
215 JS_STATIC_METHOD(response, app); | 213 JS_STATIC_METHOD(response, app); |
216 JS_STATIC_METHOD(setInterval, app); | 214 JS_STATIC_METHOD(setInterval, app); |
217 JS_STATIC_METHOD(setTimeOut, app); | 215 JS_STATIC_METHOD(setTimeOut, app); |
218 }; | 216 }; |
219 | 217 |
220 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_APP_H_ | 218 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_APP_H_ |
OLD | NEW |