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_JS_CONTEXT_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_JS_CONTEXT_H_ |
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_JS_CONTEXT_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_JS_CONTEXT_H_ |
9 | 9 |
10 #include "../../../core/include/fxcrt/fx_system.h" | 10 #include "../../../core/include/fxcrt/fx_system.h" |
11 #include "../../../core/include/fxcrt/fx_string.h" | 11 #include "../../../core/include/fxcrt/fx_string.h" |
12 #include "IJavaScript.h" | 12 #include "IJavaScript.h" |
13 | 13 |
14 class CJS_EventHandler; | 14 class CJS_EventHandler; |
15 class CJS_Runtime; | 15 class CJS_Runtime; |
16 | 16 |
17 class CJS_Context : public IFXJS_Context { | 17 class CJS_Context : public IFXJS_Context { |
18 public: | 18 public: |
19 CJS_Context(CJS_Runtime* pRuntime); | 19 explicit CJS_Context(CJS_Runtime* pRuntime); |
20 ~CJS_Context() override; | 20 ~CJS_Context() override; |
21 | 21 |
22 // IFXJS_Context | 22 // IFXJS_Context |
23 FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info) override; | |
24 FX_BOOL RunScript(const CFX_WideString& script, | 23 FX_BOOL RunScript(const CFX_WideString& script, |
25 CFX_WideString& info) override; | 24 CFX_WideString& info) override; |
26 void OnApp_Init() override; | 25 void OnApp_Init() override; |
27 void OnDoc_Open(CPDFSDK_Document* pDoc, | 26 void OnDoc_Open(CPDFSDK_Document* pDoc, |
28 const CFX_WideString& strTargetName) override; | 27 const CFX_WideString& strTargetName) override; |
29 void OnDoc_WillPrint(CPDFSDK_Document* pDoc) override; | 28 void OnDoc_WillPrint(CPDFSDK_Document* pDoc) override; |
30 void OnDoc_DidPrint(CPDFSDK_Document* pDoc) override; | 29 void OnDoc_DidPrint(CPDFSDK_Document* pDoc) override; |
31 void OnDoc_WillSave(CPDFSDK_Document* pDoc) override; | 30 void OnDoc_WillSave(CPDFSDK_Document* pDoc) override; |
32 void OnDoc_DidSave(CPDFSDK_Document* pDoc) override; | 31 void OnDoc_DidSave(CPDFSDK_Document* pDoc) override; |
33 void OnDoc_WillClose(CPDFSDK_Document* pDoc) override; | 32 void OnDoc_WillClose(CPDFSDK_Document* pDoc) override; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void OnMenu_Exec(CPDFSDK_Document* pTarget, | 116 void OnMenu_Exec(CPDFSDK_Document* pTarget, |
118 const CFX_WideString& strTargetName) override; | 117 const CFX_WideString& strTargetName) override; |
119 void OnBatchExec(CPDFSDK_Document* pTarget) override; | 118 void OnBatchExec(CPDFSDK_Document* pTarget) override; |
120 void OnConsole_Exec() override; | 119 void OnConsole_Exec() override; |
121 void OnExternal_Exec() override; | 120 void OnExternal_Exec() override; |
122 void EnableMessageBox(FX_BOOL bEnable) override { m_bMsgBoxEnable = bEnable; } | 121 void EnableMessageBox(FX_BOOL bEnable) override { m_bMsgBoxEnable = bEnable; } |
123 | 122 |
124 FX_BOOL IsMsgBoxEnabled() const { return m_bMsgBoxEnable; } | 123 FX_BOOL IsMsgBoxEnabled() const { return m_bMsgBoxEnable; } |
125 | 124 |
126 CPDFDoc_Environment* GetReaderApp(); | 125 CPDFDoc_Environment* GetReaderApp(); |
127 CJS_Runtime* GetJSRuntime() { return m_pRuntime; } | 126 CJS_Runtime* GetJSRuntime() const { return m_pRuntime; } |
128 | 127 CJS_EventHandler* GetEventHandler() const { return m_pEventHandler; } |
129 FX_BOOL DoJob(int nMode, const CFX_WideString& script, CFX_WideString& info); | |
130 | |
131 CJS_EventHandler* GetEventHandler() { return m_pEventHandler; } | |
132 CPDFSDK_Document* GetReaderDocument(); | 128 CPDFSDK_Document* GetReaderDocument(); |
133 | 129 |
134 private: | 130 private: |
135 CJS_Runtime* m_pRuntime; | 131 CJS_Runtime* m_pRuntime; |
136 CJS_EventHandler* m_pEventHandler; | 132 CJS_EventHandler* m_pEventHandler; |
137 FX_BOOL m_bBusy; | 133 FX_BOOL m_bBusy; |
138 FX_BOOL m_bMsgBoxEnable; | 134 FX_BOOL m_bMsgBoxEnable; |
139 }; | 135 }; |
140 | 136 |
141 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_CONTEXT_H_ | 137 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_CONTEXT_H_ |
OLD | NEW |