| 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_hostpseudomodel.h" | 7 #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h" |
| 8 | 8 |
| 9 #include "xfa/fxfa/app/xfa_ffnotify.h" | 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| 11 #include "xfa/fxfa/parser/xfa_doclayout.h" | 11 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| 12 #include "xfa/fxfa/parser/xfa_document.h" | 12 #include "xfa/fxfa/parser/xfa_document.h" |
| 13 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" | 13 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" |
| 14 #include "xfa/fxfa/parser/xfa_localemgr.h" | 14 #include "xfa/fxfa/parser/xfa_localemgr.h" |
| 15 #include "xfa/fxfa/parser/xfa_object.h" | 15 #include "xfa/fxfa/parser/xfa_object.h" |
| 16 #include "xfa/fxfa/parser/xfa_parser.h" | 16 #include "xfa/fxfa/parser/xfa_parser.h" |
| 17 #include "xfa/fxfa/parser/xfa_parser_imp.h" | 17 #include "xfa/fxfa/parser/xfa_parser_imp.h" |
| 18 #include "xfa/fxfa/parser/xfa_script.h" | 18 #include "xfa/fxfa/parser/xfa_script.h" |
| 19 #include "xfa/fxfa/parser/xfa_script_imp.h" | 19 #include "xfa/fxfa/parser/xfa_script_imp.h" |
| 20 #include "xfa/fxfa/parser/xfa_utils.h" | 20 #include "xfa/fxfa/parser/xfa_utils.h" |
| 21 #include "xfa/fxjse/cfxjse_arguments.h" | 21 #include "xfa/fxjse/cfxjse_arguments.h" |
| 22 | 22 |
| 23 CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) | 23 CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) |
| 24 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_HostPseudoModel) { | 24 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_HostPseudoModel) { |
| 25 m_uScriptHash = XFA_HASHCODE_Host; | 25 m_uScriptHash = XFA_HASHCODE_Host; |
| 26 } | 26 } |
| 27 CScript_HostPseudoModel::~CScript_HostPseudoModel() {} | 27 CScript_HostPseudoModel::~CScript_HostPseudoModel() {} |
| 28 void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( | 28 void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( |
| 29 FXJSE_HVALUE hValue, | 29 CFXJSE_Value* pValue, |
| 30 CXFA_FFNotify* pNotify, | 30 CXFA_FFNotify* pNotify, |
| 31 uint32_t dwFlag) { | 31 uint32_t dwFlag) { |
| 32 CFX_WideString wsValue; | 32 CFX_WideString wsValue; |
| 33 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); | 33 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); |
| 34 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsStringC()); | 34 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); |
| 35 } | 35 } |
| 36 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( | 36 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( |
| 37 FXJSE_HVALUE hValue, | 37 CFXJSE_Value* pValue, |
| 38 FX_BOOL bSetting, | 38 FX_BOOL bSetting, |
| 39 XFA_ATTRIBUTE eAttribute) { | 39 XFA_ATTRIBUTE eAttribute) { |
| 40 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 40 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 41 if (!pNotify) { | 41 if (!pNotify) { |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 if (bSetting) { | 44 if (bSetting) { |
| 45 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 45 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 CFX_WideString wsAppType; | 48 CFX_WideString wsAppType; |
| 49 pNotify->GetAppProvider()->GetAppType(wsAppType); | 49 pNotify->GetAppProvider()->GetAppType(wsAppType); |
| 50 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType).AsStringC()); | 50 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsAppType).AsStringC()); |
| 51 } | 51 } |
| 52 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( | 52 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( |
| 53 FXJSE_HVALUE hValue, | 53 CFXJSE_Value* pValue, |
| 54 FX_BOOL bSetting, | 54 FX_BOOL bSetting, |
| 55 XFA_ATTRIBUTE eAttribute) { | 55 XFA_ATTRIBUTE eAttribute) { |
| 56 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 56 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 57 if (!pNotify) { | 57 if (!pNotify) { |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 if (bSetting) { | 60 if (bSetting) { |
| 61 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 61 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 CFX_WideString wsAppType; | 64 CFX_WideString wsAppType; |
| 65 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); | 65 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); |
| 66 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType).AsStringC()); | 66 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsAppType).AsStringC()); |
| 67 } | 67 } |
| 68 void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( | 68 void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( |
| 69 FXJSE_HVALUE hValue, | 69 CFXJSE_Value* pValue, |
| 70 FX_BOOL bSetting, | 70 FX_BOOL bSetting, |
| 71 XFA_ATTRIBUTE eAttribute) { | 71 XFA_ATTRIBUTE eAttribute) { |
| 72 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 72 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 73 if (!pNotify) { | 73 if (!pNotify) { |
| 74 return; | 74 return; |
| 75 } | 75 } |
| 76 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 76 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 77 if (bSetting) { | 77 if (bSetting) { |
| 78 pNotify->GetDocProvider()->SetCalculationsEnabled( | 78 pNotify->GetDocProvider()->SetCalculationsEnabled( |
| 79 hDoc, FXJSE_Value_ToBoolean(hValue)); | 79 hDoc, FXJSE_Value_ToBoolean(pValue)); |
| 80 return; | 80 return; |
| 81 } | 81 } |
| 82 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc); | 82 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc); |
| 83 FXJSE_Value_SetBoolean(hValue, bEnabled); | 83 FXJSE_Value_SetBoolean(pValue, bEnabled); |
| 84 } | 84 } |
| 85 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( | 85 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( |
| 86 FXJSE_HVALUE hValue, | 86 CFXJSE_Value* pValue, |
| 87 FX_BOOL bSetting, | 87 FX_BOOL bSetting, |
| 88 XFA_ATTRIBUTE eAttribute) { | 88 XFA_ATTRIBUTE eAttribute) { |
| 89 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 89 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 90 if (!pNotify) { | 90 if (!pNotify) { |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 93 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 94 if (bSetting) { | 94 if (bSetting) { |
| 95 pNotify->GetDocProvider()->SetCurrentPage(hDoc, | 95 pNotify->GetDocProvider()->SetCurrentPage(hDoc, |
| 96 FXJSE_Value_ToInteger(hValue)); | 96 FXJSE_Value_ToInteger(pValue)); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 int32_t iCurrentPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); | 99 int32_t iCurrentPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); |
| 100 FXJSE_Value_SetInteger(hValue, iCurrentPage); | 100 FXJSE_Value_SetInteger(pValue, iCurrentPage); |
| 101 } | 101 } |
| 102 void CScript_HostPseudoModel::Script_HostPseudoModel_Language( | 102 void CScript_HostPseudoModel::Script_HostPseudoModel_Language( |
| 103 FXJSE_HVALUE hValue, | 103 CFXJSE_Value* pValue, |
| 104 FX_BOOL bSetting, | 104 FX_BOOL bSetting, |
| 105 XFA_ATTRIBUTE eAttribute) { | 105 XFA_ATTRIBUTE eAttribute) { |
| 106 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 106 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 107 if (!pNotify) { | 107 if (!pNotify) { |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 if (bSetting) { | 110 if (bSetting) { |
| 111 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_LANGUAGE); | 111 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_LANGUAGE); |
| 112 return; | 112 return; |
| 113 } | 113 } |
| 114 CFX_WideString wsLanguage; | 114 CFX_WideString wsLanguage; |
| 115 pNotify->GetAppProvider()->GetLanguage(wsLanguage); | 115 pNotify->GetAppProvider()->GetLanguage(wsLanguage); |
| 116 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsLanguage).AsStringC()); | 116 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsLanguage).AsStringC()); |
| 117 } | 117 } |
| 118 void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( | 118 void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( |
| 119 FXJSE_HVALUE hValue, | 119 CFXJSE_Value* pValue, |
| 120 FX_BOOL bSetting, | 120 FX_BOOL bSetting, |
| 121 XFA_ATTRIBUTE eAttribute) { | 121 XFA_ATTRIBUTE eAttribute) { |
| 122 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 122 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 123 if (!pNotify) { | 123 if (!pNotify) { |
| 124 return; | 124 return; |
| 125 } | 125 } |
| 126 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 126 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 127 if (bSetting) { | 127 if (bSetting) { |
| 128 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_NUMPAGES); | 128 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_NUMPAGES); |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 int32_t iNumPages = pNotify->GetDocProvider()->CountPages(hDoc); | 131 int32_t iNumPages = pNotify->GetDocProvider()->CountPages(hDoc); |
| 132 FXJSE_Value_SetInteger(hValue, iNumPages); | 132 FXJSE_Value_SetInteger(pValue, iNumPages); |
| 133 } | 133 } |
| 134 void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( | 134 void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( |
| 135 FXJSE_HVALUE hValue, | 135 CFXJSE_Value* pValue, |
| 136 FX_BOOL bSetting, | 136 FX_BOOL bSetting, |
| 137 XFA_ATTRIBUTE eAttribute) { | 137 XFA_ATTRIBUTE eAttribute) { |
| 138 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 138 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 139 if (!pNotify) { | 139 if (!pNotify) { |
| 140 return; | 140 return; |
| 141 } | 141 } |
| 142 if (bSetting) { | 142 if (bSetting) { |
| 143 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_PLATFORM); | 143 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_PLATFORM); |
| 144 return; | 144 return; |
| 145 } | 145 } |
| 146 CFX_WideString wsPlatform; | 146 CFX_WideString wsPlatform; |
| 147 pNotify->GetAppProvider()->GetPlatform(wsPlatform); | 147 pNotify->GetAppProvider()->GetPlatform(wsPlatform); |
| 148 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsPlatform).AsStringC()); | 148 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsPlatform).AsStringC()); |
| 149 } | 149 } |
| 150 void CScript_HostPseudoModel::Script_HostPseudoModel_Title( | 150 void CScript_HostPseudoModel::Script_HostPseudoModel_Title( |
| 151 FXJSE_HVALUE hValue, | 151 CFXJSE_Value* pValue, |
| 152 FX_BOOL bSetting, | 152 FX_BOOL bSetting, |
| 153 XFA_ATTRIBUTE eAttribute) { | 153 XFA_ATTRIBUTE eAttribute) { |
| 154 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { | 154 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { |
| 155 return; | 155 return; |
| 156 } | 156 } |
| 157 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 157 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 158 if (!pNotify) { | 158 if (!pNotify) { |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 161 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 162 if (bSetting) { | 162 if (bSetting) { |
| 163 CFX_ByteString bsValue; | 163 CFX_ByteString bsValue; |
| 164 FXJSE_Value_ToUTF8String(hValue, bsValue); | 164 FXJSE_Value_ToUTF8String(pValue, bsValue); |
| 165 pNotify->GetDocProvider()->SetTitle( | 165 pNotify->GetDocProvider()->SetTitle( |
| 166 hDoc, CFX_WideString::FromUTF8(bsValue.AsStringC())); | 166 hDoc, CFX_WideString::FromUTF8(bsValue.AsStringC())); |
| 167 return; | 167 return; |
| 168 } | 168 } |
| 169 CFX_WideString wsTitle; | 169 CFX_WideString wsTitle; |
| 170 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); | 170 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); |
| 171 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsTitle).AsStringC()); | 171 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsTitle).AsStringC()); |
| 172 } | 172 } |
| 173 void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( | 173 void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( |
| 174 FXJSE_HVALUE hValue, | 174 CFXJSE_Value* pValue, |
| 175 FX_BOOL bSetting, | 175 FX_BOOL bSetting, |
| 176 XFA_ATTRIBUTE eAttribute) { | 176 XFA_ATTRIBUTE eAttribute) { |
| 177 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 177 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 178 if (!pNotify) { | 178 if (!pNotify) { |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 181 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 182 if (bSetting) { | 182 if (bSetting) { |
| 183 pNotify->GetDocProvider()->SetValidationsEnabled( | 183 pNotify->GetDocProvider()->SetValidationsEnabled( |
| 184 hDoc, FXJSE_Value_ToBoolean(hValue)); | 184 hDoc, FXJSE_Value_ToBoolean(pValue)); |
| 185 return; | 185 return; |
| 186 } | 186 } |
| 187 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc); | 187 FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc); |
| 188 FXJSE_Value_SetBoolean(hValue, bEnabled); | 188 FXJSE_Value_SetBoolean(pValue, bEnabled); |
| 189 } | 189 } |
| 190 void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( | 190 void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( |
| 191 FXJSE_HVALUE hValue, | 191 CFXJSE_Value* pValue, |
| 192 FX_BOOL bSetting, | 192 FX_BOOL bSetting, |
| 193 XFA_ATTRIBUTE eAttribute) { | 193 XFA_ATTRIBUTE eAttribute) { |
| 194 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { | 194 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { |
| 195 return; | 195 return; |
| 196 } | 196 } |
| 197 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 197 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 198 if (!pNotify) { | 198 if (!pNotify) { |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 if (bSetting) { | 201 if (bSetting) { |
| 202 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VARIATION); | 202 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VARIATION); |
| 203 return; | 203 return; |
| 204 } | 204 } |
| 205 CFX_WideString wsVariation; | 205 CFX_WideString wsVariation; |
| 206 pNotify->GetAppProvider()->GetVariation(wsVariation); | 206 pNotify->GetAppProvider()->GetVariation(wsVariation); |
| 207 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVariation).AsStringC()); | 207 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsVariation).AsStringC()); |
| 208 } | 208 } |
| 209 void CScript_HostPseudoModel::Script_HostPseudoModel_Version( | 209 void CScript_HostPseudoModel::Script_HostPseudoModel_Version( |
| 210 FXJSE_HVALUE hValue, | 210 CFXJSE_Value* pValue, |
| 211 FX_BOOL bSetting, | 211 FX_BOOL bSetting, |
| 212 XFA_ATTRIBUTE eAttribute) { | 212 XFA_ATTRIBUTE eAttribute) { |
| 213 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 213 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 214 if (!pNotify) { | 214 if (!pNotify) { |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 if (bSetting) { | 217 if (bSetting) { |
| 218 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); | 218 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); |
| 219 return; | 219 return; |
| 220 } | 220 } |
| 221 CFX_WideString wsVersion; | 221 CFX_WideString wsVersion; |
| 222 pNotify->GetAppProvider()->GetVersion(wsVersion); | 222 pNotify->GetAppProvider()->GetVersion(wsVersion); |
| 223 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion).AsStringC()); | 223 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsVersion).AsStringC()); |
| 224 } | 224 } |
| 225 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( | 225 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( |
| 226 FXJSE_HVALUE hValue, | 226 CFXJSE_Value* pValue, |
| 227 FX_BOOL bSetting, | 227 FX_BOOL bSetting, |
| 228 XFA_ATTRIBUTE eAttribute) { | 228 XFA_ATTRIBUTE eAttribute) { |
| 229 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 229 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 230 if (!pNotify) { | 230 if (!pNotify) { |
| 231 return; | 231 return; |
| 232 } | 232 } |
| 233 if (bSetting) { | 233 if (bSetting) { |
| 234 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); | 234 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); |
| 235 return; | 235 return; |
| 236 } | 236 } |
| 237 CFX_WideString wsVersion; | 237 CFX_WideString wsVersion; |
| 238 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); | 238 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); |
| 239 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion).AsStringC()); | 239 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsVersion).AsStringC()); |
| 240 } | 240 } |
| 241 void CScript_HostPseudoModel::Script_HostPseudoModel_Name( | 241 void CScript_HostPseudoModel::Script_HostPseudoModel_Name( |
| 242 FXJSE_HVALUE hValue, | 242 CFXJSE_Value* pValue, |
| 243 FX_BOOL bSetting, | 243 FX_BOOL bSetting, |
| 244 XFA_ATTRIBUTE eAttribute) { | 244 XFA_ATTRIBUTE eAttribute) { |
| 245 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 245 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 246 if (!pNotify) { | 246 if (!pNotify) { |
| 247 return; | 247 return; |
| 248 } | 248 } |
| 249 if (bSetting) { | 249 if (bSetting) { |
| 250 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 250 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 251 return; | 251 return; |
| 252 } | 252 } |
| 253 CFX_WideString wsAppName; | 253 CFX_WideString wsAppName; |
| 254 pNotify->GetAppProvider()->GetAppName(wsAppName); | 254 pNotify->GetAppProvider()->GetAppName(wsAppName); |
| 255 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppName).AsStringC()); | 255 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsAppName).AsStringC()); |
| 256 } | 256 } |
| 257 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( | 257 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( |
| 258 FXJSE_HVALUE hValue, | 258 CFXJSE_Value* pValue, |
| 259 FX_BOOL bSetting, | 259 FX_BOOL bSetting, |
| 260 XFA_ATTRIBUTE eAttribute) { | 260 XFA_ATTRIBUTE eAttribute) { |
| 261 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 261 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 262 if (!pNotify) { | 262 if (!pNotify) { |
| 263 return; | 263 return; |
| 264 } | 264 } |
| 265 if (bSetting) { | 265 if (bSetting) { |
| 266 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 266 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 267 return; | 267 return; |
| 268 } | 268 } |
| 269 CFX_WideString wsFoxitAppName; | 269 CFX_WideString wsFoxitAppName; |
| 270 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName); | 270 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName); |
| 271 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsFoxitAppName).AsStringC()); | 271 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsFoxitAppName).AsStringC()); |
| 272 } | 272 } |
| 273 void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( | 273 void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( |
| 274 CFXJSE_Arguments* pArguments) { | 274 CFXJSE_Arguments* pArguments) { |
| 275 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { | 275 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { |
| 276 return; | 276 return; |
| 277 } | 277 } |
| 278 int32_t iLength = pArguments->GetLength(); | 278 int32_t iLength = pArguments->GetLength(); |
| 279 if (iLength != 1) { | 279 if (iLength != 1) { |
| 280 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); | 280 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); |
| 281 return; | 281 return; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 301 if (iLength != 1) { | 301 if (iLength != 1) { |
| 302 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); | 302 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); |
| 303 return; | 303 return; |
| 304 } | 304 } |
| 305 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 305 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 306 if (!pNotify) { | 306 if (!pNotify) { |
| 307 return; | 307 return; |
| 308 } | 308 } |
| 309 CXFA_Node* pNode = NULL; | 309 CXFA_Node* pNode = NULL; |
| 310 if (iLength >= 1) { | 310 if (iLength >= 1) { |
| 311 FXJSE_HVALUE hValue = pArguments->GetValue(0); | 311 CFXJSE_Value* pValue = pArguments->GetValue(0); |
| 312 if (FXJSE_Value_IsObject(hValue)) { | 312 if (FXJSE_Value_IsObject(pValue)) { |
| 313 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, nullptr)); | 313 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(pValue, nullptr)); |
| 314 } else if (FXJSE_Value_IsUTF8String(hValue)) { | 314 } else if (FXJSE_Value_IsUTF8String(pValue)) { |
| 315 CFX_ByteString bsString; | 315 CFX_ByteString bsString; |
| 316 FXJSE_Value_ToUTF8String(hValue, bsString); | 316 FXJSE_Value_ToUTF8String(pValue, bsString); |
| 317 CFX_WideString wsExpression = | 317 CFX_WideString wsExpression = |
| 318 CFX_WideString::FromUTF8(bsString.AsStringC()); | 318 CFX_WideString::FromUTF8(bsString.AsStringC()); |
| 319 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 319 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 320 if (!pScriptContext) { | 320 if (!pScriptContext) { |
| 321 FXJSE_Value_Release(hValue); | 321 FXJSE_Value_Release(pValue); |
| 322 return; | 322 return; |
| 323 } | 323 } |
| 324 CXFA_Object* pObject = pScriptContext->GetThisObject(); | 324 CXFA_Object* pObject = pScriptContext->GetThisObject(); |
| 325 if (!pObject) { | 325 if (!pObject) { |
| 326 FXJSE_Value_Release(hValue); | 326 FXJSE_Value_Release(pValue); |
| 327 return; | 327 return; |
| 328 } | 328 } |
| 329 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | | 329 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | |
| 330 XFA_RESOLVENODE_Siblings; | 330 XFA_RESOLVENODE_Siblings; |
| 331 XFA_RESOLVENODE_RS resoveNodeRS; | 331 XFA_RESOLVENODE_RS resoveNodeRS; |
| 332 int32_t iRet = pScriptContext->ResolveObjects( | 332 int32_t iRet = pScriptContext->ResolveObjects( |
| 333 pObject, wsExpression.AsStringC(), resoveNodeRS, dwFlag); | 333 pObject, wsExpression.AsStringC(), resoveNodeRS, dwFlag); |
| 334 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { | 334 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { |
| 335 FXJSE_Value_Release(hValue); | 335 FXJSE_Value_Release(pValue); |
| 336 return; | 336 return; |
| 337 } | 337 } |
| 338 pNode = resoveNodeRS.nodes[0]->AsNode(); | 338 pNode = resoveNodeRS.nodes[0]->AsNode(); |
| 339 } | 339 } |
| 340 FXJSE_Value_Release(hValue); | 340 FXJSE_Value_Release(pValue); |
| 341 } | 341 } |
| 342 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | 342 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
| 343 if (!pDocLayout) { | 343 if (!pDocLayout) { |
| 344 return; | 344 return; |
| 345 } | 345 } |
| 346 CXFA_FFWidget* hWidget = | 346 CXFA_FFWidget* hWidget = |
| 347 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); | 347 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); |
| 348 if (!hWidget) { | 348 if (!hWidget) { |
| 349 return; | 349 return; |
| 350 } | 350 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 376 } | 376 } |
| 377 if (iLength >= 3) { | 377 if (iLength >= 3) { |
| 378 CFX_ByteString bsDefaultAnswer = pArguments->GetUTF8String(2); | 378 CFX_ByteString bsDefaultAnswer = pArguments->GetUTF8String(2); |
| 379 wsDefaultAnswer = CFX_WideString::FromUTF8(bsDefaultAnswer.AsStringC()); | 379 wsDefaultAnswer = CFX_WideString::FromUTF8(bsDefaultAnswer.AsStringC()); |
| 380 } | 380 } |
| 381 if (iLength >= 4) { | 381 if (iLength >= 4) { |
| 382 bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; | 382 bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; |
| 383 } | 383 } |
| 384 CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response( | 384 CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response( |
| 385 wsQuestion, wsTitle, wsDefaultAnswer, bMark); | 385 wsQuestion, wsTitle, wsDefaultAnswer, bMark); |
| 386 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 386 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 387 if (hValue) { | 387 if (pValue) { |
| 388 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer).AsStringC()); | 388 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsAnswer).AsStringC()); |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( | 391 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( |
| 392 CFXJSE_Arguments* pArguments) { | 392 CFXJSE_Arguments* pArguments) { |
| 393 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 393 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 394 if (!pNotify) { | 394 if (!pNotify) { |
| 395 return; | 395 return; |
| 396 } | 396 } |
| 397 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch(); | 397 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch(); |
| 398 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 398 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 399 if (hValue) { | 399 if (pValue) { |
| 400 FXJSE_Value_SetInteger(hValue, iCur); | 400 FXJSE_Value_SetInteger(pValue, iCur); |
| 401 } | 401 } |
| 402 } | 402 } |
| 403 static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, | 403 static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, |
| 404 int32_t nStart, | 404 int32_t nStart, |
| 405 CFX_WideString& wsFilter) { | 405 CFX_WideString& wsFilter) { |
| 406 ASSERT(nStart > -1); | 406 ASSERT(nStart > -1); |
| 407 int32_t iLength = wsExpression.GetLength(); | 407 int32_t iLength = wsExpression.GetLength(); |
| 408 if (nStart >= iLength) { | 408 if (nStart >= iLength) { |
| 409 return iLength; | 409 return iLength; |
| 410 } | 410 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 if (iLength != 1) { | 502 if (iLength != 1) { |
| 503 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus"); | 503 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus"); |
| 504 return; | 504 return; |
| 505 } | 505 } |
| 506 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 506 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 507 if (!pNotify) { | 507 if (!pNotify) { |
| 508 return; | 508 return; |
| 509 } | 509 } |
| 510 CXFA_Node* pNode = NULL; | 510 CXFA_Node* pNode = NULL; |
| 511 if (iLength >= 1) { | 511 if (iLength >= 1) { |
| 512 FXJSE_HVALUE hValue = pArguments->GetValue(0); | 512 CFXJSE_Value* pValue = pArguments->GetValue(0); |
| 513 if (FXJSE_Value_IsObject(hValue)) { | 513 if (FXJSE_Value_IsObject(pValue)) { |
| 514 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, NULL)); | 514 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(pValue, nullptr)); |
| 515 } else if (FXJSE_Value_IsUTF8String(hValue)) { | 515 } else if (FXJSE_Value_IsUTF8String(pValue)) { |
| 516 CFX_ByteString bsString; | 516 CFX_ByteString bsString; |
| 517 FXJSE_Value_ToUTF8String(hValue, bsString); | 517 FXJSE_Value_ToUTF8String(pValue, bsString); |
| 518 CFX_WideString wsExpression = | 518 CFX_WideString wsExpression = |
| 519 CFX_WideString::FromUTF8(bsString.AsStringC()); | 519 CFX_WideString::FromUTF8(bsString.AsStringC()); |
| 520 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 520 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 521 if (!pScriptContext) { | 521 if (!pScriptContext) { |
| 522 FXJSE_Value_Release(hValue); | 522 FXJSE_Value_Release(pValue); |
| 523 return; | 523 return; |
| 524 } | 524 } |
| 525 CXFA_Object* pObject = pScriptContext->GetThisObject(); | 525 CXFA_Object* pObject = pScriptContext->GetThisObject(); |
| 526 if (!pObject) { | 526 if (!pObject) { |
| 527 FXJSE_Value_Release(hValue); | 527 FXJSE_Value_Release(pValue); |
| 528 return; | 528 return; |
| 529 } | 529 } |
| 530 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | | 530 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | |
| 531 XFA_RESOLVENODE_Siblings; | 531 XFA_RESOLVENODE_Siblings; |
| 532 XFA_RESOLVENODE_RS resoveNodeRS; | 532 XFA_RESOLVENODE_RS resoveNodeRS; |
| 533 int32_t iRet = pScriptContext->ResolveObjects( | 533 int32_t iRet = pScriptContext->ResolveObjects( |
| 534 pObject, wsExpression.AsStringC(), resoveNodeRS, dwFlag); | 534 pObject, wsExpression.AsStringC(), resoveNodeRS, dwFlag); |
| 535 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { | 535 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { |
| 536 FXJSE_Value_Release(hValue); | 536 FXJSE_Value_Release(pValue); |
| 537 return; | 537 return; |
| 538 } | 538 } |
| 539 pNode = resoveNodeRS.nodes[0]->AsNode(); | 539 pNode = resoveNodeRS.nodes[0]->AsNode(); |
| 540 } | 540 } |
| 541 FXJSE_Value_Release(hValue); | 541 FXJSE_Value_Release(pValue); |
| 542 } | 542 } |
| 543 pNotify->SetFocusWidgetNode(pNode); | 543 pNotify->SetFocusWidgetNode(pNode); |
| 544 } | 544 } |
| 545 void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus( | 545 void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus( |
| 546 CFXJSE_Arguments* pArguments) { | 546 CFXJSE_Arguments* pArguments) { |
| 547 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 547 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 548 if (!pNotify) { | 548 if (!pNotify) { |
| 549 return; | 549 return; |
| 550 } | 550 } |
| 551 CXFA_Node* pNode = pNotify->GetFocusWidgetNode(); | 551 CXFA_Node* pNode = pNotify->GetFocusWidgetNode(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 } | 590 } |
| 591 } | 591 } |
| 592 if (iLength >= 4) { | 592 if (iLength >= 4) { |
| 593 dwButtonType = pArguments->GetInt32(3); | 593 dwButtonType = pArguments->GetInt32(3); |
| 594 if (dwButtonType > XFA_MB_YesNoCancel) { | 594 if (dwButtonType > XFA_MB_YesNoCancel) { |
| 595 dwButtonType = XFA_MB_OK; | 595 dwButtonType = XFA_MB_OK; |
| 596 } | 596 } |
| 597 } | 597 } |
| 598 int32_t iValue = pNotify->GetAppProvider()->MsgBox( | 598 int32_t iValue = pNotify->GetAppProvider()->MsgBox( |
| 599 wsMessage, bsTitle, dwMessageType, dwButtonType); | 599 wsMessage, bsTitle, dwMessageType, dwButtonType); |
| 600 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 600 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 601 if (hValue) { | 601 if (pValue) { |
| 602 FXJSE_Value_SetInteger(hValue, iValue); | 602 FXJSE_Value_SetInteger(pValue, iValue); |
| 603 } | 603 } |
| 604 } | 604 } |
| 605 FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( | 605 FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( |
| 606 CFXJSE_Arguments* pArguments, | 606 CFXJSE_Arguments* pArguments, |
| 607 int32_t iArgIndex, | 607 int32_t iArgIndex, |
| 608 CFX_WideString& wsValue) { | 608 CFX_WideString& wsValue) { |
| 609 if (pArguments == NULL || iArgIndex < 0) { | 609 if (pArguments == NULL || iArgIndex < 0) { |
| 610 return FALSE; | 610 return FALSE; |
| 611 } | 611 } |
| 612 FX_BOOL bIsJsType = FALSE; | 612 FX_BOOL bIsJsType = FALSE; |
| 613 if (m_pDocument->GetScriptContext()->GetType() == | 613 if (m_pDocument->GetScriptContext()->GetType() == |
| 614 XFA_SCRIPTLANGTYPE_Javascript) { | 614 XFA_SCRIPTLANGTYPE_Javascript) { |
| 615 bIsJsType = TRUE; | 615 bIsJsType = TRUE; |
| 616 } | 616 } |
| 617 FXJSE_HVALUE hValueArg = pArguments->GetValue(iArgIndex); | 617 CFXJSE_Value* pValueArg = pArguments->GetValue(iArgIndex); |
| 618 if (!FXJSE_Value_IsUTF8String(hValueArg) && bIsJsType) { | 618 if (!FXJSE_Value_IsUTF8String(pValueArg) && bIsJsType) { |
| 619 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 619 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
| 620 FXJSE_Value_Release(hValueArg); | 620 FXJSE_Value_Release(pValueArg); |
| 621 return FALSE; | 621 return FALSE; |
| 622 } | 622 } |
| 623 if (FXJSE_Value_IsNull(hValueArg)) { | 623 if (FXJSE_Value_IsNull(pValueArg)) { |
| 624 wsValue = FX_WSTRC(L""); | 624 wsValue = FX_WSTRC(L""); |
| 625 } else { | 625 } else { |
| 626 CFX_ByteString byMessage; | 626 CFX_ByteString byMessage; |
| 627 FXJSE_Value_ToUTF8String(hValueArg, byMessage); | 627 FXJSE_Value_ToUTF8String(pValueArg, byMessage); |
| 628 wsValue = CFX_WideString::FromUTF8(byMessage.AsStringC()); | 628 wsValue = CFX_WideString::FromUTF8(byMessage.AsStringC()); |
| 629 } | 629 } |
| 630 FXJSE_Value_Release(hValueArg); | 630 FXJSE_Value_Release(pValueArg); |
| 631 return TRUE; | 631 return TRUE; |
| 632 } | 632 } |
| 633 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( | 633 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( |
| 634 CFXJSE_Arguments* pArguments) { | 634 CFXJSE_Arguments* pArguments) { |
| 635 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 635 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 636 if (!pNotify) { | 636 if (!pNotify) { |
| 637 return; | 637 return; |
| 638 } | 638 } |
| 639 int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch(); | 639 int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch(); |
| 640 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 640 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 641 if (hValue) { | 641 if (pValue) { |
| 642 FXJSE_Value_SetInteger(hValue, iValue); | 642 FXJSE_Value_SetInteger(pValue, iValue); |
| 643 } | 643 } |
| 644 } | 644 } |
| 645 void CScript_HostPseudoModel::Script_HostPseudoModel_Print( | 645 void CScript_HostPseudoModel::Script_HostPseudoModel_Print( |
| 646 CFXJSE_Arguments* pArguments) { | 646 CFXJSE_Arguments* pArguments) { |
| 647 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { | 647 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { |
| 648 return; | 648 return; |
| 649 } | 649 } |
| 650 int32_t iLength = pArguments->GetLength(); | 650 int32_t iLength = pArguments->GetLength(); |
| 651 if (iLength != 8) { | 651 if (iLength != 8) { |
| 652 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); | 652 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 } | 788 } |
| 789 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); | 789 pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); |
| 790 } | 790 } |
| 791 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( | 791 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( |
| 792 CFXJSE_Arguments* pArguments) { | 792 CFXJSE_Arguments* pArguments) { |
| 793 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 793 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 794 if (!pNotify) { | 794 if (!pNotify) { |
| 795 return; | 795 return; |
| 796 } | 796 } |
| 797 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); | 797 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); |
| 798 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 798 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 799 if (hValue) { | 799 if (pValue) { |
| 800 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime).AsStringC()); | 800 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsDataTime).AsStringC()); |
| 801 } | 801 } |
| 802 } | 802 } |
| OLD | NEW |