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