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(NULL), | 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(NULL), | 26 m_pISelEnd(nullptr), |
27 m_nSelEndDu(0), | 27 m_nSelEndDu(0), |
28 m_pISelStart(NULL), | 28 m_pISelStart(nullptr), |
29 m_nSelStartDu(0), | 29 m_nSelStartDu(0), |
30 m_bWillCommit(FALSE), | 30 m_bWillCommit(FALSE), |
31 m_pValue(NULL), | 31 m_pValue(nullptr), |
32 m_bFieldFull(FALSE), | 32 m_bFieldFull(FALSE), |
33 m_pbRc(NULL), | 33 m_pbRc(nullptr), |
34 m_bRcDu(FALSE), | 34 m_bRcDu(FALSE), |
35 m_pSourceDoc(NULL), | 35 m_pSourceDoc(nullptr), |
36 m_pTargetBookMark(NULL), | 36 m_pTargetBookMark(nullptr), |
37 m_pTargetDoc(NULL), | 37 m_pTargetDoc(nullptr), |
38 m_pTargetAnnot(NULL) {} | 38 m_pTargetAnnot(nullptr) {} |
39 | 39 |
40 CJS_EventHandler::~CJS_EventHandler() {} | 40 CJS_EventHandler::~CJS_EventHandler() {} |
41 | 41 |
42 void CJS_EventHandler::OnApp_Init() { | 42 void CJS_EventHandler::OnApp_Init() { |
43 Initial(JET_APP_INIT); | 43 Initial(JET_APP_INIT); |
44 } | 44 } |
45 | 45 |
46 void CJS_EventHandler::OnDoc_Open(CPDFSDK_Document* pDoc, | 46 void CJS_EventHandler::OnDoc_Open(CPDFSDK_Document* pDoc, |
47 const CFX_WideString& strTargetName) { | 47 const CFX_WideString& strTargetName) { |
48 Initial(JET_DOC_OPEN); | 48 Initial(JET_DOC_OPEN); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 void CJS_EventHandler::OnConsole_Exec() { | 376 void CJS_EventHandler::OnConsole_Exec() { |
377 Initial(JET_CONSOLE_EXEC); | 377 Initial(JET_CONSOLE_EXEC); |
378 } | 378 } |
379 | 379 |
380 void CJS_EventHandler::Initial(JS_EVENT_T type) { | 380 void CJS_EventHandler::Initial(JS_EVENT_T type) { |
381 m_eEventType = type; | 381 m_eEventType = type; |
382 | 382 |
383 m_strTargetName = L""; | 383 m_strTargetName = L""; |
384 m_strSourceName = L""; | 384 m_strSourceName = L""; |
385 m_pWideStrChange = NULL; | 385 m_pWideStrChange = nullptr; |
386 m_WideStrChangeDu = L""; | 386 m_WideStrChangeDu = L""; |
387 m_WideStrChangeEx = L""; | 387 m_WideStrChangeEx = L""; |
388 m_nCommitKey = -1; | 388 m_nCommitKey = -1; |
389 m_bKeyDown = FALSE; | 389 m_bKeyDown = FALSE; |
390 m_bModifier = FALSE; | 390 m_bModifier = FALSE; |
391 m_bShift = FALSE; | 391 m_bShift = FALSE; |
392 m_pISelEnd = NULL; | 392 m_pISelEnd = nullptr; |
393 m_nSelEndDu = 0; | 393 m_nSelEndDu = 0; |
394 m_pISelStart = NULL; | 394 m_pISelStart = nullptr; |
395 m_nSelStartDu = 0; | 395 m_nSelStartDu = 0; |
396 m_bWillCommit = FALSE; | 396 m_bWillCommit = FALSE; |
397 m_pValue = NULL; | 397 m_pValue = nullptr; |
398 m_bFieldFull = FALSE; | 398 m_bFieldFull = FALSE; |
399 m_pbRc = NULL; | 399 m_pbRc = nullptr; |
400 m_bRcDu = FALSE; | 400 m_bRcDu = FALSE; |
401 | 401 |
402 m_pSourceDoc = NULL; | 402 m_pSourceDoc = nullptr; |
403 m_pTargetBookMark = NULL; | 403 m_pTargetBookMark = nullptr; |
404 m_pTargetDoc = NULL; | 404 m_pTargetDoc = nullptr; |
405 m_pTargetAnnot = NULL; | 405 m_pTargetAnnot = nullptr; |
406 | 406 |
407 m_bValid = TRUE; | 407 m_bValid = TRUE; |
408 } | 408 } |
409 | 409 |
410 void CJS_EventHandler::Destroy() { | 410 void CJS_EventHandler::Destroy() { |
411 m_bValid = FALSE; | 411 m_bValid = FALSE; |
412 } | 412 } |
413 | 413 |
414 FX_BOOL CJS_EventHandler::IsValid() { | 414 FX_BOOL CJS_EventHandler::IsValid() { |
415 return m_bValid; | 415 return m_bValid; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 return *m_pValue; | 643 return *m_pValue; |
644 } | 644 } |
645 | 645 |
646 FX_BOOL CJS_EventHandler::WillCommit() { | 646 FX_BOOL CJS_EventHandler::WillCommit() { |
647 return m_bWillCommit; | 647 return m_bWillCommit; |
648 } | 648 } |
649 | 649 |
650 CFX_WideString CJS_EventHandler::TargetName() { | 650 CFX_WideString CJS_EventHandler::TargetName() { |
651 return m_strTargetName; | 651 return m_strTargetName; |
652 } | 652 } |
OLD | NEW |