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