| 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/app/xfa_ffnotify.h" |
| 10 #include "xfa/fxfa/include/xfa_ffwidgethandler.h" | 10 #include "xfa/fxfa/include/xfa_ffwidgethandler.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) | 22 CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) |
| 23 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_EventPseudoModel) { | 23 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_EventPseudoModel) { |
| 24 m_uScriptHash = XFA_HASHCODE_Event; | 24 m_uScriptHash = XFA_HASHCODE_Event; |
| 25 } | 25 } |
| 26 CScript_EventPseudoModel::~CScript_EventPseudoModel() {} | 26 CScript_EventPseudoModel::~CScript_EventPseudoModel() {} |
| 27 void Script_EventPseudoModel_StringProperty(CFXJSE_Value* pValue, | 27 void Script_EventPseudoModel_StringProperty(CFXJSE_Value* pValue, |
| 28 CFX_WideString& wsValue, | 28 CFX_WideString& wsValue, |
| 29 FX_BOOL bSetting) { | 29 FX_BOOL bSetting) { |
| 30 if (bSetting) { | 30 if (bSetting) { |
| 31 CFX_ByteString bsValue; | 31 CFX_ByteString bsValue; |
| 32 FXJSE_Value_ToUTF8String(pValue, bsValue); | 32 pValue->ToString(bsValue); |
| 33 wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); | 33 wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); |
| 34 } else { | 34 } else { |
| 35 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); | 35 pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 void Script_EventPseudoModel_InterProperty(CFXJSE_Value* pValue, | 38 void Script_EventPseudoModel_InterProperty(CFXJSE_Value* pValue, |
| 39 int32_t& iValue, | 39 int32_t& iValue, |
| 40 FX_BOOL bSetting) { | 40 FX_BOOL bSetting) { |
| 41 if (bSetting) { | 41 if (bSetting) { |
| 42 iValue = FXJSE_Value_ToInteger(pValue); | 42 iValue = pValue->ToInteger(); |
| 43 } else { | 43 } else { |
| 44 FXJSE_Value_SetInteger(pValue, iValue); | 44 pValue->SetInteger(iValue); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 void Script_EventPseudoModel_BooleanProperty(CFXJSE_Value* pValue, | 47 void Script_EventPseudoModel_BooleanProperty(CFXJSE_Value* pValue, |
| 48 FX_BOOL& bValue, | 48 FX_BOOL& bValue, |
| 49 FX_BOOL bSetting) { | 49 FX_BOOL bSetting) { |
| 50 if (bSetting) | 50 if (bSetting) |
| 51 bValue = FXJSE_Value_ToBoolean(pValue); | 51 bValue = pValue->ToBoolean(); |
| 52 else | 52 else |
| 53 FXJSE_Value_SetBoolean(pValue, bValue); | 53 pValue->SetBoolean(bValue); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void CScript_EventPseudoModel::Script_EventPseudoModel_Property( | 56 void CScript_EventPseudoModel::Script_EventPseudoModel_Property( |
| 57 CFXJSE_Value* pValue, | 57 CFXJSE_Value* pValue, |
| 58 XFA_Event dwFlag, | 58 XFA_Event dwFlag, |
| 59 FX_BOOL bSetting) { | 59 FX_BOOL bSetting) { |
| 60 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 60 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 61 if (!pScriptContext) | 61 if (!pScriptContext) |
| 62 return; | 62 return; |
| 63 | 63 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 259 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 260 if (!pScriptContext) { | 260 if (!pScriptContext) { |
| 261 return; | 261 return; |
| 262 } | 262 } |
| 263 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); | 263 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); |
| 264 if (!pEventParam) { | 264 if (!pEventParam) { |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 pEventParam->Reset(); | 267 pEventParam->Reset(); |
| 268 } | 268 } |
| OLD | NEW |