diff options
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp | 84 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_eventpseudomodel.h | 38 |
2 files changed, 63 insertions, 59 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) { 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); }; |