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 "fpdfsdk/javascript/JS_EventHandler.h" | 7 #include "fpdfsdk/javascript/JS_EventHandler.h" |
8 | 8 |
9 #include "fpdfsdk/javascript/Document.h" | 9 #include "fpdfsdk/javascript/Document.h" |
10 #include "fpdfsdk/javascript/Field.h" | 10 #include "fpdfsdk/javascript/Field.h" |
11 #include "fpdfsdk/javascript/JS_Define.h" | 11 #include "fpdfsdk/javascript/JS_Define.h" |
12 #include "fpdfsdk/javascript/JS_Object.h" | 12 #include "fpdfsdk/javascript/JS_Object.h" |
13 #include "fpdfsdk/javascript/JS_Value.h" | 13 #include "fpdfsdk/javascript/JS_Value.h" |
14 #include "fpdfsdk/javascript/cjs_context.h" | 14 #include "fpdfsdk/javascript/cjs_context.h" |
15 #include "fpdfsdk/javascript/cjs_runtime.h" | 15 #include "fpdfsdk/javascript/cjs_runtime.h" |
16 | 16 |
17 CJS_EventHandler::CJS_EventHandler(CJS_Context* pContext) | 17 CJS_EventHandler::CJS_EventHandler(CJS_Context* pContext) |
18 : m_pJSContext(pContext), | 18 : m_pJSContext(pContext), |
19 m_eEventType(JET_UNKNOWN), | 19 m_eEventType(JET_UNKNOWN), |
20 m_bValid(FALSE), | 20 m_bValid(false), |
21 m_pWideStrChange(nullptr), | 21 m_pWideStrChange(nullptr), |
22 m_nCommitKey(-1), | 22 m_nCommitKey(-1), |
23 m_bKeyDown(FALSE), | 23 m_bKeyDown(false), |
24 m_bModifier(FALSE), | 24 m_bModifier(false), |
25 m_bShift(FALSE), | 25 m_bShift(false), |
26 m_pISelEnd(nullptr), | 26 m_pISelEnd(nullptr), |
27 m_nSelEndDu(0), | 27 m_nSelEndDu(0), |
28 m_pISelStart(nullptr), | 28 m_pISelStart(nullptr), |
29 m_nSelStartDu(0), | 29 m_nSelStartDu(0), |
30 m_bWillCommit(FALSE), | 30 m_bWillCommit(false), |
31 m_pValue(nullptr), | 31 m_pValue(nullptr), |
32 m_bFieldFull(FALSE), | 32 m_bFieldFull(false), |
33 m_pbRc(nullptr), | 33 m_pbRc(nullptr), |
34 m_bRcDu(FALSE), | 34 m_bRcDu(false), |
35 m_pTargetBookMark(nullptr), | 35 m_pTargetBookMark(nullptr), |
36 m_pTargetFormFillEnv(nullptr), | 36 m_pTargetFormFillEnv(nullptr), |
37 m_pTargetAnnot(nullptr) {} | 37 m_pTargetAnnot(nullptr) {} |
38 | 38 |
39 CJS_EventHandler::~CJS_EventHandler() {} | 39 CJS_EventHandler::~CJS_EventHandler() {} |
40 | 40 |
41 void CJS_EventHandler::OnApp_Init() { | 41 void CJS_EventHandler::OnApp_Init() { |
42 Initial(JET_APP_INIT); | 42 Initial(JET_APP_INIT); |
43 } | 43 } |
44 | 44 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 Initial(JET_PAGE_INVIEW); | 94 Initial(JET_PAGE_INVIEW); |
95 m_pTargetFormFillEnv = pFormFillEnv; | 95 m_pTargetFormFillEnv = pFormFillEnv; |
96 } | 96 } |
97 | 97 |
98 void CJS_EventHandler::OnPage_OutView( | 98 void CJS_EventHandler::OnPage_OutView( |
99 CPDFSDK_FormFillEnvironment* pFormFillEnv) { | 99 CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
100 Initial(JET_PAGE_OUTVIEW); | 100 Initial(JET_PAGE_OUTVIEW); |
101 m_pTargetFormFillEnv = pFormFillEnv; | 101 m_pTargetFormFillEnv = pFormFillEnv; |
102 } | 102 } |
103 | 103 |
104 void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, | 104 void CJS_EventHandler::OnField_MouseEnter(bool bModifier, |
105 FX_BOOL bShift, | 105 bool bShift, |
106 CPDF_FormField* pTarget) { | 106 CPDF_FormField* pTarget) { |
107 Initial(JET_FIELD_MOUSEENTER); | 107 Initial(JET_FIELD_MOUSEENTER); |
108 | 108 |
109 m_bModifier = bModifier; | 109 m_bModifier = bModifier; |
110 m_bShift = bShift; | 110 m_bShift = bShift; |
111 | 111 |
112 m_strTargetName = pTarget->GetFullName(); | 112 m_strTargetName = pTarget->GetFullName(); |
113 } | 113 } |
114 | 114 |
115 void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, | 115 void CJS_EventHandler::OnField_MouseExit(bool bModifier, |
116 FX_BOOL bShift, | 116 bool bShift, |
117 CPDF_FormField* pTarget) { | 117 CPDF_FormField* pTarget) { |
118 Initial(JET_FIELD_MOUSEEXIT); | 118 Initial(JET_FIELD_MOUSEEXIT); |
119 | 119 |
120 m_bModifier = bModifier; | 120 m_bModifier = bModifier; |
121 m_bShift = bShift; | 121 m_bShift = bShift; |
122 m_strTargetName = pTarget->GetFullName(); | 122 m_strTargetName = pTarget->GetFullName(); |
123 } | 123 } |
124 | 124 |
125 void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, | 125 void CJS_EventHandler::OnField_MouseDown(bool bModifier, |
126 FX_BOOL bShift, | 126 bool bShift, |
127 CPDF_FormField* pTarget) { | 127 CPDF_FormField* pTarget) { |
128 Initial(JET_FIELD_MOUSEDOWN); | 128 Initial(JET_FIELD_MOUSEDOWN); |
129 m_eEventType = JET_FIELD_MOUSEDOWN; | 129 m_eEventType = JET_FIELD_MOUSEDOWN; |
130 | 130 |
131 m_bModifier = bModifier; | 131 m_bModifier = bModifier; |
132 m_bShift = bShift; | 132 m_bShift = bShift; |
133 m_strTargetName = pTarget->GetFullName(); | 133 m_strTargetName = pTarget->GetFullName(); |
134 } | 134 } |
135 | 135 |
136 void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, | 136 void CJS_EventHandler::OnField_MouseUp(bool bModifier, |
137 FX_BOOL bShift, | 137 bool bShift, |
138 CPDF_FormField* pTarget) { | 138 CPDF_FormField* pTarget) { |
139 Initial(JET_FIELD_MOUSEUP); | 139 Initial(JET_FIELD_MOUSEUP); |
140 | 140 |
141 m_bModifier = bModifier; | 141 m_bModifier = bModifier; |
142 m_bShift = bShift; | 142 m_bShift = bShift; |
143 m_strTargetName = pTarget->GetFullName(); | 143 m_strTargetName = pTarget->GetFullName(); |
144 } | 144 } |
145 | 145 |
146 void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, | 146 void CJS_EventHandler::OnField_Focus(bool bModifier, |
147 FX_BOOL bShift, | 147 bool bShift, |
148 CPDF_FormField* pTarget, | 148 CPDF_FormField* pTarget, |
149 const CFX_WideString& Value) { | 149 const CFX_WideString& Value) { |
150 Initial(JET_FIELD_FOCUS); | 150 Initial(JET_FIELD_FOCUS); |
151 | 151 |
152 m_bModifier = bModifier; | 152 m_bModifier = bModifier; |
153 m_bShift = bShift; | 153 m_bShift = bShift; |
154 m_strTargetName = pTarget->GetFullName(); | 154 m_strTargetName = pTarget->GetFullName(); |
155 m_pValue = (CFX_WideString*)&Value; | 155 m_pValue = (CFX_WideString*)&Value; |
156 } | 156 } |
157 | 157 |
158 void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, | 158 void CJS_EventHandler::OnField_Blur(bool bModifier, |
159 FX_BOOL bShift, | 159 bool bShift, |
160 CPDF_FormField* pTarget, | 160 CPDF_FormField* pTarget, |
161 const CFX_WideString& Value) { | 161 const CFX_WideString& Value) { |
162 Initial(JET_FIELD_BLUR); | 162 Initial(JET_FIELD_BLUR); |
163 | 163 |
164 m_bModifier = bModifier; | 164 m_bModifier = bModifier; |
165 m_bShift = bShift; | 165 m_bShift = bShift; |
166 m_strTargetName = pTarget->GetFullName(); | 166 m_strTargetName = pTarget->GetFullName(); |
167 m_pValue = (CFX_WideString*)&Value; | 167 m_pValue = (CFX_WideString*)&Value; |
168 } | 168 } |
169 | 169 |
170 void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, | 170 void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, |
171 const CFX_WideString& strChangeEx, | 171 const CFX_WideString& strChangeEx, |
172 FX_BOOL KeyDown, | 172 bool KeyDown, |
173 FX_BOOL bModifier, | 173 bool bModifier, |
174 int& nSelEnd, | 174 int& nSelEnd, |
175 int& nSelStart, | 175 int& nSelStart, |
176 FX_BOOL bShift, | 176 bool bShift, |
177 CPDF_FormField* pTarget, | 177 CPDF_FormField* pTarget, |
178 CFX_WideString& Value, | 178 CFX_WideString& Value, |
179 FX_BOOL bWillCommit, | 179 bool bWillCommit, |
180 FX_BOOL bFieldFull, | 180 bool bFieldFull, |
181 FX_BOOL& bRc) { | 181 bool& bRc) { |
182 Initial(JET_FIELD_KEYSTROKE); | 182 Initial(JET_FIELD_KEYSTROKE); |
183 | 183 |
184 m_nCommitKey = 0; | 184 m_nCommitKey = 0; |
185 m_pWideStrChange = &strChange; | 185 m_pWideStrChange = &strChange; |
186 m_WideStrChangeEx = strChangeEx; | 186 m_WideStrChangeEx = strChangeEx; |
187 m_bKeyDown = KeyDown; | 187 m_bKeyDown = KeyDown; |
188 m_bModifier = bModifier; | 188 m_bModifier = bModifier; |
189 m_pISelEnd = &nSelEnd; | 189 m_pISelEnd = &nSelEnd; |
190 m_pISelStart = &nSelStart; | 190 m_pISelStart = &nSelStart; |
191 m_bShift = bShift; | 191 m_bShift = bShift; |
192 m_strTargetName = pTarget->GetFullName(); | 192 m_strTargetName = pTarget->GetFullName(); |
193 m_pValue = &Value; | 193 m_pValue = &Value; |
194 m_bWillCommit = bWillCommit; | 194 m_bWillCommit = bWillCommit; |
195 m_pbRc = &bRc; | 195 m_pbRc = &bRc; |
196 m_bFieldFull = bFieldFull; | 196 m_bFieldFull = bFieldFull; |
197 } | 197 } |
198 | 198 |
199 void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, | 199 void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, |
200 const CFX_WideString& strChangeEx, | 200 const CFX_WideString& strChangeEx, |
201 FX_BOOL bKeyDown, | 201 bool bKeyDown, |
202 FX_BOOL bModifier, | 202 bool bModifier, |
203 FX_BOOL bShift, | 203 bool bShift, |
204 CPDF_FormField* pTarget, | 204 CPDF_FormField* pTarget, |
205 CFX_WideString& Value, | 205 CFX_WideString& Value, |
206 FX_BOOL& bRc) { | 206 bool& bRc) { |
207 Initial(JET_FIELD_VALIDATE); | 207 Initial(JET_FIELD_VALIDATE); |
208 | 208 |
209 m_pWideStrChange = &strChange; | 209 m_pWideStrChange = &strChange; |
210 m_WideStrChangeEx = strChangeEx; | 210 m_WideStrChangeEx = strChangeEx; |
211 m_bKeyDown = bKeyDown; | 211 m_bKeyDown = bKeyDown; |
212 m_bModifier = bModifier; | 212 m_bModifier = bModifier; |
213 m_bShift = bShift; | 213 m_bShift = bShift; |
214 m_strTargetName = pTarget->GetFullName(); | 214 m_strTargetName = pTarget->GetFullName(); |
215 m_pValue = &Value; | 215 m_pValue = &Value; |
216 m_pbRc = &bRc; | 216 m_pbRc = &bRc; |
217 } | 217 } |
218 | 218 |
219 void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, | 219 void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, |
220 CPDF_FormField* pTarget, | 220 CPDF_FormField* pTarget, |
221 CFX_WideString& Value, | 221 CFX_WideString& Value, |
222 FX_BOOL& bRc) { | 222 bool& bRc) { |
223 Initial(JET_FIELD_CALCULATE); | 223 Initial(JET_FIELD_CALCULATE); |
224 | 224 |
225 if (pSource) | 225 if (pSource) |
226 m_strSourceName = pSource->GetFullName(); | 226 m_strSourceName = pSource->GetFullName(); |
227 m_strTargetName = pTarget->GetFullName(); | 227 m_strTargetName = pTarget->GetFullName(); |
228 m_pValue = &Value; | 228 m_pValue = &Value; |
229 m_pbRc = &bRc; | 229 m_pbRc = &bRc; |
230 } | 230 } |
231 | 231 |
232 void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, | 232 void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, |
233 CFX_WideString& Value, | 233 CFX_WideString& Value, |
234 FX_BOOL bWillCommit) { | 234 bool bWillCommit) { |
235 Initial(JET_FIELD_FORMAT); | 235 Initial(JET_FIELD_FORMAT); |
236 | 236 |
237 m_nCommitKey = 0; | 237 m_nCommitKey = 0; |
238 m_strTargetName = pTarget->GetFullName(); | 238 m_strTargetName = pTarget->GetFullName(); |
239 m_pValue = &Value; | 239 m_pValue = &Value; |
240 m_bWillCommit = bWillCommit; | 240 m_bWillCommit = bWillCommit; |
241 } | 241 } |
242 | 242 |
243 void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier, | 243 void CJS_EventHandler::OnScreen_Focus(bool bModifier, |
244 FX_BOOL bShift, | 244 bool bShift, |
245 CPDFSDK_Annot* pScreen) { | 245 CPDFSDK_Annot* pScreen) { |
246 Initial(JET_SCREEN_FOCUS); | 246 Initial(JET_SCREEN_FOCUS); |
247 | 247 |
248 m_bModifier = bModifier; | 248 m_bModifier = bModifier; |
249 m_bShift = bShift; | 249 m_bShift = bShift; |
250 m_pTargetAnnot = pScreen; | 250 m_pTargetAnnot = pScreen; |
251 } | 251 } |
252 | 252 |
253 void CJS_EventHandler::OnScreen_Blur(FX_BOOL bModifier, | 253 void CJS_EventHandler::OnScreen_Blur(bool bModifier, |
254 FX_BOOL bShift, | 254 bool bShift, |
255 CPDFSDK_Annot* pScreen) { | 255 CPDFSDK_Annot* pScreen) { |
256 Initial(JET_SCREEN_BLUR); | 256 Initial(JET_SCREEN_BLUR); |
257 | 257 |
258 m_bModifier = bModifier; | 258 m_bModifier = bModifier; |
259 m_bShift = bShift; | 259 m_bShift = bShift; |
260 m_pTargetAnnot = pScreen; | 260 m_pTargetAnnot = pScreen; |
261 } | 261 } |
262 | 262 |
263 void CJS_EventHandler::OnScreen_Open(FX_BOOL bModifier, | 263 void CJS_EventHandler::OnScreen_Open(bool bModifier, |
264 FX_BOOL bShift, | 264 bool bShift, |
265 CPDFSDK_Annot* pScreen) { | 265 CPDFSDK_Annot* pScreen) { |
266 Initial(JET_SCREEN_OPEN); | 266 Initial(JET_SCREEN_OPEN); |
267 | 267 |
268 m_bModifier = bModifier; | 268 m_bModifier = bModifier; |
269 m_bShift = bShift; | 269 m_bShift = bShift; |
270 m_pTargetAnnot = pScreen; | 270 m_pTargetAnnot = pScreen; |
271 } | 271 } |
272 | 272 |
273 void CJS_EventHandler::OnScreen_Close(FX_BOOL bModifier, | 273 void CJS_EventHandler::OnScreen_Close(bool bModifier, |
274 FX_BOOL bShift, | 274 bool bShift, |
275 CPDFSDK_Annot* pScreen) { | 275 CPDFSDK_Annot* pScreen) { |
276 Initial(JET_SCREEN_CLOSE); | 276 Initial(JET_SCREEN_CLOSE); |
277 | 277 |
278 m_bModifier = bModifier; | 278 m_bModifier = bModifier; |
279 m_bShift = bShift; | 279 m_bShift = bShift; |
280 m_pTargetAnnot = pScreen; | 280 m_pTargetAnnot = pScreen; |
281 } | 281 } |
282 | 282 |
283 void CJS_EventHandler::OnScreen_MouseDown(FX_BOOL bModifier, | 283 void CJS_EventHandler::OnScreen_MouseDown(bool bModifier, |
284 FX_BOOL bShift, | 284 bool bShift, |
285 CPDFSDK_Annot* pScreen) { | 285 CPDFSDK_Annot* pScreen) { |
286 Initial(JET_SCREEN_MOUSEDOWN); | 286 Initial(JET_SCREEN_MOUSEDOWN); |
287 | 287 |
288 m_bModifier = bModifier; | 288 m_bModifier = bModifier; |
289 m_bShift = bShift; | 289 m_bShift = bShift; |
290 m_pTargetAnnot = pScreen; | 290 m_pTargetAnnot = pScreen; |
291 } | 291 } |
292 | 292 |
293 void CJS_EventHandler::OnScreen_MouseUp(FX_BOOL bModifier, | 293 void CJS_EventHandler::OnScreen_MouseUp(bool bModifier, |
294 FX_BOOL bShift, | 294 bool bShift, |
295 CPDFSDK_Annot* pScreen) { | 295 CPDFSDK_Annot* pScreen) { |
296 Initial(JET_SCREEN_MOUSEUP); | 296 Initial(JET_SCREEN_MOUSEUP); |
297 | 297 |
298 m_bModifier = bModifier; | 298 m_bModifier = bModifier; |
299 m_bShift = bShift; | 299 m_bShift = bShift; |
300 m_pTargetAnnot = pScreen; | 300 m_pTargetAnnot = pScreen; |
301 } | 301 } |
302 | 302 |
303 void CJS_EventHandler::OnScreen_MouseEnter(FX_BOOL bModifier, | 303 void CJS_EventHandler::OnScreen_MouseEnter(bool bModifier, |
304 FX_BOOL bShift, | 304 bool bShift, |
305 CPDFSDK_Annot* pScreen) { | 305 CPDFSDK_Annot* pScreen) { |
306 Initial(JET_SCREEN_MOUSEENTER); | 306 Initial(JET_SCREEN_MOUSEENTER); |
307 | 307 |
308 m_bModifier = bModifier; | 308 m_bModifier = bModifier; |
309 m_bShift = bShift; | 309 m_bShift = bShift; |
310 m_pTargetAnnot = pScreen; | 310 m_pTargetAnnot = pScreen; |
311 } | 311 } |
312 | 312 |
313 void CJS_EventHandler::OnScreen_MouseExit(FX_BOOL bModifier, | 313 void CJS_EventHandler::OnScreen_MouseExit(bool bModifier, |
314 FX_BOOL bShift, | 314 bool bShift, |
315 CPDFSDK_Annot* pScreen) { | 315 CPDFSDK_Annot* pScreen) { |
316 Initial(JET_SCREEN_MOUSEEXIT); | 316 Initial(JET_SCREEN_MOUSEEXIT); |
317 | 317 |
318 m_bModifier = bModifier; | 318 m_bModifier = bModifier; |
319 m_bShift = bShift; | 319 m_bShift = bShift; |
320 m_pTargetAnnot = pScreen; | 320 m_pTargetAnnot = pScreen; |
321 } | 321 } |
322 | 322 |
323 void CJS_EventHandler::OnScreen_InView(FX_BOOL bModifier, | 323 void CJS_EventHandler::OnScreen_InView(bool bModifier, |
324 FX_BOOL bShift, | 324 bool bShift, |
325 CPDFSDK_Annot* pScreen) { | 325 CPDFSDK_Annot* pScreen) { |
326 Initial(JET_SCREEN_INVIEW); | 326 Initial(JET_SCREEN_INVIEW); |
327 | 327 |
328 m_bModifier = bModifier; | 328 m_bModifier = bModifier; |
329 m_bShift = bShift; | 329 m_bShift = bShift; |
330 m_pTargetAnnot = pScreen; | 330 m_pTargetAnnot = pScreen; |
331 } | 331 } |
332 | 332 |
333 void CJS_EventHandler::OnScreen_OutView(FX_BOOL bModifier, | 333 void CJS_EventHandler::OnScreen_OutView(bool bModifier, |
334 FX_BOOL bShift, | 334 bool bShift, |
335 CPDFSDK_Annot* pScreen) { | 335 CPDFSDK_Annot* pScreen) { |
336 Initial(JET_SCREEN_OUTVIEW); | 336 Initial(JET_SCREEN_OUTVIEW); |
337 | 337 |
338 m_bModifier = bModifier; | 338 m_bModifier = bModifier; |
339 m_bShift = bShift; | 339 m_bShift = bShift; |
340 m_pTargetAnnot = pScreen; | 340 m_pTargetAnnot = pScreen; |
341 } | 341 } |
342 | 342 |
343 void CJS_EventHandler::OnLink_MouseUp( | 343 void CJS_EventHandler::OnLink_MouseUp( |
344 CPDFSDK_FormFillEnvironment* pTargetFormFillEnv) { | 344 CPDFSDK_FormFillEnvironment* pTargetFormFillEnv) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 void CJS_EventHandler::Initial(JS_EVENT_T type) { | 377 void CJS_EventHandler::Initial(JS_EVENT_T type) { |
378 m_eEventType = type; | 378 m_eEventType = type; |
379 | 379 |
380 m_strTargetName = L""; | 380 m_strTargetName = L""; |
381 m_strSourceName = L""; | 381 m_strSourceName = L""; |
382 m_pWideStrChange = nullptr; | 382 m_pWideStrChange = nullptr; |
383 m_WideStrChangeDu = L""; | 383 m_WideStrChangeDu = L""; |
384 m_WideStrChangeEx = L""; | 384 m_WideStrChangeEx = L""; |
385 m_nCommitKey = -1; | 385 m_nCommitKey = -1; |
386 m_bKeyDown = FALSE; | 386 m_bKeyDown = false; |
387 m_bModifier = FALSE; | 387 m_bModifier = false; |
388 m_bShift = FALSE; | 388 m_bShift = false; |
389 m_pISelEnd = nullptr; | 389 m_pISelEnd = nullptr; |
390 m_nSelEndDu = 0; | 390 m_nSelEndDu = 0; |
391 m_pISelStart = nullptr; | 391 m_pISelStart = nullptr; |
392 m_nSelStartDu = 0; | 392 m_nSelStartDu = 0; |
393 m_bWillCommit = FALSE; | 393 m_bWillCommit = false; |
394 m_pValue = nullptr; | 394 m_pValue = nullptr; |
395 m_bFieldFull = FALSE; | 395 m_bFieldFull = false; |
396 m_pbRc = nullptr; | 396 m_pbRc = nullptr; |
397 m_bRcDu = FALSE; | 397 m_bRcDu = false; |
398 | 398 |
399 m_pTargetBookMark = nullptr; | 399 m_pTargetBookMark = nullptr; |
400 m_pTargetFormFillEnv = nullptr; | 400 m_pTargetFormFillEnv = nullptr; |
401 m_pTargetAnnot = nullptr; | 401 m_pTargetAnnot = nullptr; |
402 | 402 |
403 m_bValid = TRUE; | 403 m_bValid = true; |
404 } | 404 } |
405 | 405 |
406 void CJS_EventHandler::Destroy() { | 406 void CJS_EventHandler::Destroy() { |
407 m_bValid = FALSE; | 407 m_bValid = false; |
408 } | 408 } |
409 | 409 |
410 FX_BOOL CJS_EventHandler::IsValid() { | 410 bool CJS_EventHandler::IsValid() { |
411 return m_bValid; | 411 return m_bValid; |
412 } | 412 } |
413 | 413 |
414 CFX_WideString& CJS_EventHandler::Change() { | 414 CFX_WideString& CJS_EventHandler::Change() { |
415 if (m_pWideStrChange) { | 415 if (m_pWideStrChange) { |
416 return *m_pWideStrChange; | 416 return *m_pWideStrChange; |
417 } | 417 } |
418 return m_WideStrChangeDu; | 418 return m_WideStrChangeDu; |
419 } | 419 } |
420 | 420 |
421 CFX_WideString CJS_EventHandler::ChangeEx() { | 421 CFX_WideString CJS_EventHandler::ChangeEx() { |
422 return m_WideStrChangeEx; | 422 return m_WideStrChangeEx; |
423 } | 423 } |
424 | 424 |
425 int CJS_EventHandler::CommitKey() { | 425 int CJS_EventHandler::CommitKey() { |
426 return m_nCommitKey; | 426 return m_nCommitKey; |
427 } | 427 } |
428 | 428 |
429 FX_BOOL CJS_EventHandler::FieldFull() { | 429 bool CJS_EventHandler::FieldFull() { |
430 return m_bFieldFull; | 430 return m_bFieldFull; |
431 } | 431 } |
432 | 432 |
433 FX_BOOL CJS_EventHandler::KeyDown() { | 433 bool CJS_EventHandler::KeyDown() { |
434 return m_bKeyDown; | 434 return m_bKeyDown; |
435 } | 435 } |
436 | 436 |
437 FX_BOOL CJS_EventHandler::Modifier() { | 437 bool CJS_EventHandler::Modifier() { |
438 return m_bModifier; | 438 return m_bModifier; |
439 } | 439 } |
440 | 440 |
441 const FX_WCHAR* CJS_EventHandler::Name() { | 441 const FX_WCHAR* CJS_EventHandler::Name() { |
442 switch (m_eEventType) { | 442 switch (m_eEventType) { |
443 case JET_APP_INIT: | 443 case JET_APP_INIT: |
444 return L"Init"; | 444 return L"Init"; |
445 case JET_BATCH_EXEC: | 445 case JET_BATCH_EXEC: |
446 return L"Exec"; | 446 return L"Exec"; |
447 case JET_BOOKMARK_MOUSEUP: | 447 case JET_BOOKMARK_MOUSEUP: |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 case JET_PAGE_OPEN: | 557 case JET_PAGE_OPEN: |
558 case JET_PAGE_CLOSE: | 558 case JET_PAGE_CLOSE: |
559 case JET_PAGE_INVIEW: | 559 case JET_PAGE_INVIEW: |
560 case JET_PAGE_OUTVIEW: | 560 case JET_PAGE_OUTVIEW: |
561 return L"Page"; | 561 return L"Page"; |
562 default: | 562 default: |
563 return L""; | 563 return L""; |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 FX_BOOL& CJS_EventHandler::Rc() { | 567 bool& CJS_EventHandler::Rc() { |
568 if (m_pbRc) { | 568 if (m_pbRc) { |
569 return *m_pbRc; | 569 return *m_pbRc; |
570 } | 570 } |
571 return m_bRcDu; | 571 return m_bRcDu; |
572 } | 572 } |
573 | 573 |
574 int& CJS_EventHandler::SelEnd() { | 574 int& CJS_EventHandler::SelEnd() { |
575 if (m_pISelEnd) { | 575 if (m_pISelEnd) { |
576 return *m_pISelEnd; | 576 return *m_pISelEnd; |
577 } | 577 } |
578 return m_nSelEndDu; | 578 return m_nSelEndDu; |
579 } | 579 } |
580 | 580 |
581 int& CJS_EventHandler::SelStart() { | 581 int& CJS_EventHandler::SelStart() { |
582 if (m_pISelStart) { | 582 if (m_pISelStart) { |
583 return *m_pISelStart; | 583 return *m_pISelStart; |
584 } | 584 } |
585 return m_nSelStartDu; | 585 return m_nSelStartDu; |
586 } | 586 } |
587 | 587 |
588 FX_BOOL CJS_EventHandler::Shift() { | 588 bool CJS_EventHandler::Shift() { |
589 return m_bShift; | 589 return m_bShift; |
590 } | 590 } |
591 | 591 |
592 Field* CJS_EventHandler::Source() { | 592 Field* CJS_EventHandler::Source() { |
593 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); | 593 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); |
594 v8::Local<v8::Object> pDocObj = | 594 v8::Local<v8::Object> pDocObj = |
595 pRuntime->NewFxDynamicObj(CJS_Document::g_nObjDefnID); | 595 pRuntime->NewFxDynamicObj(CJS_Document::g_nObjDefnID); |
596 ASSERT(!pDocObj.IsEmpty()); | 596 ASSERT(!pDocObj.IsEmpty()); |
597 | 597 |
598 v8::Local<v8::Object> pFieldObj = | 598 v8::Local<v8::Object> pFieldObj = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pFieldObj)); | 634 static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pFieldObj)); |
635 Field* pField = (Field*)pJSField->GetEmbedObject(); | 635 Field* pField = (Field*)pJSField->GetEmbedObject(); |
636 pField->AttachField(pDocument, m_strTargetName); | 636 pField->AttachField(pDocument, m_strTargetName); |
637 return pField; | 637 return pField; |
638 } | 638 } |
639 | 639 |
640 CFX_WideString& CJS_EventHandler::Value() { | 640 CFX_WideString& CJS_EventHandler::Value() { |
641 return *m_pValue; | 641 return *m_pValue; |
642 } | 642 } |
643 | 643 |
644 FX_BOOL CJS_EventHandler::WillCommit() { | 644 bool CJS_EventHandler::WillCommit() { |
645 return m_bWillCommit; | 645 return m_bWillCommit; |
646 } | 646 } |
647 | 647 |
648 CFX_WideString CJS_EventHandler::TargetName() { | 648 CFX_WideString CJS_EventHandler::TargetName() { |
649 return m_strTargetName; | 649 return m_strTargetName; |
650 } | 650 } |
OLD | NEW |