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 #include "../../include/javascript/JavaScript.h" | |
8 #include "../../include/javascript/IJavaScript.h" | 7 #include "../../include/javascript/IJavaScript.h" |
9 //#include "../../include/javascript/JS_ResMgr.h" | |
10 #include "../../include/javascript/JS_Context.h" | 8 #include "../../include/javascript/JS_Context.h" |
11 #include "../../include/javascript/JS_EventHandler.h" | 9 #include "../../include/javascript/JS_EventHandler.h" |
12 #include "../../include/javascript/JS_Runtime.h" | 10 #include "../../include/javascript/JS_Runtime.h" |
| 11 #include "../../include/javascript/JavaScript.h" |
13 #include "../../include/javascript/resource.h" | 12 #include "../../include/javascript/resource.h" |
14 | 13 |
15 /* -------------------------- CJS_Context -------------------------- */ | 14 /* -------------------------- CJS_Context -------------------------- */ |
16 | 15 |
17 CJS_Context::CJS_Context(CJS_Runtime* pRuntime) | 16 CJS_Context::CJS_Context(CJS_Runtime* pRuntime) |
18 : m_pRuntime(pRuntime), m_bBusy(FALSE), m_bMsgBoxEnable(TRUE) { | 17 : m_pRuntime(pRuntime), m_bBusy(FALSE), m_bMsgBoxEnable(TRUE) { |
19 m_pEventHandler = new CJS_EventHandler(this); | 18 m_pEventHandler = new CJS_EventHandler(this); |
20 } | 19 } |
21 | 20 |
22 CJS_Context::~CJS_Context() { | 21 CJS_Context::~CJS_Context() { |
23 delete m_pEventHandler; | 22 delete m_pEventHandler; |
24 } | 23 } |
25 | 24 |
26 CPDFSDK_Document* CJS_Context::GetReaderDocument() { | 25 CPDFSDK_Document* CJS_Context::GetReaderDocument() { |
27 ASSERT(m_pRuntime != NULL); | |
28 | |
29 return m_pRuntime->GetReaderDocument(); | 26 return m_pRuntime->GetReaderDocument(); |
30 } | 27 } |
31 | 28 |
32 CPDFDoc_Environment* CJS_Context::GetReaderApp() { | 29 CPDFDoc_Environment* CJS_Context::GetReaderApp() { |
33 ASSERT(m_pRuntime != NULL); | 30 ASSERT(m_pRuntime != NULL); |
34 | 31 |
35 return m_pRuntime->GetReaderApp(); | 32 return m_pRuntime->GetReaderApp(); |
36 } | 33 } |
37 | 34 |
38 FX_BOOL CJS_Context::DoJob(int nMode, | 35 FX_BOOL CJS_Context::RunScript(const CFX_WideString& script, |
39 const CFX_WideString& script, | 36 CFX_WideString& info) { |
40 CFX_WideString& info) { | 37 v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate()); |
| 38 v8::Locker locker(m_pRuntime->GetIsolate()); |
| 39 v8::HandleScope handle_scope(m_pRuntime->GetIsolate()); |
| 40 v8::Local<v8::Context> context = m_pRuntime->NewJSContext(); |
| 41 v8::Context::Scope context_scope(context); |
| 42 |
41 if (m_bBusy) { | 43 if (m_bBusy) { |
42 info = JSGetStringFromID(this, IDS_STRING_JSBUSY); | 44 info = JSGetStringFromID(this, IDS_STRING_JSBUSY); |
43 return FALSE; | 45 return FALSE; |
44 } | 46 } |
45 | |
46 m_bBusy = TRUE; | 47 m_bBusy = TRUE; |
47 | 48 |
48 ASSERT(m_pRuntime != NULL); | |
49 ASSERT(m_pEventHandler != NULL); | |
50 ASSERT(m_pEventHandler->IsValid()); | 49 ASSERT(m_pEventHandler->IsValid()); |
51 | |
52 if (!m_pRuntime->AddEventToLoop(m_pEventHandler->TargetName(), | 50 if (!m_pRuntime->AddEventToLoop(m_pEventHandler->TargetName(), |
53 m_pEventHandler->EventType())) { | 51 m_pEventHandler->EventType())) { |
54 info = JSGetStringFromID(this, IDS_STRING_JSEVENT); | 52 info = JSGetStringFromID(this, IDS_STRING_JSEVENT); |
55 return FALSE; | 53 return FALSE; |
56 } | 54 } |
57 | 55 |
58 FXJSErr error = {NULL, NULL, 0}; | 56 FXJSErr error = {NULL, NULL, 0}; |
59 int nRet = 0; | 57 int nRet = 0; |
60 | |
61 if (script.GetLength() > 0) { | 58 if (script.GetLength() > 0) { |
62 if (nMode == 0) { | 59 nRet = JS_Execute(*m_pRuntime, this, script.c_str(), script.GetLength(), |
63 nRet = JS_Execute(*m_pRuntime, this, script.c_str(), script.GetLength(), | |
64 &error); | |
65 } else { | |
66 nRet = JS_Parse(*m_pRuntime, this, script.c_str(), script.GetLength(), | |
67 &error); | 60 &error); |
68 } | |
69 } | 61 } |
70 | 62 |
71 if (nRet < 0) { | 63 if (nRet < 0) { |
72 CFX_WideString sLine; | 64 CFX_WideString sLine; |
73 sLine.Format(L"[ Line: %05d { %s } ] : %s", error.linnum - 1, error.srcline, | 65 sLine.Format(L"[ Line: %05d { %s } ] : %s", error.linnum - 1, error.srcline, |
74 error.message); | 66 error.message); |
75 | |
76 // TRACE(L"/* -------------- JS Error -------------- | |
77 //*/\n"); | |
78 // TRACE(sLine); | |
79 // TRACE(L"\n"); | |
80 // CFX_ByteString sTemp = CFX_ByteString::FromUnicode(error.message); | |
81 info += sLine; | 67 info += sLine; |
82 } else { | 68 } else { |
83 info = JSGetStringFromID(this, IDS_STRING_RUN); | 69 info = JSGetStringFromID(this, IDS_STRING_RUN); |
84 } | 70 } |
85 | 71 |
86 m_pRuntime->RemoveEventInLoop(m_pEventHandler->TargetName(), | 72 m_pRuntime->RemoveEventInLoop(m_pEventHandler->TargetName(), |
87 m_pEventHandler->EventType()); | 73 m_pEventHandler->EventType()); |
88 | 74 |
89 m_pEventHandler->Destroy(); | 75 m_pEventHandler->Destroy(); |
90 m_bBusy = FALSE; | 76 m_bBusy = FALSE; |
91 | 77 |
92 return nRet >= 0; | 78 return nRet >= 0; |
93 } | 79 } |
94 | 80 |
95 FX_BOOL CJS_Context::RunScript(const CFX_WideString& script, | |
96 CFX_WideString& info) { | |
97 v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate()); | |
98 v8::Locker locker(m_pRuntime->GetIsolate()); | |
99 v8::HandleScope handle_scope(m_pRuntime->GetIsolate()); | |
100 v8::Local<v8::Context> context = m_pRuntime->NewJSContext(); | |
101 v8::Context::Scope context_scope(context); | |
102 | |
103 return DoJob(0, script, info); | |
104 } | |
105 | |
106 FX_BOOL CJS_Context::Compile(const CFX_WideString& script, | |
107 CFX_WideString& info) { | |
108 v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate()); | |
109 v8::HandleScope handle_scope(m_pRuntime->GetIsolate()); | |
110 v8::Local<v8::Context> context = m_pRuntime->NewJSContext(); | |
111 v8::Context::Scope context_scope(context); | |
112 | |
113 return DoJob(1, script, info); | |
114 } | |
115 | |
116 void CJS_Context::OnApp_Init() { | 81 void CJS_Context::OnApp_Init() { |
117 ASSERT(m_pEventHandler != NULL); | |
118 m_pEventHandler->OnApp_Init(); | 82 m_pEventHandler->OnApp_Init(); |
119 } | 83 } |
120 | 84 |
121 void CJS_Context::OnDoc_Open(CPDFSDK_Document* pDoc, | 85 void CJS_Context::OnDoc_Open(CPDFSDK_Document* pDoc, |
122 const CFX_WideString& strTargetName) { | 86 const CFX_WideString& strTargetName) { |
123 ASSERT(m_pEventHandler != NULL); | |
124 m_pEventHandler->OnDoc_Open(pDoc, strTargetName); | 87 m_pEventHandler->OnDoc_Open(pDoc, strTargetName); |
125 } | 88 } |
126 | 89 |
127 void CJS_Context::OnDoc_WillPrint(CPDFSDK_Document* pDoc) { | 90 void CJS_Context::OnDoc_WillPrint(CPDFSDK_Document* pDoc) { |
128 ASSERT(m_pEventHandler != NULL); | |
129 m_pEventHandler->OnDoc_WillPrint(pDoc); | 91 m_pEventHandler->OnDoc_WillPrint(pDoc); |
130 } | 92 } |
131 | 93 |
132 void CJS_Context::OnDoc_DidPrint(CPDFSDK_Document* pDoc) { | 94 void CJS_Context::OnDoc_DidPrint(CPDFSDK_Document* pDoc) { |
133 ASSERT(m_pEventHandler != NULL); | |
134 m_pEventHandler->OnDoc_DidPrint(pDoc); | 95 m_pEventHandler->OnDoc_DidPrint(pDoc); |
135 } | 96 } |
136 | 97 |
137 void CJS_Context::OnDoc_WillSave(CPDFSDK_Document* pDoc) { | 98 void CJS_Context::OnDoc_WillSave(CPDFSDK_Document* pDoc) { |
138 ASSERT(m_pEventHandler != NULL); | |
139 m_pEventHandler->OnDoc_WillSave(pDoc); | 99 m_pEventHandler->OnDoc_WillSave(pDoc); |
140 } | 100 } |
141 | 101 |
142 void CJS_Context::OnDoc_DidSave(CPDFSDK_Document* pDoc) { | 102 void CJS_Context::OnDoc_DidSave(CPDFSDK_Document* pDoc) { |
143 ASSERT(m_pEventHandler != NULL); | |
144 m_pEventHandler->OnDoc_DidSave(pDoc); | 103 m_pEventHandler->OnDoc_DidSave(pDoc); |
145 } | 104 } |
146 | 105 |
147 void CJS_Context::OnDoc_WillClose(CPDFSDK_Document* pDoc) { | 106 void CJS_Context::OnDoc_WillClose(CPDFSDK_Document* pDoc) { |
148 ASSERT(m_pEventHandler != NULL); | |
149 m_pEventHandler->OnDoc_WillClose(pDoc); | 107 m_pEventHandler->OnDoc_WillClose(pDoc); |
150 } | 108 } |
151 | 109 |
152 void CJS_Context::OnPage_Open(CPDFSDK_Document* pTarget) { | 110 void CJS_Context::OnPage_Open(CPDFSDK_Document* pTarget) { |
153 ASSERT(m_pEventHandler != NULL); | |
154 m_pEventHandler->OnPage_Open(pTarget); | 111 m_pEventHandler->OnPage_Open(pTarget); |
155 } | 112 } |
156 | 113 |
157 void CJS_Context::OnPage_Close(CPDFSDK_Document* pTarget) { | 114 void CJS_Context::OnPage_Close(CPDFSDK_Document* pTarget) { |
158 ASSERT(m_pEventHandler != NULL); | |
159 m_pEventHandler->OnPage_Close(pTarget); | 115 m_pEventHandler->OnPage_Close(pTarget); |
160 } | 116 } |
161 | 117 |
162 void CJS_Context::OnPage_InView(CPDFSDK_Document* pTarget) { | 118 void CJS_Context::OnPage_InView(CPDFSDK_Document* pTarget) { |
163 ASSERT(m_pEventHandler != NULL); | |
164 m_pEventHandler->OnPage_InView(pTarget); | 119 m_pEventHandler->OnPage_InView(pTarget); |
165 } | 120 } |
166 | 121 |
167 void CJS_Context::OnPage_OutView(CPDFSDK_Document* pTarget) { | 122 void CJS_Context::OnPage_OutView(CPDFSDK_Document* pTarget) { |
168 ASSERT(m_pEventHandler != NULL); | |
169 m_pEventHandler->OnPage_OutView(pTarget); | 123 m_pEventHandler->OnPage_OutView(pTarget); |
170 } | 124 } |
171 | 125 |
172 void CJS_Context::OnField_MouseDown(FX_BOOL bModifier, | 126 void CJS_Context::OnField_MouseDown(FX_BOOL bModifier, |
173 FX_BOOL bShift, | 127 FX_BOOL bShift, |
174 CPDF_FormField* pTarget) { | 128 CPDF_FormField* pTarget) { |
175 ASSERT(m_pEventHandler != NULL); | |
176 m_pEventHandler->OnField_MouseDown(bModifier, bShift, pTarget); | 129 m_pEventHandler->OnField_MouseDown(bModifier, bShift, pTarget); |
177 } | 130 } |
178 | 131 |
179 void CJS_Context::OnField_MouseEnter(FX_BOOL bModifier, | 132 void CJS_Context::OnField_MouseEnter(FX_BOOL bModifier, |
180 FX_BOOL bShift, | 133 FX_BOOL bShift, |
181 CPDF_FormField* pTarget) { | 134 CPDF_FormField* pTarget) { |
182 ASSERT(m_pEventHandler != NULL); | |
183 m_pEventHandler->OnField_MouseEnter(bModifier, bShift, pTarget); | 135 m_pEventHandler->OnField_MouseEnter(bModifier, bShift, pTarget); |
184 } | 136 } |
185 | 137 |
186 void CJS_Context::OnField_MouseExit(FX_BOOL bModifier, | 138 void CJS_Context::OnField_MouseExit(FX_BOOL bModifier, |
187 FX_BOOL bShift, | 139 FX_BOOL bShift, |
188 CPDF_FormField* pTarget) { | 140 CPDF_FormField* pTarget) { |
189 ASSERT(m_pEventHandler != NULL); | |
190 m_pEventHandler->OnField_MouseExit(bModifier, bShift, pTarget); | 141 m_pEventHandler->OnField_MouseExit(bModifier, bShift, pTarget); |
191 } | 142 } |
192 | 143 |
193 void CJS_Context::OnField_MouseUp(FX_BOOL bModifier, | 144 void CJS_Context::OnField_MouseUp(FX_BOOL bModifier, |
194 FX_BOOL bShift, | 145 FX_BOOL bShift, |
195 CPDF_FormField* pTarget) { | 146 CPDF_FormField* pTarget) { |
196 ASSERT(m_pEventHandler != NULL); | |
197 m_pEventHandler->OnField_MouseUp(bModifier, bShift, pTarget); | 147 m_pEventHandler->OnField_MouseUp(bModifier, bShift, pTarget); |
198 } | 148 } |
199 | 149 |
200 void CJS_Context::OnField_Focus(FX_BOOL bModifier, | 150 void CJS_Context::OnField_Focus(FX_BOOL bModifier, |
201 FX_BOOL bShift, | 151 FX_BOOL bShift, |
202 CPDF_FormField* pTarget, | 152 CPDF_FormField* pTarget, |
203 const CFX_WideString& Value) { | 153 const CFX_WideString& Value) { |
204 ASSERT(m_pEventHandler != NULL); | |
205 m_pEventHandler->OnField_Focus(bModifier, bShift, pTarget, Value); | 154 m_pEventHandler->OnField_Focus(bModifier, bShift, pTarget, Value); |
206 } | 155 } |
207 | 156 |
208 void CJS_Context::OnField_Blur(FX_BOOL bModifier, | 157 void CJS_Context::OnField_Blur(FX_BOOL bModifier, |
209 FX_BOOL bShift, | 158 FX_BOOL bShift, |
210 CPDF_FormField* pTarget, | 159 CPDF_FormField* pTarget, |
211 const CFX_WideString& Value) { | 160 const CFX_WideString& Value) { |
212 ASSERT(m_pEventHandler != NULL); | |
213 m_pEventHandler->OnField_Blur(bModifier, bShift, pTarget, Value); | 161 m_pEventHandler->OnField_Blur(bModifier, bShift, pTarget, Value); |
214 } | 162 } |
215 | 163 |
216 void CJS_Context::OnField_Calculate(CPDF_FormField* pSource, | 164 void CJS_Context::OnField_Calculate(CPDF_FormField* pSource, |
217 CPDF_FormField* pTarget, | 165 CPDF_FormField* pTarget, |
218 CFX_WideString& Value, | 166 CFX_WideString& Value, |
219 FX_BOOL& bRc) { | 167 FX_BOOL& bRc) { |
220 ASSERT(m_pEventHandler != NULL); | |
221 m_pEventHandler->OnField_Calculate(pSource, pTarget, Value, bRc); | 168 m_pEventHandler->OnField_Calculate(pSource, pTarget, Value, bRc); |
222 } | 169 } |
223 | 170 |
224 void CJS_Context::OnField_Format(CPDF_FormField* pTarget, | 171 void CJS_Context::OnField_Format(CPDF_FormField* pTarget, |
225 CFX_WideString& Value, | 172 CFX_WideString& Value, |
226 FX_BOOL bWillCommit) { | 173 FX_BOOL bWillCommit) { |
227 m_pEventHandler->OnField_Format(pTarget, Value, bWillCommit); | 174 m_pEventHandler->OnField_Format(pTarget, Value, bWillCommit); |
228 } | 175 } |
229 | 176 |
230 void CJS_Context::OnField_Keystroke(CFX_WideString& strChange, | 177 void CJS_Context::OnField_Keystroke(CFX_WideString& strChange, |
(...skipping 14 matching lines...) Expand all Loading... |
245 } | 192 } |
246 | 193 |
247 void CJS_Context::OnField_Validate(CFX_WideString& strChange, | 194 void CJS_Context::OnField_Validate(CFX_WideString& strChange, |
248 const CFX_WideString& strChangeEx, | 195 const CFX_WideString& strChangeEx, |
249 FX_BOOL bKeyDown, | 196 FX_BOOL bKeyDown, |
250 FX_BOOL bModifier, | 197 FX_BOOL bModifier, |
251 FX_BOOL bShift, | 198 FX_BOOL bShift, |
252 CPDF_FormField* pTarget, | 199 CPDF_FormField* pTarget, |
253 CFX_WideString& Value, | 200 CFX_WideString& Value, |
254 FX_BOOL& bRc) { | 201 FX_BOOL& bRc) { |
255 ASSERT(m_pEventHandler != NULL); | |
256 m_pEventHandler->OnField_Validate(strChange, strChangeEx, bKeyDown, bModifier, | 202 m_pEventHandler->OnField_Validate(strChange, strChangeEx, bKeyDown, bModifier, |
257 bShift, pTarget, Value, bRc); | 203 bShift, pTarget, Value, bRc); |
258 } | 204 } |
259 | 205 |
260 void CJS_Context::OnScreen_Focus(FX_BOOL bModifier, | 206 void CJS_Context::OnScreen_Focus(FX_BOOL bModifier, |
261 FX_BOOL bShift, | 207 FX_BOOL bShift, |
262 CPDFSDK_Annot* pScreen) { | 208 CPDFSDK_Annot* pScreen) { |
263 ASSERT(m_pEventHandler != NULL); | |
264 m_pEventHandler->OnScreen_Focus(bModifier, bShift, pScreen); | 209 m_pEventHandler->OnScreen_Focus(bModifier, bShift, pScreen); |
265 } | 210 } |
266 | 211 |
267 void CJS_Context::OnScreen_Blur(FX_BOOL bModifier, | 212 void CJS_Context::OnScreen_Blur(FX_BOOL bModifier, |
268 FX_BOOL bShift, | 213 FX_BOOL bShift, |
269 CPDFSDK_Annot* pScreen) { | 214 CPDFSDK_Annot* pScreen) { |
270 ASSERT(m_pEventHandler != NULL); | |
271 m_pEventHandler->OnScreen_Blur(bModifier, bShift, pScreen); | 215 m_pEventHandler->OnScreen_Blur(bModifier, bShift, pScreen); |
272 } | 216 } |
273 | 217 |
274 void CJS_Context::OnScreen_Open(FX_BOOL bModifier, | 218 void CJS_Context::OnScreen_Open(FX_BOOL bModifier, |
275 FX_BOOL bShift, | 219 FX_BOOL bShift, |
276 CPDFSDK_Annot* pScreen) { | 220 CPDFSDK_Annot* pScreen) { |
277 ASSERT(m_pEventHandler != NULL); | |
278 m_pEventHandler->OnScreen_Open(bModifier, bShift, pScreen); | 221 m_pEventHandler->OnScreen_Open(bModifier, bShift, pScreen); |
279 } | 222 } |
280 | 223 |
281 void CJS_Context::OnScreen_Close(FX_BOOL bModifier, | 224 void CJS_Context::OnScreen_Close(FX_BOOL bModifier, |
282 FX_BOOL bShift, | 225 FX_BOOL bShift, |
283 CPDFSDK_Annot* pScreen) { | 226 CPDFSDK_Annot* pScreen) { |
284 ASSERT(m_pEventHandler != NULL); | |
285 m_pEventHandler->OnScreen_Close(bModifier, bShift, pScreen); | 227 m_pEventHandler->OnScreen_Close(bModifier, bShift, pScreen); |
286 } | 228 } |
287 | 229 |
288 void CJS_Context::OnScreen_MouseDown(FX_BOOL bModifier, | 230 void CJS_Context::OnScreen_MouseDown(FX_BOOL bModifier, |
289 FX_BOOL bShift, | 231 FX_BOOL bShift, |
290 CPDFSDK_Annot* pScreen) { | 232 CPDFSDK_Annot* pScreen) { |
291 ASSERT(m_pEventHandler != NULL); | |
292 m_pEventHandler->OnScreen_MouseDown(bModifier, bShift, pScreen); | 233 m_pEventHandler->OnScreen_MouseDown(bModifier, bShift, pScreen); |
293 } | 234 } |
294 | 235 |
295 void CJS_Context::OnScreen_MouseUp(FX_BOOL bModifier, | 236 void CJS_Context::OnScreen_MouseUp(FX_BOOL bModifier, |
296 FX_BOOL bShift, | 237 FX_BOOL bShift, |
297 CPDFSDK_Annot* pScreen) { | 238 CPDFSDK_Annot* pScreen) { |
298 ASSERT(m_pEventHandler != NULL); | |
299 m_pEventHandler->OnScreen_MouseUp(bModifier, bShift, pScreen); | 239 m_pEventHandler->OnScreen_MouseUp(bModifier, bShift, pScreen); |
300 } | 240 } |
301 | 241 |
302 void CJS_Context::OnScreen_MouseEnter(FX_BOOL bModifier, | 242 void CJS_Context::OnScreen_MouseEnter(FX_BOOL bModifier, |
303 FX_BOOL bShift, | 243 FX_BOOL bShift, |
304 CPDFSDK_Annot* pScreen) { | 244 CPDFSDK_Annot* pScreen) { |
305 ASSERT(m_pEventHandler != NULL); | |
306 m_pEventHandler->OnScreen_MouseEnter(bModifier, bShift, pScreen); | 245 m_pEventHandler->OnScreen_MouseEnter(bModifier, bShift, pScreen); |
307 } | 246 } |
308 | 247 |
309 void CJS_Context::OnScreen_MouseExit(FX_BOOL bModifier, | 248 void CJS_Context::OnScreen_MouseExit(FX_BOOL bModifier, |
310 FX_BOOL bShift, | 249 FX_BOOL bShift, |
311 CPDFSDK_Annot* pScreen) { | 250 CPDFSDK_Annot* pScreen) { |
312 ASSERT(m_pEventHandler != NULL); | |
313 m_pEventHandler->OnScreen_MouseExit(bModifier, bShift, pScreen); | 251 m_pEventHandler->OnScreen_MouseExit(bModifier, bShift, pScreen); |
314 } | 252 } |
315 | 253 |
316 void CJS_Context::OnScreen_InView(FX_BOOL bModifier, | 254 void CJS_Context::OnScreen_InView(FX_BOOL bModifier, |
317 FX_BOOL bShift, | 255 FX_BOOL bShift, |
318 CPDFSDK_Annot* pScreen) { | 256 CPDFSDK_Annot* pScreen) { |
319 ASSERT(m_pEventHandler != NULL); | |
320 m_pEventHandler->OnScreen_InView(bModifier, bShift, pScreen); | 257 m_pEventHandler->OnScreen_InView(bModifier, bShift, pScreen); |
321 } | 258 } |
322 | 259 |
323 void CJS_Context::OnScreen_OutView(FX_BOOL bModifier, | 260 void CJS_Context::OnScreen_OutView(FX_BOOL bModifier, |
324 FX_BOOL bShift, | 261 FX_BOOL bShift, |
325 CPDFSDK_Annot* pScreen) { | 262 CPDFSDK_Annot* pScreen) { |
326 ASSERT(m_pEventHandler != NULL); | |
327 m_pEventHandler->OnScreen_OutView(bModifier, bShift, pScreen); | 263 m_pEventHandler->OnScreen_OutView(bModifier, bShift, pScreen); |
328 } | 264 } |
329 | 265 |
330 void CJS_Context::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) { | 266 void CJS_Context::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) { |
331 ASSERT(m_pEventHandler != NULL); | |
332 m_pEventHandler->OnBookmark_MouseUp(pBookMark); | 267 m_pEventHandler->OnBookmark_MouseUp(pBookMark); |
333 } | 268 } |
334 | 269 |
335 void CJS_Context::OnLink_MouseUp(CPDFSDK_Document* pTarget) { | 270 void CJS_Context::OnLink_MouseUp(CPDFSDK_Document* pTarget) { |
336 ASSERT(m_pEventHandler != NULL); | |
337 m_pEventHandler->OnLink_MouseUp(pTarget); | 271 m_pEventHandler->OnLink_MouseUp(pTarget); |
338 } | 272 } |
339 | 273 |
340 void CJS_Context::OnConsole_Exec() { | 274 void CJS_Context::OnConsole_Exec() { |
341 ASSERT(m_pEventHandler != NULL); | |
342 m_pEventHandler->OnConsole_Exec(); | 275 m_pEventHandler->OnConsole_Exec(); |
343 } | 276 } |
344 | 277 |
345 void CJS_Context::OnExternal_Exec() { | 278 void CJS_Context::OnExternal_Exec() { |
346 ASSERT(m_pEventHandler != NULL); | |
347 m_pEventHandler->OnExternal_Exec(); | 279 m_pEventHandler->OnExternal_Exec(); |
348 } | 280 } |
349 | 281 |
350 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { | 282 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { |
351 ASSERT(m_pEventHandler != NULL); | |
352 m_pEventHandler->OnBatchExec(pTarget); | 283 m_pEventHandler->OnBatchExec(pTarget); |
353 } | 284 } |
354 | 285 |
355 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, | 286 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, |
356 const CFX_WideString& strTargetName) { | 287 const CFX_WideString& strTargetName) { |
357 ASSERT(m_pEventHandler != NULL); | |
358 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); | 288 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); |
359 } | 289 } |
OLD | NEW |