| OLD | NEW |
| (Empty) |
| 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_SRC_JAVASCRIPT_APP_H_ | |
| 8 #define FPDFSDK_SRC_JAVASCRIPT_APP_H_ | |
| 9 | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "fpdfsdk/src/javascript/JS_Define.h" | |
| 13 | |
| 14 class CJS_Runtime; | |
| 15 class CJS_Timer; | |
| 16 | |
| 17 class TimerObj : public CJS_EmbedObj { | |
| 18 public: | |
| 19 TimerObj(CJS_Object* pJSObject); | |
| 20 ~TimerObj() override; | |
| 21 | |
| 22 public: | |
| 23 void SetTimer(CJS_Timer* pTimer); | |
| 24 CJS_Timer* GetTimer() const; | |
| 25 | |
| 26 private: | |
| 27 CJS_Timer* m_pTimer; | |
| 28 }; | |
| 29 | |
| 30 class CJS_TimerObj : public CJS_Object { | |
| 31 public: | |
| 32 CJS_TimerObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} | |
| 33 ~CJS_TimerObj() override {} | |
| 34 | |
| 35 DECLARE_JS_CLASS(); | |
| 36 }; | |
| 37 | |
| 38 class app : public CJS_EmbedObj { | |
| 39 public: | |
| 40 app(CJS_Object* pJSObject); | |
| 41 ~app() override; | |
| 42 | |
| 43 public: | |
| 44 FX_BOOL activeDocs(IJS_Context* cc, | |
| 45 CJS_PropValue& vp, | |
| 46 CFX_WideString& sError); | |
| 47 FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 48 FX_BOOL formsVersion(IJS_Context* cc, | |
| 49 CJS_PropValue& vp, | |
| 50 CFX_WideString& sError); | |
| 51 FX_BOOL fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 52 FX_BOOL fullscreen(IJS_Context* cc, | |
| 53 CJS_PropValue& vp, | |
| 54 CFX_WideString& sError); | |
| 55 FX_BOOL language(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 56 FX_BOOL media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 57 FX_BOOL platform(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 58 FX_BOOL runtimeHighlight(IJS_Context* cc, | |
| 59 CJS_PropValue& vp, | |
| 60 CFX_WideString& sError); | |
| 61 FX_BOOL viewerType(IJS_Context* cc, | |
| 62 CJS_PropValue& vp, | |
| 63 CFX_WideString& sError); | |
| 64 FX_BOOL viewerVariation(IJS_Context* cc, | |
| 65 CJS_PropValue& vp, | |
| 66 CFX_WideString& sError); | |
| 67 FX_BOOL viewerVersion(IJS_Context* cc, | |
| 68 CJS_PropValue& vp, | |
| 69 CFX_WideString& sError); | |
| 70 | |
| 71 FX_BOOL alert(IJS_Context* cc, | |
| 72 const std::vector<CJS_Value>& params, | |
| 73 CJS_Value& vRet, | |
| 74 CFX_WideString& sError); | |
| 75 FX_BOOL beep(IJS_Context* cc, | |
| 76 const std::vector<CJS_Value>& params, | |
| 77 CJS_Value& vRet, | |
| 78 CFX_WideString& sError); | |
| 79 FX_BOOL browseForDoc(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, | |
| 117 CJS_Value& vRet, | |
| 118 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 | |
| 156 static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); | |
| 157 | |
| 158 private: | |
| 159 // CJS_EmbedObj | |
| 160 void TimerProc(CJS_Timer* pTimer) override; | |
| 161 void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); | |
| 162 | |
| 163 bool m_bCalculate; | |
| 164 bool m_bRuntimeHighLight; | |
| 165 CFX_ArrayTemplate<CJS_Timer*> m_aTimer; | |
| 166 }; | |
| 167 | |
| 168 class CJS_App : public CJS_Object { | |
| 169 public: | |
| 170 explicit CJS_App(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} | |
| 171 ~CJS_App() override {} | |
| 172 | |
| 173 DECLARE_JS_CLASS(); | |
| 174 | |
| 175 JS_STATIC_PROP(activeDocs, app); | |
| 176 JS_STATIC_PROP(calculate, app); | |
| 177 JS_STATIC_PROP(formsVersion, app); | |
| 178 JS_STATIC_PROP(fs, app); | |
| 179 JS_STATIC_PROP(fullscreen, app); | |
| 180 JS_STATIC_PROP(language, app); | |
| 181 JS_STATIC_PROP(media, app); | |
| 182 JS_STATIC_PROP(platform, app); | |
| 183 JS_STATIC_PROP(runtimeHighlight, app); | |
| 184 JS_STATIC_PROP(viewerType, app); | |
| 185 JS_STATIC_PROP(viewerVariation, app); | |
| 186 JS_STATIC_PROP(viewerVersion, app); | |
| 187 | |
| 188 JS_STATIC_METHOD(alert, app); | |
| 189 JS_STATIC_METHOD(beep, app); | |
| 190 JS_STATIC_METHOD(browseForDoc, app); | |
| 191 JS_STATIC_METHOD(clearInterval, app); | |
| 192 JS_STATIC_METHOD(clearTimeOut, app); | |
| 193 JS_STATIC_METHOD(execDialog, app); | |
| 194 JS_STATIC_METHOD(execMenuItem, app); | |
| 195 JS_STATIC_METHOD(findComponent, app); | |
| 196 JS_STATIC_METHOD(goBack, app); | |
| 197 JS_STATIC_METHOD(goForward, app); | |
| 198 JS_STATIC_METHOD(launchURL, app); | |
| 199 JS_STATIC_METHOD(mailMsg, app); | |
| 200 JS_STATIC_METHOD(newFDF, app); | |
| 201 JS_STATIC_METHOD(newDoc, app); | |
| 202 JS_STATIC_METHOD(openDoc, app); | |
| 203 JS_STATIC_METHOD(openFDF, app); | |
| 204 JS_STATIC_METHOD(popUpMenuEx, app); | |
| 205 JS_STATIC_METHOD(popUpMenu, app); | |
| 206 JS_STATIC_METHOD(response, app); | |
| 207 JS_STATIC_METHOD(setInterval, app); | |
| 208 JS_STATIC_METHOD(setTimeOut, app); | |
| 209 }; | |
| 210 | |
| 211 #endif // FPDFSDK_SRC_JAVASCRIPT_APP_H_ | |
| OLD | NEW |