diff options
author | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
commit | b048f791a15f2da781a01eba5b09eb9d389f9c11 (patch) | |
tree | 6850a73c18bbc41eaf4b1fdc6b3c96646d45587b /fpdfsdk/src/javascript/JS_EventHandler.cpp | |
parent | c8eeed31f217d99a706b0cbf5e4ce0bcc12beb64 (diff) | |
download | pdfium-b048f791a15f2da781a01eba5b09eb9d389f9c11.tar.xz |
clang-format all pdfium code.
No behavior change.
Generated by:
find . -name '*.cpp' -o -name '*.h' | \
grep -E -v 'third_party|thirdparties|lpng_v163' | \
xargs ../../buildtools/mac/clang-format -i
See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion.
BUG=none
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1265503005 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_EventHandler.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/JS_EventHandler.cpp | 927 |
1 files changed, 476 insertions, 451 deletions
diff --git a/fpdfsdk/src/javascript/JS_EventHandler.cpp b/fpdfsdk/src/javascript/JS_EventHandler.cpp index 1769e3053f..1eee92ddc1 100644 --- a/fpdfsdk/src/javascript/JS_EventHandler.cpp +++ b/fpdfsdk/src/javascript/JS_EventHandler.cpp @@ -17,511 +17,536 @@ /* ---------------------------- CJS_EventHandler ---------------------------- */ -CJS_EventHandler::CJS_EventHandler(CJS_Context * pContext) : - m_pJSContext(pContext), - m_eEventType(JET_UNKNOWN), - m_bValid(FALSE), - m_pWideStrChange(NULL), - m_nCommitKey(-1), - m_bKeyDown(FALSE), - m_bModifier(FALSE), - m_bShift(FALSE), - m_pISelEnd(NULL), - m_nSelEndDu(0), - m_pISelStart(NULL), - m_nSelStartDu(0), - m_bWillCommit(FALSE), - m_pValue(NULL), - m_bFieldFull(FALSE), - m_pbRc(NULL), - m_bRcDu(FALSE), - m_pSourceDoc(NULL), - m_pTargetBookMark(NULL), - m_pTargetDoc(NULL), - m_pTargetAnnot(NULL) -{ -} +CJS_EventHandler::CJS_EventHandler(CJS_Context* pContext) + : m_pJSContext(pContext), + m_eEventType(JET_UNKNOWN), + m_bValid(FALSE), + m_pWideStrChange(NULL), + m_nCommitKey(-1), + m_bKeyDown(FALSE), + m_bModifier(FALSE), + m_bShift(FALSE), + m_pISelEnd(NULL), + m_nSelEndDu(0), + m_pISelStart(NULL), + m_nSelStartDu(0), + m_bWillCommit(FALSE), + m_pValue(NULL), + m_bFieldFull(FALSE), + m_pbRc(NULL), + m_bRcDu(FALSE), + m_pSourceDoc(NULL), + m_pTargetBookMark(NULL), + m_pTargetDoc(NULL), + m_pTargetAnnot(NULL) {} -CJS_EventHandler::~CJS_EventHandler() -{ -} +CJS_EventHandler::~CJS_EventHandler() {} -void CJS_EventHandler::OnApp_Init() -{ - Initial(JET_APP_INIT); +void CJS_EventHandler::OnApp_Init() { + Initial(JET_APP_INIT); } -void CJS_EventHandler::OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName) -{ - Initial(JET_DOC_OPEN); +void CJS_EventHandler::OnDoc_Open(CPDFSDK_Document* pDoc, + const CFX_WideString& strTargetName) { + Initial(JET_DOC_OPEN); - m_pTargetDoc = pDoc; - m_strTargetName = strTargetName; + m_pTargetDoc = pDoc; + m_strTargetName = strTargetName; } -void CJS_EventHandler::OnDoc_WillPrint(CPDFSDK_Document* pDoc) -{ - Initial(JET_DOC_WILLPRINT); +void CJS_EventHandler::OnDoc_WillPrint(CPDFSDK_Document* pDoc) { + Initial(JET_DOC_WILLPRINT); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } -void CJS_EventHandler::OnDoc_DidPrint(CPDFSDK_Document* pDoc) -{ - Initial(JET_DOC_DIDPRINT); +void CJS_EventHandler::OnDoc_DidPrint(CPDFSDK_Document* pDoc) { + Initial(JET_DOC_DIDPRINT); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } -void CJS_EventHandler::OnDoc_WillSave(CPDFSDK_Document* pDoc) -{ - Initial(JET_DOC_WILLSAVE); - m_pTargetDoc = pDoc; +void CJS_EventHandler::OnDoc_WillSave(CPDFSDK_Document* pDoc) { + Initial(JET_DOC_WILLSAVE); + m_pTargetDoc = pDoc; } -void CJS_EventHandler::OnDoc_DidSave(CPDFSDK_Document* pDoc) -{ - Initial(JET_DOC_DIDSAVE); +void CJS_EventHandler::OnDoc_DidSave(CPDFSDK_Document* pDoc) { + Initial(JET_DOC_DIDSAVE); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } -void CJS_EventHandler::OnDoc_WillClose(CPDFSDK_Document* pDoc) -{ - Initial(JET_DOC_WILLCLOSE); +void CJS_EventHandler::OnDoc_WillClose(CPDFSDK_Document* pDoc) { + Initial(JET_DOC_WILLCLOSE); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } -void CJS_EventHandler::OnPage_Open(CPDFSDK_Document* pDoc) -{ - Initial(JET_PAGE_OPEN); +void CJS_EventHandler::OnPage_Open(CPDFSDK_Document* pDoc) { + Initial(JET_PAGE_OPEN); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } -void CJS_EventHandler::OnPage_Close(CPDFSDK_Document* pDoc) -{ - Initial(JET_PAGE_CLOSE); +void CJS_EventHandler::OnPage_Close(CPDFSDK_Document* pDoc) { + Initial(JET_PAGE_CLOSE); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } -void CJS_EventHandler::OnPage_InView(CPDFSDK_Document* pDoc) -{ - Initial(JET_PAGE_INVIEW); +void CJS_EventHandler::OnPage_InView(CPDFSDK_Document* pDoc) { + Initial(JET_PAGE_INVIEW); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } -void CJS_EventHandler::OnPage_OutView(CPDFSDK_Document* pDoc) -{ - Initial(JET_PAGE_OUTVIEW); +void CJS_EventHandler::OnPage_OutView(CPDFSDK_Document* pDoc) { + Initial(JET_PAGE_OUTVIEW); - m_pTargetDoc = pDoc; + m_pTargetDoc = pDoc; } -void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) -{ - Initial(JET_FIELD_MOUSEENTER); +void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget) { + Initial(JET_FIELD_MOUSEENTER); - m_bModifier = bModifier; - m_bShift = bShift; + m_bModifier = bModifier; + m_bShift = bShift; - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); } -void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) -{ - Initial(JET_FIELD_MOUSEEXIT); +void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget) { + Initial(JET_FIELD_MOUSEEXIT); - m_bModifier = bModifier; - m_bShift = bShift; - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); + m_bModifier = bModifier; + m_bShift = bShift; + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); } -void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) -{ - Initial(JET_FIELD_MOUSEDOWN); - m_eEventType = JET_FIELD_MOUSEDOWN; +void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget) { + Initial(JET_FIELD_MOUSEDOWN); + m_eEventType = JET_FIELD_MOUSEDOWN; - m_bModifier = bModifier; - m_bShift = bShift; - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); + m_bModifier = bModifier; + m_bShift = bShift; + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); } -void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) -{ - Initial(JET_FIELD_MOUSEUP); +void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget) { + Initial(JET_FIELD_MOUSEUP); - m_bModifier = bModifier; - m_bShift = bShift; - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); + m_bModifier = bModifier; + m_bShift = bShift; + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); } -void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) -{ - Initial(JET_FIELD_FOCUS); +void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget, + const CFX_WideString& Value) { + Initial(JET_FIELD_FOCUS); - m_bModifier = bModifier; - m_bShift = bShift; - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); - m_pValue = (CFX_WideString*)&Value; + m_bModifier = bModifier; + m_bShift = bShift; + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); + m_pValue = (CFX_WideString*)&Value; } -void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) -{ - Initial(JET_FIELD_BLUR); +void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget, + const CFX_WideString& Value) { + Initial(JET_FIELD_BLUR); - m_bModifier = bModifier; - m_bShift = bShift; - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); - m_pValue = (CFX_WideString*)&Value; + m_bModifier = bModifier; + m_bShift = bShift; + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); + m_pValue = (CFX_WideString*)&Value; } -void CJS_EventHandler::OnField_Keystroke(CFX_WideString &strChange, - const CFX_WideString& strChangeEx, FX_BOOL KeyDown, - FX_BOOL bModifier, int& nSelEnd, int& nSelStart, - FX_BOOL bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, FX_BOOL bWillCommit, - FX_BOOL bFieldFull, FX_BOOL& bRc) -{ - Initial(JET_FIELD_KEYSTROKE); - - m_nCommitKey = 0; - m_pWideStrChange = &strChange; - m_WideStrChangeEx = strChangeEx; - m_bKeyDown = KeyDown; - m_bModifier = bModifier; - m_pISelEnd = &nSelEnd; - m_pISelStart = &nSelStart; - m_bShift = bShift; - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); - m_pValue = &Value; - m_bWillCommit = bWillCommit; - m_pbRc = &bRc; - m_bFieldFull = bFieldFull; -} - -void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL bKeyDown, FX_BOOL bModifier, FX_BOOL bShift, - CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) -{ - Initial(JET_FIELD_VALIDATE); - - m_pWideStrChange = &strChange; - m_WideStrChangeEx = strChangeEx; - m_bKeyDown = bKeyDown; - m_bModifier = bModifier; - m_bShift = bShift; - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); - m_pValue = &Value; - m_pbRc = &bRc; -} - -void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, - CFX_WideString& Value, FX_BOOL& bRc) -{ - Initial(JET_FIELD_CALCULATE); - - if (pSource) - m_strSourceName = pSource->GetFullName(); - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); - m_pValue = &Value; - m_pbRc = &bRc; +void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, + const CFX_WideString& strChangeEx, + FX_BOOL KeyDown, + FX_BOOL bModifier, + int& nSelEnd, + int& nSelStart, + FX_BOOL bShift, + CPDF_FormField* pTarget, + CFX_WideString& Value, + FX_BOOL bWillCommit, + FX_BOOL bFieldFull, + FX_BOOL& bRc) { + Initial(JET_FIELD_KEYSTROKE); + + m_nCommitKey = 0; + m_pWideStrChange = &strChange; + m_WideStrChangeEx = strChangeEx; + m_bKeyDown = KeyDown; + m_bModifier = bModifier; + m_pISelEnd = &nSelEnd; + m_pISelStart = &nSelStart; + m_bShift = bShift; + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); + m_pValue = &Value; + m_bWillCommit = bWillCommit; + m_pbRc = &bRc; + m_bFieldFull = bFieldFull; +} + +void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, + const CFX_WideString& strChangeEx, + FX_BOOL bKeyDown, + FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget, + CFX_WideString& Value, + FX_BOOL& bRc) { + Initial(JET_FIELD_VALIDATE); + + m_pWideStrChange = &strChange; + m_WideStrChangeEx = strChangeEx; + m_bKeyDown = bKeyDown; + m_bModifier = bModifier; + m_bShift = bShift; + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); + m_pValue = &Value; + m_pbRc = &bRc; +} + +void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, + CPDF_FormField* pTarget, + CFX_WideString& Value, + FX_BOOL& bRc) { + Initial(JET_FIELD_CALCULATE); + + if (pSource) + m_strSourceName = pSource->GetFullName(); + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); + m_pValue = &Value; + m_pbRc = &bRc; } void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit) -{ - Initial(JET_FIELD_FORMAT); + FX_BOOL bWillCommit) { + Initial(JET_FIELD_FORMAT); - m_nCommitKey = 0; - ASSERT(pTarget != NULL); - m_strTargetName = pTarget->GetFullName(); - m_pValue = &Value; - m_bWillCommit = bWillCommit; + m_nCommitKey = 0; + ASSERT(pTarget != NULL); + m_strTargetName = pTarget->GetFullName(); + m_pValue = &Value; + m_bWillCommit = bWillCommit; } -void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_FOCUS); +void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_FOCUS); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_BLUR); +void CJS_EventHandler::OnScreen_Blur(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_BLUR); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_OPEN); +void CJS_EventHandler::OnScreen_Open(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_OPEN); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_CLOSE); +void CJS_EventHandler::OnScreen_Close(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_CLOSE); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_MOUSEDOWN); +void CJS_EventHandler::OnScreen_MouseDown(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_MOUSEDOWN); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_MOUSEUP); +void CJS_EventHandler::OnScreen_MouseUp(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_MOUSEUP); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_MOUSEENTER); +void CJS_EventHandler::OnScreen_MouseEnter(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_MOUSEENTER); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_MOUSEEXIT); +void CJS_EventHandler::OnScreen_MouseExit(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_MOUSEEXIT); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_INVIEW); +void CJS_EventHandler::OnScreen_InView(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_INVIEW); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) -{ - Initial(JET_SCREEN_OUTVIEW); +void CJS_EventHandler::OnScreen_OutView(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) { + Initial(JET_SCREEN_OUTVIEW); - m_bModifier = bModifier; - m_bShift = bShift; - m_pTargetAnnot = pScreen; + m_bModifier = bModifier; + m_bShift = bShift; + m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnLink_MouseUp(CPDFSDK_Document* pTarget) -{ - Initial(JET_LINK_MOUSEUP); +void CJS_EventHandler::OnLink_MouseUp(CPDFSDK_Document* pTarget) { + Initial(JET_LINK_MOUSEUP); - m_pTargetDoc = pTarget; + m_pTargetDoc = pTarget; } -void CJS_EventHandler::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) -{ - Initial(JET_BOOKMARK_MOUSEUP); +void CJS_EventHandler::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) { + Initial(JET_BOOKMARK_MOUSEUP); - m_pTargetBookMark = pBookMark; + m_pTargetBookMark = pBookMark; } -void CJS_EventHandler::OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName) -{ - Initial(JET_MENU_EXEC); +void CJS_EventHandler::OnMenu_Exec(CPDFSDK_Document* pTarget, + const CFX_WideString& strTargetName) { + Initial(JET_MENU_EXEC); - m_pTargetDoc = pTarget; - m_strTargetName = strTargetName; + m_pTargetDoc = pTarget; + m_strTargetName = strTargetName; } -void CJS_EventHandler::OnExternal_Exec() -{ - Initial(JET_EXTERNAL_EXEC); +void CJS_EventHandler::OnExternal_Exec() { + Initial(JET_EXTERNAL_EXEC); } -void CJS_EventHandler::OnBatchExec(CPDFSDK_Document* pTarget) -{ - Initial(JET_BATCH_EXEC); +void CJS_EventHandler::OnBatchExec(CPDFSDK_Document* pTarget) { + Initial(JET_BATCH_EXEC); - m_pTargetDoc = pTarget; + m_pTargetDoc = pTarget; } -void CJS_EventHandler::OnConsole_Exec() -{ - Initial(JET_CONSOLE_EXEC); +void CJS_EventHandler::OnConsole_Exec() { + Initial(JET_CONSOLE_EXEC); } +void CJS_EventHandler::Initial(JS_EVENT_T type) { + m_eEventType = type; -void CJS_EventHandler::Initial(JS_EVENT_T type) -{ - m_eEventType = type; - - m_strTargetName = L""; - m_strSourceName = L""; - m_pWideStrChange = NULL; - m_WideStrChangeDu = L""; - m_WideStrChangeEx = L""; - m_nCommitKey = -1; - m_bKeyDown = FALSE; - m_bModifier = FALSE; - m_bShift = FALSE; - m_pISelEnd = NULL; - m_nSelEndDu = 0; - m_pISelStart = NULL; - m_nSelStartDu = 0; - m_bWillCommit = FALSE; - m_pValue = NULL; - m_bFieldFull = FALSE; - m_pbRc = NULL; - m_bRcDu = FALSE; + m_strTargetName = L""; + m_strSourceName = L""; + m_pWideStrChange = NULL; + m_WideStrChangeDu = L""; + m_WideStrChangeEx = L""; + m_nCommitKey = -1; + m_bKeyDown = FALSE; + m_bModifier = FALSE; + m_bShift = FALSE; + m_pISelEnd = NULL; + m_nSelEndDu = 0; + m_pISelStart = NULL; + m_nSelStartDu = 0; + m_bWillCommit = FALSE; + m_pValue = NULL; + m_bFieldFull = FALSE; + m_pbRc = NULL; + m_bRcDu = FALSE; - m_pSourceDoc = NULL; - m_pTargetBookMark = NULL; - m_pTargetDoc = NULL; - m_pTargetAnnot = NULL; + m_pSourceDoc = NULL; + m_pTargetBookMark = NULL; + m_pTargetDoc = NULL; + m_pTargetAnnot = NULL; - m_bValid = TRUE; + m_bValid = TRUE; } -void CJS_EventHandler::Destroy() -{ - m_bValid = FALSE; +void CJS_EventHandler::Destroy() { + m_bValid = FALSE; } -FX_BOOL CJS_EventHandler::IsValid() -{ - return m_bValid; +FX_BOOL CJS_EventHandler::IsValid() { + return m_bValid; } -CFX_WideString & CJS_EventHandler::Change() -{ - if (m_pWideStrChange) { - return *m_pWideStrChange; - } - return m_WideStrChangeDu; +CFX_WideString& CJS_EventHandler::Change() { + if (m_pWideStrChange) { + return *m_pWideStrChange; + } + return m_WideStrChangeDu; } -CFX_WideString CJS_EventHandler::ChangeEx() -{ - return m_WideStrChangeEx; +CFX_WideString CJS_EventHandler::ChangeEx() { + return m_WideStrChangeEx; } -int CJS_EventHandler::CommitKey() -{ - return m_nCommitKey; +int CJS_EventHandler::CommitKey() { + return m_nCommitKey; } -FX_BOOL CJS_EventHandler::FieldFull() -{ - return m_bFieldFull; +FX_BOOL CJS_EventHandler::FieldFull() { + return m_bFieldFull; } -FX_BOOL CJS_EventHandler::KeyDown() -{ - return m_bKeyDown; +FX_BOOL CJS_EventHandler::KeyDown() { + return m_bKeyDown; } -FX_BOOL CJS_EventHandler::Modifier() -{ - return m_bModifier; +FX_BOOL CJS_EventHandler::Modifier() { + return m_bModifier; } -const FX_WCHAR* CJS_EventHandler::Name() -{ - switch (m_eEventType) - { - case JET_APP_INIT: return L"Init"; - case JET_BATCH_EXEC: return L"Exec"; - case JET_BOOKMARK_MOUSEUP: return L"Mouse Up"; - case JET_CONSOLE_EXEC: return L"Exec"; - case JET_DOC_DIDPRINT: return L"DidPrint"; - case JET_DOC_DIDSAVE: return L"DidSave"; - case JET_DOC_OPEN: return L"Open"; - case JET_DOC_WILLCLOSE: return L"WillClose"; - case JET_DOC_WILLPRINT: return L"WillPrint"; - case JET_DOC_WILLSAVE: return L"WillSave"; - case JET_EXTERNAL_EXEC: return L"Exec"; +const FX_WCHAR* CJS_EventHandler::Name() { + switch (m_eEventType) { + case JET_APP_INIT: + return L"Init"; + case JET_BATCH_EXEC: + return L"Exec"; + case JET_BOOKMARK_MOUSEUP: + return L"Mouse Up"; + case JET_CONSOLE_EXEC: + return L"Exec"; + case JET_DOC_DIDPRINT: + return L"DidPrint"; + case JET_DOC_DIDSAVE: + return L"DidSave"; + case JET_DOC_OPEN: + return L"Open"; + case JET_DOC_WILLCLOSE: + return L"WillClose"; + case JET_DOC_WILLPRINT: + return L"WillPrint"; + case JET_DOC_WILLSAVE: + return L"WillSave"; + case JET_EXTERNAL_EXEC: + return L"Exec"; case JET_FIELD_FOCUS: - case JET_SCREEN_FOCUS: return L"Focus"; + case JET_SCREEN_FOCUS: + return L"Focus"; case JET_FIELD_BLUR: - case JET_SCREEN_BLUR: return L"Blur"; + case JET_SCREEN_BLUR: + return L"Blur"; case JET_FIELD_MOUSEDOWN: - case JET_SCREEN_MOUSEDOWN: return L"Mouse Down"; + case JET_SCREEN_MOUSEDOWN: + return L"Mouse Down"; case JET_FIELD_MOUSEUP: - case JET_SCREEN_MOUSEUP: return L"Mouse Up"; + case JET_SCREEN_MOUSEUP: + return L"Mouse Up"; case JET_FIELD_MOUSEENTER: - case JET_SCREEN_MOUSEENTER: return L"Mouse Enter"; + case JET_SCREEN_MOUSEENTER: + return L"Mouse Enter"; case JET_FIELD_MOUSEEXIT: - case JET_SCREEN_MOUSEEXIT: return L"Mouse Exit"; - case JET_FIELD_CALCULATE: return L"Calculate"; - case JET_FIELD_FORMAT: return L"Format"; - case JET_FIELD_KEYSTROKE: return L"Keystroke"; - case JET_FIELD_VALIDATE: return L"Validate"; - case JET_LINK_MOUSEUP: return L"Mouse Up"; - case JET_MENU_EXEC: return L"Exec"; + case JET_SCREEN_MOUSEEXIT: + return L"Mouse Exit"; + case JET_FIELD_CALCULATE: + return L"Calculate"; + case JET_FIELD_FORMAT: + return L"Format"; + case JET_FIELD_KEYSTROKE: + return L"Keystroke"; + case JET_FIELD_VALIDATE: + return L"Validate"; + case JET_LINK_MOUSEUP: + return L"Mouse Up"; + case JET_MENU_EXEC: + return L"Exec"; case JET_PAGE_OPEN: - case JET_SCREEN_OPEN: return L"Open"; + case JET_SCREEN_OPEN: + return L"Open"; case JET_PAGE_CLOSE: - case JET_SCREEN_CLOSE: return L"Close"; + case JET_SCREEN_CLOSE: + return L"Close"; case JET_SCREEN_INVIEW: - case JET_PAGE_INVIEW: return L"InView"; + case JET_PAGE_INVIEW: + return L"InView"; case JET_PAGE_OUTVIEW: - case JET_SCREEN_OUTVIEW: return L"OutView"; + case JET_SCREEN_OUTVIEW: + return L"OutView"; default: - return L""; - } - - return L""; -} - -const FX_WCHAR* CJS_EventHandler::Type() -{ - switch (m_eEventType) - { - case JET_APP_INIT: return L"App"; - case JET_BATCH_EXEC: return L"Batch"; - case JET_BOOKMARK_MOUSEUP: return L"BookMark"; - case JET_CONSOLE_EXEC: return L"Console"; + return L""; + } + + return L""; +} + +const FX_WCHAR* CJS_EventHandler::Type() { + switch (m_eEventType) { + case JET_APP_INIT: + return L"App"; + case JET_BATCH_EXEC: + return L"Batch"; + case JET_BOOKMARK_MOUSEUP: + return L"BookMark"; + case JET_CONSOLE_EXEC: + return L"Console"; case JET_DOC_DIDPRINT: case JET_DOC_DIDSAVE: case JET_DOC_OPEN: case JET_DOC_WILLCLOSE: case JET_DOC_WILLPRINT: - case JET_DOC_WILLSAVE: return L"Doc"; - case JET_EXTERNAL_EXEC: return L"External"; + case JET_DOC_WILLSAVE: + return L"Doc"; + case JET_EXTERNAL_EXEC: + return L"External"; case JET_FIELD_BLUR: case JET_FIELD_FOCUS: case JET_FIELD_MOUSEDOWN: @@ -531,7 +556,8 @@ const FX_WCHAR* CJS_EventHandler::Type() case JET_FIELD_CALCULATE: case JET_FIELD_FORMAT: case JET_FIELD_KEYSTROKE: - case JET_FIELD_VALIDATE: return L"Field"; + case JET_FIELD_VALIDATE: + return L"Field"; case JET_SCREEN_FOCUS: case JET_SCREEN_BLUR: case JET_SCREEN_OPEN: @@ -541,124 +567,123 @@ const FX_WCHAR* CJS_EventHandler::Type() case JET_SCREEN_MOUSEENTER: case JET_SCREEN_MOUSEEXIT: case JET_SCREEN_INVIEW: - case JET_SCREEN_OUTVIEW: return L"Screen"; - case JET_LINK_MOUSEUP: return L"Link"; - case JET_MENU_EXEC: return L"Menu"; + case JET_SCREEN_OUTVIEW: + return L"Screen"; + case JET_LINK_MOUSEUP: + return L"Link"; + case JET_MENU_EXEC: + return L"Menu"; case JET_PAGE_OPEN: case JET_PAGE_CLOSE: case JET_PAGE_INVIEW: - case JET_PAGE_OUTVIEW:return L"Page"; + case JET_PAGE_OUTVIEW: + return L"Page"; default: - return L""; - } + return L""; + } - return L""; + return L""; } -FX_BOOL& CJS_EventHandler::Rc() -{ - if (m_pbRc) { - return *m_pbRc; - } - return m_bRcDu; +FX_BOOL& CJS_EventHandler::Rc() { + if (m_pbRc) { + return *m_pbRc; + } + return m_bRcDu; } -int & CJS_EventHandler::SelEnd() -{ - if (m_pISelEnd) { - return *m_pISelEnd; - } - return m_nSelEndDu; +int& CJS_EventHandler::SelEnd() { + if (m_pISelEnd) { + return *m_pISelEnd; + } + return m_nSelEndDu; } -int & CJS_EventHandler::SelStart() -{ - if (m_pISelStart) { - return *m_pISelStart; - } - return m_nSelStartDu; +int& CJS_EventHandler::SelStart() { + if (m_pISelStart) { + return *m_pISelStart; + } + return m_nSelStartDu; } -FX_BOOL CJS_EventHandler::Shift() -{ - return m_bShift; +FX_BOOL CJS_EventHandler::Shift() { + return m_bShift; } -Field* CJS_EventHandler::Source() -{ - ASSERT(m_pJSContext != NULL); +Field* CJS_EventHandler::Source() { + ASSERT(m_pJSContext != NULL); - CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); + CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); - JSFXObject pDocObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Document")); - ASSERT(pDocObj.IsEmpty() == FALSE); - JSFXObject pFieldObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Field")); - ASSERT(pFieldObj.IsEmpty() == FALSE); + JSFXObject pDocObj = JS_NewFxDynamicObj( + *pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Document")); + ASSERT(pDocObj.IsEmpty() == FALSE); + JSFXObject pFieldObj = JS_NewFxDynamicObj( + *pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Field")); + ASSERT(pFieldObj.IsEmpty() == FALSE); - CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj); - ASSERT(pJSDocument != NULL); - Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); - ASSERT(pDocument != NULL); - if (m_pTargetDoc != NULL) - pDocument->AttachDoc(m_pTargetDoc); - else - pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); + CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj); + ASSERT(pJSDocument != NULL); + Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); + ASSERT(pDocument != NULL); + if (m_pTargetDoc != NULL) + pDocument->AttachDoc(m_pTargetDoc); + else + pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); - //if (m_pSourceField == NULL) - // return NULL; - //CRAO_Widget *pWidget = IBCL_Widget::GetWidget(m_pSourceField); - //CPDF_FormField* pFormField = pWidget->GetFormField(); - //ASSERT(pFormField); - //CFX_WideString csFieldName = pFormField->GetFullName(); - CJS_Field * pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj); - ASSERT(pJSField != NULL); - Field * pField = (Field *)pJSField->GetEmbedObject(); - ASSERT(pField != NULL); - pField->AttachField(pDocument, m_strSourceName); - return pField; + // if (m_pSourceField == NULL) + // return NULL; + // CRAO_Widget *pWidget = IBCL_Widget::GetWidget(m_pSourceField); + // CPDF_FormField* pFormField = pWidget->GetFormField(); + // ASSERT(pFormField); + // CFX_WideString csFieldName = pFormField->GetFullName(); + CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj); + ASSERT(pJSField != NULL); + Field* pField = (Field*)pJSField->GetEmbedObject(); + ASSERT(pField != NULL); + pField->AttachField(pDocument, m_strSourceName); + return pField; } -Field* CJS_EventHandler::Target_Field() -{ - ASSERT(m_pJSContext != NULL); +Field* CJS_EventHandler::Target_Field() { + ASSERT(m_pJSContext != NULL); - CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); + CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); - JSFXObject pDocObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Document")); - ASSERT(pDocObj.IsEmpty() == FALSE); - JSFXObject pFieldObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Field")); - ASSERT(pFieldObj.IsEmpty() == FALSE); + JSFXObject pDocObj = JS_NewFxDynamicObj( + *pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Document")); + ASSERT(pDocObj.IsEmpty() == FALSE); + JSFXObject pFieldObj = JS_NewFxDynamicObj( + *pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Field")); + ASSERT(pFieldObj.IsEmpty() == FALSE); - CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj); - ASSERT(pJSDocument != NULL); - Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); - ASSERT(pDocument != NULL); - if (m_pTargetDoc != NULL) - pDocument->AttachDoc(m_pTargetDoc); - else - pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); + CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj); + ASSERT(pJSDocument != NULL); + Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); + ASSERT(pDocument != NULL); + if (m_pTargetDoc != NULL) + pDocument->AttachDoc(m_pTargetDoc); + else + pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); - CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj); - ASSERT(pJSField != NULL); + CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj); + ASSERT(pJSField != NULL); - Field* pField = (Field *)pJSField->GetEmbedObject(); - ASSERT(pField != NULL); + Field* pField = (Field*)pJSField->GetEmbedObject(); + ASSERT(pField != NULL); - pField->AttachField(pDocument, m_strTargetName); - return pField; + pField->AttachField(pDocument, m_strTargetName); + return pField; } -CFX_WideString& CJS_EventHandler::Value() -{ - return *m_pValue; +CFX_WideString& CJS_EventHandler::Value() { + return *m_pValue; } -FX_BOOL CJS_EventHandler::WillCommit() -{ - return m_bWillCommit; +FX_BOOL CJS_EventHandler::WillCommit() { + return m_bWillCommit; } -CFX_WideString CJS_EventHandler::TargetName() -{ - return m_strTargetName; +CFX_WideString CJS_EventHandler::TargetName() { + return m_strTargetName; } |