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_IJAVASCRIPT_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ |
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ |
9 | 9 |
10 #include "../../../core/include/fxcrt/fx_string.h" | 10 #include "../../../core/include/fxcrt/fx_string.h" |
11 #include "../../../core/include/fxcrt/fx_system.h" | 11 #include "../../../core/include/fxcrt/fx_system.h" |
12 #include "../../../xfa/include/fxjse/fxjse.h" | 12 #include "../../../xfa/include/fxjse/fxjse.h" |
13 | 13 |
14 class CPDF_Bookmark; | 14 class CPDF_Bookmark; |
15 class CPDF_FormField; | 15 class CPDF_FormField; |
16 class CPDFSDK_Annot; | 16 class CPDFSDK_Annot; |
17 class CPDFSDK_Document; | 17 class CPDFSDK_Document; |
18 | 18 |
19 class IFXJS_Context { | 19 class IFXJS_Context { |
20 public: | 20 public: |
21 virtual ~IFXJS_Context() {} | |
22 virtual FX_BOOL Compile(const CFX_WideString& script, | 21 virtual FX_BOOL Compile(const CFX_WideString& script, |
23 CFX_WideString& info) = 0; | 22 CFX_WideString& info) = 0; |
24 virtual FX_BOOL RunScript(const CFX_WideString& script, | 23 virtual FX_BOOL RunScript(const CFX_WideString& script, |
25 CFX_WideString& info) = 0; | 24 CFX_WideString& info) = 0; |
26 | 25 |
27 virtual void OnApp_Init() = 0; | 26 virtual void OnApp_Init() = 0; |
28 | 27 |
29 virtual void OnDoc_Open(CPDFSDK_Document* pDoc, | 28 virtual void OnDoc_Open(CPDFSDK_Document* pDoc, |
30 const CFX_WideString& strTargetName) = 0; | 29 const CFX_WideString& strTargetName) = 0; |
31 virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0; | 30 virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0; | 121 virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0; |
123 virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget) = 0; | 122 virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget) = 0; |
124 | 123 |
125 virtual void OnMenu_Exec(CPDFSDK_Document* pTarget, | 124 virtual void OnMenu_Exec(CPDFSDK_Document* pTarget, |
126 const CFX_WideString&) = 0; | 125 const CFX_WideString&) = 0; |
127 virtual void OnBatchExec(CPDFSDK_Document* pTarget) = 0; | 126 virtual void OnBatchExec(CPDFSDK_Document* pTarget) = 0; |
128 virtual void OnConsole_Exec() = 0; | 127 virtual void OnConsole_Exec() = 0; |
129 virtual void OnExternal_Exec() = 0; | 128 virtual void OnExternal_Exec() = 0; |
130 | 129 |
131 virtual void EnableMessageBox(FX_BOOL bEnable) = 0; | 130 virtual void EnableMessageBox(FX_BOOL bEnable) = 0; |
| 131 |
| 132 protected: |
| 133 virtual ~IFXJS_Context() {} |
132 }; | 134 }; |
133 | 135 |
134 class IFXJS_Runtime { | 136 class IFXJS_Runtime { |
135 public: | 137 public: |
136 virtual IFXJS_Context* NewContext() = 0; | 138 virtual IFXJS_Context* NewContext() = 0; |
137 virtual void ReleaseContext(IFXJS_Context* pContext) = 0; | 139 virtual void ReleaseContext(IFXJS_Context* pContext) = 0; |
138 virtual IFXJS_Context* GetCurrentContext() = 0; | 140 virtual IFXJS_Context* GetCurrentContext() = 0; |
139 | 141 |
140 virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0; | 142 virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0; |
141 | 143 |
142 virtual CPDFSDK_Document* GetReaderDocument() = 0; | 144 virtual CPDFSDK_Document* GetReaderDocument() = 0; |
143 | 145 |
144 virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, | 146 virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, |
145 FXJSE_HVALUE hValue) = 0; | 147 FXJSE_HVALUE hValue) = 0; |
146 virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, | 148 virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, |
147 FXJSE_HVALUE hValue) = 0; | 149 FXJSE_HVALUE hValue) = 0; |
148 | 150 |
149 protected: | 151 protected: |
150 ~IFXJS_Runtime() {} | 152 virtual ~IFXJS_Runtime() {} |
151 }; | 153 }; |
152 | 154 |
153 class CPDFDoc_Environment; | 155 class CPDFDoc_Environment; |
154 class CJS_GlobalData; | 156 class CJS_GlobalData; |
155 | 157 |
156 class CJS_RuntimeFactory { | 158 class CJS_RuntimeFactory { |
157 public: | 159 public: |
158 CJS_RuntimeFactory() | 160 CJS_RuntimeFactory() |
159 : m_bInit(FALSE), m_nRef(0), m_pGlobalData(NULL), m_nGlobalDataCount(0) {} | 161 : m_bInit(FALSE), m_nRef(0), m_pGlobalData(NULL), m_nGlobalDataCount(0) {} |
160 ~CJS_RuntimeFactory(); | 162 ~CJS_RuntimeFactory(); |
161 IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp); | 163 IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp); |
162 void DeleteJSRuntime(IFXJS_Runtime* pRuntime); | 164 void DeleteJSRuntime(IFXJS_Runtime* pRuntime); |
163 void AddRef(); | 165 void AddRef(); |
164 void Release(); | 166 void Release(); |
165 | 167 |
166 CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp); | 168 CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp); |
167 void ReleaseGlobalData(); | 169 void ReleaseGlobalData(); |
168 | 170 |
169 private: | 171 private: |
170 FX_BOOL m_bInit; | 172 FX_BOOL m_bInit; |
171 int m_nRef; | 173 int m_nRef; |
172 CJS_GlobalData* m_pGlobalData; | 174 CJS_GlobalData* m_pGlobalData; |
173 int32_t m_nGlobalDataCount; | 175 int32_t m_nGlobalDataCount; |
174 }; | 176 }; |
175 | 177 |
176 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ | 178 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ |
OLD | NEW |