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/parser/xfa_script_eventpseudomodel.cpp | |
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/parser/xfa_script_eventpseudomodel.cpp')
-rw-r--r-- | xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp | 84 |
1 files changed, 43 insertions, 41 deletions
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) { |