| 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 "xfa/fxfa/parser/xfa_script_eventpseudomodel.h" | 7 #include "xfa/fxfa/parser/xfa_script_eventpseudomodel.h" |
| 8 | 8 |
| 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| 9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| 10 #include "xfa/fxfa/parser/xfa_docdata.h" | 11 #include "xfa/fxfa/parser/xfa_docdata.h" |
| 11 #include "xfa/fxfa/parser/xfa_doclayout.h" | 12 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| 12 #include "xfa/fxfa/parser/xfa_document.h" | 13 #include "xfa/fxfa/parser/xfa_document.h" |
| 13 #include "xfa/fxfa/parser/xfa_localemgr.h" | 14 #include "xfa/fxfa/parser/xfa_localemgr.h" |
| 14 #include "xfa/fxfa/parser/xfa_object.h" | 15 #include "xfa/fxfa/parser/xfa_object.h" |
| 15 #include "xfa/fxfa/parser/xfa_parser.h" | 16 #include "xfa/fxfa/parser/xfa_parser.h" |
| 17 #include "xfa/fxfa/parser/xfa_parser_imp.h" |
| 16 #include "xfa/fxfa/parser/xfa_script.h" | 18 #include "xfa/fxfa/parser/xfa_script.h" |
| 19 #include "xfa/fxfa/parser/xfa_script_imp.h" |
| 17 #include "xfa/fxfa/parser/xfa_utils.h" | 20 #include "xfa/fxfa/parser/xfa_utils.h" |
| 18 #include "xfa/fxjse/cfxjse_arguments.h" | 21 #include "xfa/fxjse/cfxjse_arguments.h" |
| 22 #include "xfa/include/fxfa/xfa_ffwidgethandler.h" |
| 19 | 23 |
| 20 CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) | 24 CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) |
| 21 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_EventPseudoModel) { | 25 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_EventPseudoModel) { |
| 22 m_uScriptHash = XFA_HASHCODE_Event; | 26 m_uScriptHash = XFA_HASHCODE_Event; |
| 23 } | 27 } |
| 24 CScript_EventPseudoModel::~CScript_EventPseudoModel() {} | 28 CScript_EventPseudoModel::~CScript_EventPseudoModel() {} |
| 25 void Script_EventPseudoModel_StringProperty(FXJSE_HVALUE hValue, | 29 void Script_EventPseudoModel_StringProperty(FXJSE_HVALUE hValue, |
| 26 CFX_WideString& wsValue, | 30 CFX_WideString& wsValue, |
| 27 FX_BOOL bSetting) { | 31 FX_BOOL bSetting) { |
| 28 if (bSetting) { | 32 if (bSetting) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 48 if (bSetting) { | 52 if (bSetting) { |
| 49 bValue = FXJSE_Value_ToBoolean(hValue); | 53 bValue = FXJSE_Value_ToBoolean(hValue); |
| 50 } else { | 54 } else { |
| 51 FXJSE_Value_SetBoolean(hValue, bValue); | 55 FXJSE_Value_SetBoolean(hValue, bValue); |
| 52 } | 56 } |
| 53 } | 57 } |
| 54 void CScript_EventPseudoModel::Script_EventPseudoModel_Property( | 58 void CScript_EventPseudoModel::Script_EventPseudoModel_Property( |
| 55 FXJSE_HVALUE hValue, | 59 FXJSE_HVALUE hValue, |
| 56 uint32_t dwFlag, | 60 uint32_t dwFlag, |
| 57 FX_BOOL bSetting) { | 61 FX_BOOL bSetting) { |
| 58 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 62 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 59 if (!pScriptContext) { | 63 if (!pScriptContext) { |
| 60 return; | 64 return; |
| 61 } | 65 } |
| 62 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); | 66 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); |
| 63 if (!pEventParam) { | 67 if (!pEventParam) { |
| 64 return; | 68 return; |
| 65 } | 69 } |
| 66 switch (dwFlag) { | 70 switch (dwFlag) { |
| 67 case XFA_EVENT_CANCELACTION: | 71 case XFA_EVENT_CANCELACTION: |
| 68 Script_EventPseudoModel_BooleanProperty( | 72 Script_EventPseudoModel_BooleanProperty( |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 Script_EventPseudoModel_Property(hValue, XFA_EVENT_SOAPFAULTSTRING, bSetting); | 235 Script_EventPseudoModel_Property(hValue, XFA_EVENT_SOAPFAULTSTRING, bSetting); |
| 232 } | 236 } |
| 233 void CScript_EventPseudoModel::Script_EventPseudoModel_Target( | 237 void CScript_EventPseudoModel::Script_EventPseudoModel_Target( |
| 234 FXJSE_HVALUE hValue, | 238 FXJSE_HVALUE hValue, |
| 235 FX_BOOL bSetting, | 239 FX_BOOL bSetting, |
| 236 XFA_ATTRIBUTE eAttribute) { | 240 XFA_ATTRIBUTE eAttribute) { |
| 237 Script_EventPseudoModel_Property(hValue, XFA_EVENT_TARGET, bSetting); | 241 Script_EventPseudoModel_Property(hValue, XFA_EVENT_TARGET, bSetting); |
| 238 } | 242 } |
| 239 void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( | 243 void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( |
| 240 CFXJSE_Arguments* pArguments) { | 244 CFXJSE_Arguments* pArguments) { |
| 241 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 245 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 242 if (!pScriptContext) { | 246 if (!pScriptContext) { |
| 243 return; | 247 return; |
| 244 } | 248 } |
| 245 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); | 249 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); |
| 246 if (!pEventParam) { | 250 if (!pEventParam) { |
| 247 return; | 251 return; |
| 248 } | 252 } |
| 249 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 253 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 250 if (!pNotify) { | 254 if (!pNotify) { |
| 251 return; | 255 return; |
| 252 } | 256 } |
| 253 IXFA_WidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler(); | 257 CXFA_FFWidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler(); |
| 254 if (!pWidgetHandler) { | 258 if (!pWidgetHandler) { |
| 255 return; | 259 return; |
| 256 } | 260 } |
| 257 pWidgetHandler->ProcessEvent(pEventParam->m_pTarget, pEventParam); | 261 pWidgetHandler->ProcessEvent(pEventParam->m_pTarget, pEventParam); |
| 258 } | 262 } |
| 259 void CScript_EventPseudoModel::Script_EventPseudoModel_Reset( | 263 void CScript_EventPseudoModel::Script_EventPseudoModel_Reset( |
| 260 CFXJSE_Arguments* pArguments) { | 264 CFXJSE_Arguments* pArguments) { |
| 261 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 265 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 262 if (!pScriptContext) { | 266 if (!pScriptContext) { |
| 263 return; | 267 return; |
| 264 } | 268 } |
| 265 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); | 269 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); |
| 266 if (!pEventParam) { | 270 if (!pEventParam) { |
| 267 return; | 271 return; |
| 268 } | 272 } |
| 269 pEventParam->Reset(); | 273 pEventParam->Reset(); |
| 270 } | 274 } |
| OLD | NEW |