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 CPDFDoc_Environment; | 13 class CPDFDoc_Environment; |
14 class CPDFSDK_Annot; | 14 class CPDFSDK_Annot; |
15 class CPDFSDK_Document; | 15 class CPDFSDK_Document; |
16 class CPDF_Bookmark; | 16 class CPDF_Bookmark; |
17 class CPDF_FormField; | 17 class CPDF_FormField; |
18 | 18 |
19 // Records the details of an event and causes JS execution for it. | |
Lei Zhang
2015/10/08 23:52:01
causes -> triggers?
Tom Sepez
2015/10/09 00:14:20
Done.
| |
19 class IJS_Context { | 20 class IJS_Context { |
20 public: | 21 public: |
21 virtual FX_BOOL RunScript(const CFX_WideString& script, | 22 virtual FX_BOOL RunScript(const CFX_WideString& script, |
22 CFX_WideString& info) = 0; | 23 CFX_WideString& info) = 0; |
23 | 24 |
24 virtual void OnApp_Init() = 0; | 25 virtual void OnApp_Init() = 0; |
25 | 26 |
26 virtual void OnDoc_Open(CPDFSDK_Document* pDoc, | 27 virtual void OnDoc_Open(CPDFSDK_Document* pDoc, |
27 const CFX_WideString& strTargetName) = 0; | 28 const CFX_WideString& strTargetName) = 0; |
28 virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0; | 29 virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 virtual void OnBatchExec(CPDFSDK_Document* pTarget) = 0; | 125 virtual void OnBatchExec(CPDFSDK_Document* pTarget) = 0; |
125 virtual void OnConsole_Exec() = 0; | 126 virtual void OnConsole_Exec() = 0; |
126 virtual void OnExternal_Exec() = 0; | 127 virtual void OnExternal_Exec() = 0; |
127 | 128 |
128 virtual void EnableMessageBox(FX_BOOL bEnable) = 0; | 129 virtual void EnableMessageBox(FX_BOOL bEnable) = 0; |
129 | 130 |
130 protected: | 131 protected: |
131 virtual ~IJS_Context() {} | 132 virtual ~IJS_Context() {} |
132 }; | 133 }; |
133 | 134 |
135 // Owns the FJXS objects needed to actually execute JS. | |
134 class IJS_Runtime { | 136 class IJS_Runtime { |
135 public: | 137 public: |
136 static IJS_Runtime* Create(CPDFDoc_Environment* pEnv); | 138 static IJS_Runtime* Create(CPDFDoc_Environment* pEnv); |
137 virtual ~IJS_Runtime() {} | 139 virtual ~IJS_Runtime() {} |
138 | 140 |
139 virtual IJS_Context* NewContext() = 0; | 141 virtual IJS_Context* NewContext() = 0; |
140 virtual void ReleaseContext(IJS_Context* pContext) = 0; | 142 virtual void ReleaseContext(IJS_Context* pContext) = 0; |
141 virtual IJS_Context* GetCurrentContext() = 0; | 143 virtual IJS_Context* GetCurrentContext() = 0; |
142 virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0; | 144 virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0; |
143 virtual CPDFSDK_Document* GetReaderDocument() = 0; | 145 virtual CPDFSDK_Document* GetReaderDocument() = 0; |
146 virtual int Execute(IJS_Context* cc, | |
147 const wchar_t* script, | |
148 long length, | |
149 CFX_WideString& info) = 0; | |
Lei Zhang
2015/10/08 23:52:01
No pass by non-const ref.
Tom Sepez
2015/10/09 00:14:20
Done.
| |
144 | 150 |
145 protected: | 151 protected: |
146 IJS_Runtime() {} | 152 IJS_Runtime() {} |
147 }; | 153 }; |
148 | 154 |
149 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ | 155 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ |
OLD | NEW |