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