diff options
author | dsinclair <dsinclair@chromium.org> | 2016-05-04 13:51:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-04 13:51:51 -0700 |
commit | 8f4bf9a8ac211e150f7fa4d8ed061f264cb3aa9e (patch) | |
tree | 9ac5bb23a12623ea77ecb13e74a665733efedc8c /xfa/fxfa | |
parent | 7d89e728a450c681c53d40d7f67ee2eef0400705 (diff) | |
download | pdfium-8f4bf9a8ac211e150f7fa4d8ed061f264cb3aa9e.tar.xz |
More define cleanup.
This CL converts defines into constants, enums, enum classes or removes them
as needed.
Review-Url: https://codereview.chromium.org/1938163002
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/app/xfa_ffcheckbutton.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fffield.cpp | 32 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffimageedit.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/include/fxfa.h | 228 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp | 84 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_eventpseudomodel.h | 38 |
7 files changed, 200 insertions, 190 deletions
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index 11deff1186..b75fcd5ab0 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -250,7 +250,7 @@ FX_BOOL CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags, } SetButtonDown(FALSE); CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_LButtonUp; + ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index a0744def07..f56d5a1ece 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -349,7 +349,7 @@ FX_BOOL CXFA_FFField::OnMouseEnter() { return FALSE; } CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_MouseEnter; + ms.m_dwCmd = FWL_MouseCommand::Enter; ms.m_pDstTarget = m_pNormalWidget->m_pIface; ms.m_pSrcTarget = NULL; TranslateFWLMessage(&ms); @@ -360,7 +360,7 @@ FX_BOOL CXFA_FFField::OnMouseExit() { return FALSE; } CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_MouseLeave; + ms.m_dwCmd = FWL_MouseCommand::Leave; ms.m_pDstTarget = m_pNormalWidget->m_pIface; TranslateFWLMessage(&ms); return TRUE; @@ -389,7 +389,7 @@ FX_BOOL CXFA_FFField::OnLButtonDown(uint32_t dwFlags, } SetButtonDown(TRUE); CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_LButtonDown; + ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; @@ -407,7 +407,7 @@ FX_BOOL CXFA_FFField::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { } SetButtonDown(FALSE); CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_LButtonUp; + ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; @@ -423,7 +423,7 @@ FX_BOOL CXFA_FFField::OnLButtonDblClk(uint32_t dwFlags, return FALSE; } CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_LButtonDblClk; + ms.m_dwCmd = FWL_MouseCommand::LeftButtonDblClk; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; @@ -437,7 +437,7 @@ FX_BOOL CXFA_FFField::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return FALSE; } CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_MouseMove; + ms.m_dwCmd = FWL_MouseCommand::Move; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; @@ -480,7 +480,7 @@ FX_BOOL CXFA_FFField::OnRButtonDown(uint32_t dwFlags, } SetButtonDown(TRUE); CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_RButtonDown; + ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; @@ -498,7 +498,7 @@ FX_BOOL CXFA_FFField::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { } SetButtonDown(FALSE); CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_RButtonUp; + ms.m_dwCmd = FWL_MouseCommand::RightButtonUp; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; @@ -514,7 +514,7 @@ FX_BOOL CXFA_FFField::OnRButtonDblClk(uint32_t dwFlags, return FALSE; } CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_RButtonDblClk; + ms.m_dwCmd = FWL_MouseCommand::RightButtonDblClk; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; @@ -555,7 +555,7 @@ FX_BOOL CXFA_FFField::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { return FALSE; } CFWL_MsgKey ms; - ms.m_dwCmd = FWL_MSGKEYCMD_KeyDown; + ms.m_dwCmd = FWL_KeyCommand::KeyDown; ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwKeyCode; ms.m_pDstTarget = m_pNormalWidget->m_pIface; @@ -568,7 +568,7 @@ FX_BOOL CXFA_FFField::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { return FALSE; } CFWL_MsgKey ms; - ms.m_dwCmd = FWL_MSGKEYCMD_KeyUp; + ms.m_dwCmd = FWL_KeyCommand::KeyUp; ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwKeyCode; ms.m_pDstTarget = m_pNormalWidget->m_pIface; @@ -590,7 +590,7 @@ FX_BOOL CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { return FALSE; } CFWL_MsgKey ms; - ms.m_dwCmd = FWL_MSGKEYCMD_Char; + ms.m_dwCmd = FWL_KeyCommand::Char; ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwChar; ms.m_pDstTarget = m_pNormalWidget->m_pIface; @@ -793,22 +793,22 @@ FWL_ERR CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { switch (pEvent->GetClassID()) { case CFWL_EventType::Mouse: { CFWL_EvtMouse* event = (CFWL_EvtMouse*)pEvent; - if (event->m_dwCmd == FWL_MSGMOUSECMD_MouseEnter) { + if (event->m_dwCmd == FWL_MouseCommand::Enter) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseEnter; eParam.m_pTarget = m_pDataAcc; m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseEnter, &eParam); - } else if (event->m_dwCmd == FWL_MSGMOUSECMD_MouseLeave) { + } else if (event->m_dwCmd == FWL_MouseCommand::Leave) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseExit; eParam.m_pTarget = m_pDataAcc; m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseExit, &eParam); - } else if (event->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) { + } else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonDown) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseDown; eParam.m_pTarget = m_pDataAcc; m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseDown, &eParam); - } else if (event->m_dwCmd == FWL_MSGMOUSECMD_LButtonUp) { + } else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_MouseUp; eParam.m_pTarget = m_pDataAcc; diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index 94cafba740..16fa0ef06a 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -94,7 +94,7 @@ FX_BOOL CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, SetButtonDown(TRUE); CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_LButtonDown; + ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index e978e30bcf..07324cb358 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -107,7 +107,7 @@ FX_BOOL CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, } SetButtonDown(TRUE); CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_LButtonDown; + ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; @@ -132,7 +132,7 @@ FX_BOOL CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, } SetButtonDown(TRUE); CFWL_MsgMouse ms; - ms.m_dwCmd = FWL_MSGMOUSECMD_RButtonDown; + ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; diff --git a/xfa/fxfa/include/fxfa.h b/xfa/fxfa/include/fxfa.h index e241139464..672ca302fd 100644 --- a/xfa/fxfa/include/fxfa.h +++ b/xfa/fxfa/include/fxfa.h @@ -137,6 +137,123 @@ class IXFA_WidgetIterator; #define XFA_IDS_ValidateError 98 #define XFA_IDS_ValidateNumberError 99 +#define XFA_DOCVIEW_View 0x00000000 +#define XFA_DOCVIEW_MasterPage 0x00000001 +#define XFA_DOCVIEW_Design 0x00000002 +#define XFA_DOCTYPE_Dynamic 0 +#define XFA_DOCTYPE_Static 1 +#define XFA_DOCTYPE_XDP 2 +#define XFA_PARSESTATUS_StatusErr -3 +#define XFA_PARSESTATUS_StreamErr -2 +#define XFA_PARSESTATUS_SyntaxErr -1 +#define XFA_PARSESTATUS_Ready 0 +#define XFA_PARSESTATUS_Done 100 +#define XFA_VALIDATE_preSubmit 1 +#define XFA_VALIDATE_prePrint 2 +#define XFA_VALIDATE_preExecute 3 +#define XFA_VALIDATE_preSave 4 + +#define XFA_INVALIDATE_AllPages 0x00000000 +#define XFA_INVALIDATE_CurrentPage 0x00000001 +#define XFA_PRINTOPT_ShowDialog 0x00000001 +#define XFA_PRINTOPT_CanCancel 0x00000002 +#define XFA_PRINTOPT_ShrinkPage 0x00000004 +#define XFA_PRINTOPT_AsImage 0x00000008 +#define XFA_PRINTOPT_ReverseOrder 0x00000010 +#define XFA_PRINTOPT_PrintAnnot 0x00000020 +#define XFA_PAGEVIEWEVENT_PostAdded 1 +#define XFA_PAGEVIEWEVENT_PostRemoved 3 +#define XFA_PAGEVIEWEVENT_StopLayout 4 +#define XFA_WIDGETEVENT_PostAdded 2 +#define XFA_WIDGETEVENT_PreRemoved 3 + +#define XFA_EVENTERROR_Success 1 +#define XFA_EVENTERROR_Error -1 +#define XFA_EVENTERROR_NotExist 0 +#define XFA_EVENTERROR_Disabled 2 + +#define XFA_RENDERSTATUS_Ready 1 +#define XFA_RENDERSTATUS_ToBeContinued 2 +#define XFA_RENDERSTATUS_Done 3 +#define XFA_RENDERSTATUS_Failed -1 + +#define XFA_TRAVERSEWAY_Tranvalse 0x0001 +#define XFA_TRAVERSEWAY_Form 0x0002 +#define XFA_WIDGETFILTER_Visible 0x0001 +#define XFA_WIDGETFILTER_Viewable 0x0010 +#define XFA_WIDGETFILTER_Printable 0x0020 +#define XFA_WIDGETFILTER_Field 0x0100 +#define XFA_WIDGETFILTER_AllType 0x0F00 + +#define XFA_WIDGETSTATUS_Visible 0x00000001 +#define XFA_WIDGETSTATUS_Invisible 0x00000002 +#define XFA_WIDGETSTATUS_Hidden 0x00000004 +#define XFA_WIDGETSTATUS_Viewable 0x00000010 +#define XFA_WIDGETSTATUS_Printable 0x00000020 +#define XFA_WIDGETSTATUS_Focused 0x00000100 + +enum XFA_EVENTTYPE { + XFA_EVENT_Click, + XFA_EVENT_Change, + XFA_EVENT_DocClose, + XFA_EVENT_DocReady, + XFA_EVENT_Enter, + XFA_EVENT_Exit, + XFA_EVENT_Full, + XFA_EVENT_IndexChange, + XFA_EVENT_Initialize, + XFA_EVENT_MouseDown, + XFA_EVENT_MouseEnter, + XFA_EVENT_MouseExit, + XFA_EVENT_MouseUp, + XFA_EVENT_PostExecute, + XFA_EVENT_PostOpen, + XFA_EVENT_PostPrint, + XFA_EVENT_PostSave, + XFA_EVENT_PostSign, + XFA_EVENT_PostSubmit, + XFA_EVENT_PreExecute, + XFA_EVENT_PreOpen, + XFA_EVENT_PrePrint, + XFA_EVENT_PreSave, + XFA_EVENT_PreSign, + XFA_EVENT_PreSubmit, + XFA_EVENT_Ready, + XFA_EVENT_InitCalculate, + XFA_EVENT_InitVariables, + XFA_EVENT_Calculate, + XFA_EVENT_Validate, + XFA_EVENT_Unknown, +}; + +enum XFA_WIDGETORDER { + XFA_WIDGETORDER_PreOrder, +}; + +enum XFA_WIDGETTYPE { + XFA_WIDGETTYPE_Barcode, + XFA_WIDGETTYPE_PushButton, + XFA_WIDGETTYPE_CheckButton, + XFA_WIDGETTYPE_RadioButton, + XFA_WIDGETTYPE_DatetimeEdit, + XFA_WIDGETTYPE_DecimalField, + XFA_WIDGETTYPE_NumericField, + XFA_WIDGETTYPE_Signature, + XFA_WIDGETTYPE_TextEdit, + XFA_WIDGETTYPE_DropdownList, + XFA_WIDGETTYPE_ListBox, + XFA_WIDGETTYPE_ImageField, + XFA_WIDGETTYPE_PasswordEdit, + XFA_WIDGETTYPE_Arc, + XFA_WIDGETTYPE_Rectangle, + XFA_WIDGETTYPE_Image, + XFA_WIDGETTYPE_Line, + XFA_WIDGETTYPE_Text, + XFA_WIDGETTYPE_ExcludeGroup, + XFA_WIDGETTYPE_Subform, + XFA_WIDGETTYPE_Unknown, +}; + // Probably should be called IXFA_AppDelegate. class IXFA_AppProvider { public: @@ -262,20 +379,6 @@ class IXFA_AppProvider { virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0; }; -#define XFA_INVALIDATE_AllPages 0x00000000 -#define XFA_INVALIDATE_CurrentPage 0x00000001 -#define XFA_PRINTOPT_ShowDialog 0x00000001 -#define XFA_PRINTOPT_CanCancel 0x00000002 -#define XFA_PRINTOPT_ShrinkPage 0x00000004 -#define XFA_PRINTOPT_AsImage 0x00000008 -#define XFA_PRINTOPT_ReverseOrder 0x00000010 -#define XFA_PRINTOPT_PrintAnnot 0x00000020 -#define XFA_PAGEVIEWEVENT_PostAdded 1 -#define XFA_PAGEVIEWEVENT_PostRemoved 3 -#define XFA_PAGEVIEWEVENT_StopLayout 4 -#define XFA_WIDGETEVENT_PostAdded 2 -#define XFA_WIDGETEVENT_PreRemoved 3 - class IXFA_DocProvider { public: virtual ~IXFA_DocProvider() {} @@ -373,55 +476,7 @@ class IXFA_DocProvider { virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) = 0; }; -#define XFA_DOCVIEW_View 0x00000000 -#define XFA_DOCVIEW_MasterPage 0x00000001 -#define XFA_DOCVIEW_Design 0x00000002 -#define XFA_DOCTYPE_Dynamic 0 -#define XFA_DOCTYPE_Static 1 -#define XFA_DOCTYPE_XDP 2 -#define XFA_PARSESTATUS_StatusErr -3 -#define XFA_PARSESTATUS_StreamErr -2 -#define XFA_PARSESTATUS_SyntaxErr -1 -#define XFA_PARSESTATUS_Ready 0 -#define XFA_PARSESTATUS_Done 100 -enum XFA_EVENTTYPE { - XFA_EVENT_Click, - XFA_EVENT_Change, - XFA_EVENT_DocClose, - XFA_EVENT_DocReady, - XFA_EVENT_Enter, - XFA_EVENT_Exit, - XFA_EVENT_Full, - XFA_EVENT_IndexChange, - XFA_EVENT_Initialize, - XFA_EVENT_MouseDown, - XFA_EVENT_MouseEnter, - XFA_EVENT_MouseExit, - XFA_EVENT_MouseUp, - XFA_EVENT_PostExecute, - XFA_EVENT_PostOpen, - XFA_EVENT_PostPrint, - XFA_EVENT_PostSave, - XFA_EVENT_PostSign, - XFA_EVENT_PostSubmit, - XFA_EVENT_PreExecute, - XFA_EVENT_PreOpen, - XFA_EVENT_PrePrint, - XFA_EVENT_PreSave, - XFA_EVENT_PreSign, - XFA_EVENT_PreSubmit, - XFA_EVENT_Ready, - XFA_EVENT_InitCalculate, - XFA_EVENT_InitVariables, - XFA_EVENT_Calculate, - XFA_EVENT_Validate, - XFA_EVENT_Unknown, -}; -#define XFA_VALIDATE_preSubmit 1 -#define XFA_VALIDATE_prePrint 2 -#define XFA_VALIDATE_preExecute 3 -#define XFA_VALIDATE_preSave 4 class CXFA_EventParam { public: CXFA_EventParam() { @@ -471,21 +526,6 @@ class CXFA_EventParam { FX_BOOL m_bIsFormReady; int32_t m_iValidateActivities; }; -#define XFA_EVENTERROR_Success 1 -#define XFA_EVENTERROR_Error -1 -#define XFA_EVENTERROR_NotExist 0 -#define XFA_EVENTERROR_Disabled 2 -enum XFA_WIDGETORDER { - XFA_WIDGETORDER_PreOrder, -}; - -#define XFA_TRAVERSEWAY_Tranvalse 0x0001 -#define XFA_TRAVERSEWAY_Form 0x0002 -#define XFA_WIDGETFILTER_Visible 0x0001 -#define XFA_WIDGETFILTER_Viewable 0x0010 -#define XFA_WIDGETFILTER_Printable 0x0020 -#define XFA_WIDGETFILTER_Field 0x0100 -#define XFA_WIDGETFILTER_AllType 0x0F00 class CXFA_RenderOptions { public: @@ -493,40 +533,6 @@ class CXFA_RenderOptions { FX_BOOL m_bPrint; FX_BOOL m_bHighlight; }; -#define XFA_RENDERSTATUS_Ready 1 -#define XFA_RENDERSTATUS_ToBeContinued 2 -#define XFA_RENDERSTATUS_Done 3 -#define XFA_RENDERSTATUS_Failed -1 - -enum XFA_WIDGETTYPE { - XFA_WIDGETTYPE_Barcode, - XFA_WIDGETTYPE_PushButton, - XFA_WIDGETTYPE_CheckButton, - XFA_WIDGETTYPE_RadioButton, - XFA_WIDGETTYPE_DatetimeEdit, - XFA_WIDGETTYPE_DecimalField, - XFA_WIDGETTYPE_NumericField, - XFA_WIDGETTYPE_Signature, - XFA_WIDGETTYPE_TextEdit, - XFA_WIDGETTYPE_DropdownList, - XFA_WIDGETTYPE_ListBox, - XFA_WIDGETTYPE_ImageField, - XFA_WIDGETTYPE_PasswordEdit, - XFA_WIDGETTYPE_Arc, - XFA_WIDGETTYPE_Rectangle, - XFA_WIDGETTYPE_Image, - XFA_WIDGETTYPE_Line, - XFA_WIDGETTYPE_Text, - XFA_WIDGETTYPE_ExcludeGroup, - XFA_WIDGETTYPE_Subform, - XFA_WIDGETTYPE_Unknown, -}; -#define XFA_WIDGETSTATUS_Visible 0x00000001 -#define XFA_WIDGETSTATUS_Invisible 0x00000002 -#define XFA_WIDGETSTATUS_Hidden 0x00000004 -#define XFA_WIDGETSTATUS_Viewable 0x00000010 -#define XFA_WIDGETSTATUS_Printable 0x00000020 -#define XFA_WIDGETSTATUS_Focused 0x00000100 class IXFA_WidgetIterator { public: diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp index 2ddf0920d5..335df6a32e 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp @@ -48,90 +48,90 @@ void Script_EventPseudoModel_InterProperty(FXJSE_HVALUE hValue, void Script_EventPseudoModel_BooleanProperty(FXJSE_HVALUE hValue, FX_BOOL& bValue, FX_BOOL bSetting) { - if (bSetting) { + if (bSetting) bValue = FXJSE_Value_ToBoolean(hValue); - } else { + else FXJSE_Value_SetBoolean(hValue, bValue); - } } + void CScript_EventPseudoModel::Script_EventPseudoModel_Property( FXJSE_HVALUE hValue, - uint32_t dwFlag, + XFA_Event dwFlag, FX_BOOL bSetting) { CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); - if (!pScriptContext) { + if (!pScriptContext) return; - } + CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); - if (!pEventParam) { + if (!pEventParam) return; - } + switch (dwFlag) { - case XFA_EVENT_CANCELACTION: + case XFA_Event::CancelAction: Script_EventPseudoModel_BooleanProperty( hValue, pEventParam->m_bCancelAction, bSetting); break; - case XFA_EVENT_CHANGE: + case XFA_Event::Change: Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsChange, bSetting); break; - case XFA_EVENT_COMMITKEY: + case XFA_Event::CommitKey: Script_EventPseudoModel_InterProperty(hValue, pEventParam->m_iCommitKey, bSetting); break; - case XFA_EVENT_FULLTEXT: + case XFA_Event::FullText: Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsFullText, bSetting); break; - case XFA_EVENT_KEYDOWN: + case XFA_Event::Keydown: Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bKeyDown, bSetting); break; - case XFA_EVENT_MODIFIER: + case XFA_Event::Modifier: Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bModifier, bSetting); break; - case XFA_EVENT_NEWCONTENTTYPE: + case XFA_Event::NewContentType: Script_EventPseudoModel_StringProperty( hValue, pEventParam->m_wsNewContentType, bSetting); break; - case XFA_EVENT_NEWTEXT: + case XFA_Event::NewText: Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsNewText, bSetting); break; - case XFA_EVENT_PREVCONTENTTYPE: + case XFA_Event::PreviousContentType: Script_EventPseudoModel_StringProperty( hValue, pEventParam->m_wsPrevContentType, bSetting); break; - case XFA_EVENT_PREVTEXT: + case XFA_Event::PreviousText: Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsPrevText, bSetting); break; - case XFA_EVENT_REENTER: + case XFA_Event::Reenter: Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bReenter, bSetting); break; - case XFA_EVENT_SELEND: + case XFA_Event::SelectionEnd: Script_EventPseudoModel_InterProperty(hValue, pEventParam->m_iSelEnd, bSetting); break; - case XFA_EVENT_SELSTART: + case XFA_Event::SelectionStart: Script_EventPseudoModel_InterProperty(hValue, pEventParam->m_iSelStart, bSetting); break; - case XFA_EVENT_SHIFT: + case XFA_Event::Shift: Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bShift, bSetting); break; - case XFA_EVENT_SOAPFAULTCODE: + case XFA_Event::SoapFaultCode: Script_EventPseudoModel_StringProperty( hValue, pEventParam->m_wsSoapFaultCode, bSetting); break; - case XFA_EVENT_SOAPFAULTSTRING: + case XFA_Event::SoapFaultString: Script_EventPseudoModel_StringProperty( hValue, pEventParam->m_wsSoapFaultString, bSetting); break; - case XFA_EVENT_TARGET: + case XFA_Event::Target: break; default: break; @@ -141,97 +141,99 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Change( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_CHANGE, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::Change, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_CommitKey( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_COMMITKEY, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::CommitKey, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_FullText( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_FULLTEXT, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::FullText, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_KeyDown( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_KEYDOWN, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::Keydown, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_Modifier( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_MODIFIER, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::Modifier, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_NewContentType( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_NEWCONTENTTYPE, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::NewContentType, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_NewText( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_NEWTEXT, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::NewText, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_PrevContentType( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_PREVCONTENTTYPE, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::PreviousContentType, + bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_PrevText( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_PREVTEXT, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::PreviousText, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_Reenter( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_REENTER, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::Reenter, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_SelEnd( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_SELEND, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::SelectionEnd, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_SelStart( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_SELSTART, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::SelectionStart, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_Shift( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_SHIFT, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::Shift, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_SoapFaultCode( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_SOAPFAULTCODE, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::SoapFaultCode, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_SoapFaultString( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_SOAPFAULTSTRING, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::SoapFaultString, + bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_Target( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(hValue, XFA_EVENT_TARGET, bSetting); + Script_EventPseudoModel_Property(hValue, XFA_Event::Target, bSetting); } void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( CFXJSE_Arguments* pArguments) { diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.h b/xfa/fxfa/parser/xfa_script_eventpseudomodel.h index f2a11357cb..d840329b4c 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.h @@ -10,23 +10,25 @@ #include "xfa/fxfa/parser/xfa_object.h" #include "xfa/fxjse/cfxjse_arguments.h" -#define XFA_EVENT_CHANGE 0 -#define XFA_EVENT_COMMITKEY 1 -#define XFA_EVENT_FULLTEXT 2 -#define XFA_EVENT_KEYDOWN 3 -#define XFA_EVENT_MODIFIER 4 -#define XFA_EVENT_NEWCONTENTTYPE 5 -#define XFA_EVENT_NEWTEXT 6 -#define XFA_EVENT_PREVCONTENTTYPE 7 -#define XFA_EVENT_PREVTEXT 8 -#define XFA_EVENT_REENTER 9 -#define XFA_EVENT_SELEND 10 -#define XFA_EVENT_SELSTART 11 -#define XFA_EVENT_SHIFT 12 -#define XFA_EVENT_SOAPFAULTCODE 13 -#define XFA_EVENT_SOAPFAULTSTRING 14 -#define XFA_EVENT_TARGET 15 -#define XFA_EVENT_CANCELACTION 16 +enum class XFA_Event { + Change = 0, + CommitKey, + FullText, + Keydown, + Modifier, + NewContentType, + NewText, + PreviousContentType, + PreviousText, + Reenter, + SelectionEnd, + SelectionStart, + Shift, + SoapFaultCode, + SoapFaultString, + Target, + CancelAction +}; class CScript_EventPseudoModel : public CXFA_OrdinaryObject { public: @@ -87,7 +89,7 @@ class CScript_EventPseudoModel : public CXFA_OrdinaryObject { protected: void Script_EventPseudoModel_Property(FXJSE_HVALUE hValue, - uint32_t dwFlag, + XFA_Event dwFlag, FX_BOOL bSetting); }; |