| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_HostPseudoModel) { | 25 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_HostPseudoModel) { |
| 26 m_uScriptHash = XFA_HASHCODE_Host; | 26 m_uScriptHash = XFA_HASHCODE_Host; |
| 27 } | 27 } |
| 28 CScript_HostPseudoModel::~CScript_HostPseudoModel() {} | 28 CScript_HostPseudoModel::~CScript_HostPseudoModel() {} |
| 29 void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( | 29 void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( |
| 30 FXJSE_HVALUE hValue, | 30 FXJSE_HVALUE hValue, |
| 31 CXFA_FFNotify* pNotify, | 31 CXFA_FFNotify* pNotify, |
| 32 uint32_t dwFlag) { | 32 uint32_t dwFlag) { |
| 33 CFX_WideString wsValue; | 33 CFX_WideString wsValue; |
| 34 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); | 34 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); |
| 35 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); | 35 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsStringC()); |
| 36 } | 36 } |
| 37 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( | 37 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( |
| 38 FXJSE_HVALUE hValue, | 38 FXJSE_HVALUE hValue, |
| 39 FX_BOOL bSetting, | 39 FX_BOOL bSetting, |
| 40 XFA_ATTRIBUTE eAttribute) { | 40 XFA_ATTRIBUTE eAttribute) { |
| 41 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 41 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 42 if (!pNotify) { | 42 if (!pNotify) { |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 if (bSetting) { | 45 if (bSetting) { |
| 46 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 46 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 47 return; | 47 return; |
| 48 } | 48 } |
| 49 CFX_WideString wsAppType; | 49 CFX_WideString wsAppType; |
| 50 pNotify->GetAppProvider()->GetAppType(wsAppType); | 50 pNotify->GetAppProvider()->GetAppType(wsAppType); |
| 51 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType).AsByteStringC()); | 51 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType).AsStringC()); |
| 52 } | 52 } |
| 53 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( | 53 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( |
| 54 FXJSE_HVALUE hValue, | 54 FXJSE_HVALUE hValue, |
| 55 FX_BOOL bSetting, | 55 FX_BOOL bSetting, |
| 56 XFA_ATTRIBUTE eAttribute) { | 56 XFA_ATTRIBUTE eAttribute) { |
| 57 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 57 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 58 if (!pNotify) { | 58 if (!pNotify) { |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 if (bSetting) { | 61 if (bSetting) { |
| 62 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 62 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 63 return; | 63 return; |
| 64 } | 64 } |
| 65 CFX_WideString wsAppType; | 65 CFX_WideString wsAppType; |
| 66 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); | 66 pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); |
| 67 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType).AsByteStringC()); | 67 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType).AsStringC()); |
| 68 } | 68 } |
| 69 void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( | 69 void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( |
| 70 FXJSE_HVALUE hValue, | 70 FXJSE_HVALUE hValue, |
| 71 FX_BOOL bSetting, | 71 FX_BOOL bSetting, |
| 72 XFA_ATTRIBUTE eAttribute) { | 72 XFA_ATTRIBUTE eAttribute) { |
| 73 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 73 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 74 if (!pNotify) { | 74 if (!pNotify) { |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 77 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 107 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 107 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 108 if (!pNotify) { | 108 if (!pNotify) { |
| 109 return; | 109 return; |
| 110 } | 110 } |
| 111 if (bSetting) { | 111 if (bSetting) { |
| 112 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_LANGUAGE); | 112 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_LANGUAGE); |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 CFX_WideString wsLanguage; | 115 CFX_WideString wsLanguage; |
| 116 pNotify->GetAppProvider()->GetLanguage(wsLanguage); | 116 pNotify->GetAppProvider()->GetLanguage(wsLanguage); |
| 117 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsLanguage).AsByteStringC()); | 117 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsLanguage).AsStringC()); |
| 118 } | 118 } |
| 119 void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( | 119 void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( |
| 120 FXJSE_HVALUE hValue, | 120 FXJSE_HVALUE hValue, |
| 121 FX_BOOL bSetting, | 121 FX_BOOL bSetting, |
| 122 XFA_ATTRIBUTE eAttribute) { | 122 XFA_ATTRIBUTE eAttribute) { |
| 123 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 123 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 124 if (!pNotify) { | 124 if (!pNotify) { |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 127 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 139 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 139 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 140 if (!pNotify) { | 140 if (!pNotify) { |
| 141 return; | 141 return; |
| 142 } | 142 } |
| 143 if (bSetting) { | 143 if (bSetting) { |
| 144 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_PLATFORM); | 144 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_PLATFORM); |
| 145 return; | 145 return; |
| 146 } | 146 } |
| 147 CFX_WideString wsPlatform; | 147 CFX_WideString wsPlatform; |
| 148 pNotify->GetAppProvider()->GetPlatform(wsPlatform); | 148 pNotify->GetAppProvider()->GetPlatform(wsPlatform); |
| 149 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsPlatform).AsByteStringC()); | 149 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsPlatform).AsStringC()); |
| 150 } | 150 } |
| 151 void CScript_HostPseudoModel::Script_HostPseudoModel_Title( | 151 void CScript_HostPseudoModel::Script_HostPseudoModel_Title( |
| 152 FXJSE_HVALUE hValue, | 152 FXJSE_HVALUE hValue, |
| 153 FX_BOOL bSetting, | 153 FX_BOOL bSetting, |
| 154 XFA_ATTRIBUTE eAttribute) { | 154 XFA_ATTRIBUTE eAttribute) { |
| 155 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { | 155 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { |
| 156 return; | 156 return; |
| 157 } | 157 } |
| 158 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 158 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 159 if (!pNotify) { | 159 if (!pNotify) { |
| 160 return; | 160 return; |
| 161 } | 161 } |
| 162 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 162 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 163 if (bSetting) { | 163 if (bSetting) { |
| 164 CFX_ByteString bsValue; | 164 CFX_ByteString bsValue; |
| 165 FXJSE_Value_ToUTF8String(hValue, bsValue); | 165 FXJSE_Value_ToUTF8String(hValue, bsValue); |
| 166 pNotify->GetDocProvider()->SetTitle( | 166 pNotify->GetDocProvider()->SetTitle( |
| 167 hDoc, | 167 hDoc, CFX_WideString::FromUTF8(bsValue.AsStringC()).AsStringC()); |
| 168 CFX_WideString::FromUTF8(bsValue.AsByteStringC()).AsWideStringC()); | |
| 169 return; | 168 return; |
| 170 } | 169 } |
| 171 CFX_WideString wsTitle; | 170 CFX_WideString wsTitle; |
| 172 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); | 171 pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); |
| 173 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsTitle).AsByteStringC()); | 172 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsTitle).AsStringC()); |
| 174 } | 173 } |
| 175 void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( | 174 void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( |
| 176 FXJSE_HVALUE hValue, | 175 FXJSE_HVALUE hValue, |
| 177 FX_BOOL bSetting, | 176 FX_BOOL bSetting, |
| 178 XFA_ATTRIBUTE eAttribute) { | 177 XFA_ATTRIBUTE eAttribute) { |
| 179 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 178 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 180 if (!pNotify) { | 179 if (!pNotify) { |
| 181 return; | 180 return; |
| 182 } | 181 } |
| 183 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 182 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 199 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 198 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 200 if (!pNotify) { | 199 if (!pNotify) { |
| 201 return; | 200 return; |
| 202 } | 201 } |
| 203 if (bSetting) { | 202 if (bSetting) { |
| 204 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VARIATION); | 203 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VARIATION); |
| 205 return; | 204 return; |
| 206 } | 205 } |
| 207 CFX_WideString wsVariation; | 206 CFX_WideString wsVariation; |
| 208 pNotify->GetAppProvider()->GetVariation(wsVariation); | 207 pNotify->GetAppProvider()->GetVariation(wsVariation); |
| 209 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVariation).AsByteStringC()); | 208 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVariation).AsStringC()); |
| 210 } | 209 } |
| 211 void CScript_HostPseudoModel::Script_HostPseudoModel_Version( | 210 void CScript_HostPseudoModel::Script_HostPseudoModel_Version( |
| 212 FXJSE_HVALUE hValue, | 211 FXJSE_HVALUE hValue, |
| 213 FX_BOOL bSetting, | 212 FX_BOOL bSetting, |
| 214 XFA_ATTRIBUTE eAttribute) { | 213 XFA_ATTRIBUTE eAttribute) { |
| 215 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 214 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 216 if (!pNotify) { | 215 if (!pNotify) { |
| 217 return; | 216 return; |
| 218 } | 217 } |
| 219 if (bSetting) { | 218 if (bSetting) { |
| 220 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); | 219 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); |
| 221 return; | 220 return; |
| 222 } | 221 } |
| 223 CFX_WideString wsVersion; | 222 CFX_WideString wsVersion; |
| 224 pNotify->GetAppProvider()->GetVersion(wsVersion); | 223 pNotify->GetAppProvider()->GetVersion(wsVersion); |
| 225 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion).AsByteStringC()); | 224 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion).AsStringC()); |
| 226 } | 225 } |
| 227 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( | 226 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( |
| 228 FXJSE_HVALUE hValue, | 227 FXJSE_HVALUE hValue, |
| 229 FX_BOOL bSetting, | 228 FX_BOOL bSetting, |
| 230 XFA_ATTRIBUTE eAttribute) { | 229 XFA_ATTRIBUTE eAttribute) { |
| 231 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 230 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 232 if (!pNotify) { | 231 if (!pNotify) { |
| 233 return; | 232 return; |
| 234 } | 233 } |
| 235 if (bSetting) { | 234 if (bSetting) { |
| 236 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); | 235 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VERSION); |
| 237 return; | 236 return; |
| 238 } | 237 } |
| 239 CFX_WideString wsVersion; | 238 CFX_WideString wsVersion; |
| 240 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); | 239 pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); |
| 241 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion).AsByteStringC()); | 240 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion).AsStringC()); |
| 242 } | 241 } |
| 243 void CScript_HostPseudoModel::Script_HostPseudoModel_Name( | 242 void CScript_HostPseudoModel::Script_HostPseudoModel_Name( |
| 244 FXJSE_HVALUE hValue, | 243 FXJSE_HVALUE hValue, |
| 245 FX_BOOL bSetting, | 244 FX_BOOL bSetting, |
| 246 XFA_ATTRIBUTE eAttribute) { | 245 XFA_ATTRIBUTE eAttribute) { |
| 247 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 246 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 248 if (!pNotify) { | 247 if (!pNotify) { |
| 249 return; | 248 return; |
| 250 } | 249 } |
| 251 if (bSetting) { | 250 if (bSetting) { |
| 252 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 251 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 253 return; | 252 return; |
| 254 } | 253 } |
| 255 CFX_WideString wsAppName; | 254 CFX_WideString wsAppName; |
| 256 pNotify->GetAppProvider()->GetAppName(wsAppName); | 255 pNotify->GetAppProvider()->GetAppName(wsAppName); |
| 257 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppName).AsByteStringC()); | 256 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppName).AsStringC()); |
| 258 } | 257 } |
| 259 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( | 258 void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( |
| 260 FXJSE_HVALUE hValue, | 259 FXJSE_HVALUE hValue, |
| 261 FX_BOOL bSetting, | 260 FX_BOOL bSetting, |
| 262 XFA_ATTRIBUTE eAttribute) { | 261 XFA_ATTRIBUTE eAttribute) { |
| 263 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 262 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 264 if (!pNotify) { | 263 if (!pNotify) { |
| 265 return; | 264 return; |
| 266 } | 265 } |
| 267 if (bSetting) { | 266 if (bSetting) { |
| 268 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 267 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 269 return; | 268 return; |
| 270 } | 269 } |
| 271 CFX_WideString wsFoxitAppName; | 270 CFX_WideString wsFoxitAppName; |
| 272 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName); | 271 pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName); |
| 273 FXJSE_Value_SetUTF8String(hValue, | 272 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsFoxitAppName).AsStringC()); |
| 274 FX_UTF8Encode(wsFoxitAppName).AsByteStringC()); | |
| 275 } | 273 } |
| 276 void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( | 274 void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( |
| 277 CFXJSE_Arguments* pArguments) { | 275 CFXJSE_Arguments* pArguments) { |
| 278 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { | 276 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { |
| 279 return; | 277 return; |
| 280 } | 278 } |
| 281 int32_t iLength = pArguments->GetLength(); | 279 int32_t iLength = pArguments->GetLength(); |
| 282 if (iLength != 1) { | 280 if (iLength != 1) { |
| 283 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); | 281 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); |
| 284 return; | 282 return; |
| 285 } | 283 } |
| 286 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 284 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 287 if (!pNotify) { | 285 if (!pNotify) { |
| 288 return; | 286 return; |
| 289 } | 287 } |
| 290 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 288 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 291 CFX_WideString wsURL; | 289 CFX_WideString wsURL; |
| 292 if (iLength >= 1) { | 290 if (iLength >= 1) { |
| 293 CFX_ByteString bsURL = pArguments->GetUTF8String(0); | 291 CFX_ByteString bsURL = pArguments->GetUTF8String(0); |
| 294 wsURL = CFX_WideString::FromUTF8(bsURL.AsByteStringC()); | 292 wsURL = CFX_WideString::FromUTF8(bsURL.AsStringC()); |
| 295 } | 293 } |
| 296 pNotify->GetDocProvider()->GotoURL(hDoc, wsURL.AsWideStringC()); | 294 pNotify->GetDocProvider()->GotoURL(hDoc, wsURL.AsStringC()); |
| 297 } | 295 } |
| 298 void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( | 296 void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( |
| 299 CFXJSE_Arguments* pArguments) { | 297 CFXJSE_Arguments* pArguments) { |
| 300 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { | 298 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { |
| 301 return; | 299 return; |
| 302 } | 300 } |
| 303 int32_t iLength = pArguments->GetLength(); | 301 int32_t iLength = pArguments->GetLength(); |
| 304 if (iLength != 1) { | 302 if (iLength != 1) { |
| 305 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); | 303 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); |
| 306 return; | 304 return; |
| 307 } | 305 } |
| 308 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 306 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 309 if (!pNotify) { | 307 if (!pNotify) { |
| 310 return; | 308 return; |
| 311 } | 309 } |
| 312 CXFA_Node* pNode = NULL; | 310 CXFA_Node* pNode = NULL; |
| 313 if (iLength >= 1) { | 311 if (iLength >= 1) { |
| 314 FXJSE_HVALUE hValue = pArguments->GetValue(0); | 312 FXJSE_HVALUE hValue = pArguments->GetValue(0); |
| 315 if (FXJSE_Value_IsObject(hValue)) { | 313 if (FXJSE_Value_IsObject(hValue)) { |
| 316 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, nullptr)); | 314 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, nullptr)); |
| 317 } else if (FXJSE_Value_IsUTF8String(hValue)) { | 315 } else if (FXJSE_Value_IsUTF8String(hValue)) { |
| 318 CFX_ByteString bsString; | 316 CFX_ByteString bsString; |
| 319 FXJSE_Value_ToUTF8String(hValue, bsString); | 317 FXJSE_Value_ToUTF8String(hValue, bsString); |
| 320 CFX_WideString wsExpression = | 318 CFX_WideString wsExpression = |
| 321 CFX_WideString::FromUTF8(bsString.AsByteStringC()); | 319 CFX_WideString::FromUTF8(bsString.AsStringC()); |
| 322 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 320 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 323 if (!pScriptContext) { | 321 if (!pScriptContext) { |
| 324 FXJSE_Value_Release(hValue); | 322 FXJSE_Value_Release(hValue); |
| 325 return; | 323 return; |
| 326 } | 324 } |
| 327 CXFA_Object* pObject = pScriptContext->GetThisObject(); | 325 CXFA_Object* pObject = pScriptContext->GetThisObject(); |
| 328 if (!pObject) { | 326 if (!pObject) { |
| 329 FXJSE_Value_Release(hValue); | 327 FXJSE_Value_Release(hValue); |
| 330 return; | 328 return; |
| 331 } | 329 } |
| 332 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | | 330 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | |
| 333 XFA_RESOLVENODE_Siblings; | 331 XFA_RESOLVENODE_Siblings; |
| 334 XFA_RESOLVENODE_RS resoveNodeRS; | 332 XFA_RESOLVENODE_RS resoveNodeRS; |
| 335 int32_t iRet = pScriptContext->ResolveObjects( | 333 int32_t iRet = pScriptContext->ResolveObjects( |
| 336 pObject, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag); | 334 pObject, wsExpression.AsStringC(), resoveNodeRS, dwFlag); |
| 337 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { | 335 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { |
| 338 FXJSE_Value_Release(hValue); | 336 FXJSE_Value_Release(hValue); |
| 339 return; | 337 return; |
| 340 } | 338 } |
| 341 pNode = resoveNodeRS.nodes[0]->AsNode(); | 339 pNode = resoveNodeRS.nodes[0]->AsNode(); |
| 342 } | 340 } |
| 343 FXJSE_Value_Release(hValue); | 341 FXJSE_Value_Release(hValue); |
| 344 } | 342 } |
| 345 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | 343 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
| 346 if (!pDocLayout) { | 344 if (!pDocLayout) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 364 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 362 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 365 if (!pNotify) { | 363 if (!pNotify) { |
| 366 return; | 364 return; |
| 367 } | 365 } |
| 368 CFX_WideString wsQuestion; | 366 CFX_WideString wsQuestion; |
| 369 CFX_WideString wsTitle; | 367 CFX_WideString wsTitle; |
| 370 CFX_WideString wsDefaultAnswer; | 368 CFX_WideString wsDefaultAnswer; |
| 371 FX_BOOL bMark = FALSE; | 369 FX_BOOL bMark = FALSE; |
| 372 if (iLength >= 1) { | 370 if (iLength >= 1) { |
| 373 CFX_ByteString bsQuestion = pArguments->GetUTF8String(0); | 371 CFX_ByteString bsQuestion = pArguments->GetUTF8String(0); |
| 374 wsQuestion = CFX_WideString::FromUTF8(bsQuestion.AsByteStringC()); | 372 wsQuestion = CFX_WideString::FromUTF8(bsQuestion.AsStringC()); |
| 375 } | 373 } |
| 376 if (iLength >= 2) { | 374 if (iLength >= 2) { |
| 377 CFX_ByteString bsTitle = pArguments->GetUTF8String(1); | 375 CFX_ByteString bsTitle = pArguments->GetUTF8String(1); |
| 378 wsTitle = CFX_WideString::FromUTF8(bsTitle.AsByteStringC()); | 376 wsTitle = CFX_WideString::FromUTF8(bsTitle.AsStringC()); |
| 379 } | 377 } |
| 380 if (iLength >= 3) { | 378 if (iLength >= 3) { |
| 381 CFX_ByteString bsDefaultAnswer = pArguments->GetUTF8String(2); | 379 CFX_ByteString bsDefaultAnswer = pArguments->GetUTF8String(2); |
| 382 wsDefaultAnswer = CFX_WideString::FromUTF8(bsDefaultAnswer.AsByteStringC()); | 380 wsDefaultAnswer = CFX_WideString::FromUTF8(bsDefaultAnswer.AsStringC()); |
| 383 } | 381 } |
| 384 if (iLength >= 4) { | 382 if (iLength >= 4) { |
| 385 bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; | 383 bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; |
| 386 } | 384 } |
| 387 CFX_WideString wsAnswer; | 385 CFX_WideString wsAnswer; |
| 388 pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion.AsWideStringC(), | 386 pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion.AsStringC(), |
| 389 wsTitle.AsWideStringC(), | 387 wsTitle.AsStringC(), |
| 390 wsDefaultAnswer.AsWideStringC(), bMark); | 388 wsDefaultAnswer.AsStringC(), bMark); |
| 391 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 389 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
| 392 if (hValue) { | 390 if (hValue) { |
| 393 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer).AsByteStringC()); | 391 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer).AsStringC()); |
| 394 } | 392 } |
| 395 } | 393 } |
| 396 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( | 394 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( |
| 397 CFXJSE_Arguments* pArguments) { | 395 CFXJSE_Arguments* pArguments) { |
| 398 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 396 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 399 if (!pNotify) { | 397 if (!pNotify) { |
| 400 return; | 398 return; |
| 401 } | 399 } |
| 402 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch(); | 400 int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch(); |
| 403 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 401 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); | 434 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); |
| 437 return; | 435 return; |
| 438 } | 436 } |
| 439 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 437 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 440 if (!pNotify) { | 438 if (!pNotify) { |
| 441 return; | 439 return; |
| 442 } | 440 } |
| 443 CFX_WideString wsExpression; | 441 CFX_WideString wsExpression; |
| 444 if (iLength >= 1) { | 442 if (iLength >= 1) { |
| 445 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 443 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); |
| 446 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsByteStringC()); | 444 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); |
| 447 } | 445 } |
| 448 if (wsExpression.IsEmpty()) { | 446 if (wsExpression.IsEmpty()) { |
| 449 pNotify->ResetData(); | 447 pNotify->ResetData(); |
| 450 return; | 448 return; |
| 451 } | 449 } |
| 452 int32_t iStart = 0; | 450 int32_t iStart = 0; |
| 453 CFX_WideString wsName; | 451 CFX_WideString wsName; |
| 454 CXFA_Node* pNode = NULL; | 452 CXFA_Node* pNode = NULL; |
| 455 int32_t iExpLength = wsExpression.GetLength(); | 453 int32_t iExpLength = wsExpression.GetLength(); |
| 456 while (iStart < iExpLength) { | 454 while (iStart < iExpLength) { |
| 457 iStart = XFA_FilterName(wsExpression.AsWideStringC(), iStart, wsName); | 455 iStart = XFA_FilterName(wsExpression.AsStringC(), iStart, wsName); |
| 458 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 456 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 459 if (!pScriptContext) { | 457 if (!pScriptContext) { |
| 460 return; | 458 return; |
| 461 } | 459 } |
| 462 CXFA_Object* pObject = pScriptContext->GetThisObject(); | 460 CXFA_Object* pObject = pScriptContext->GetThisObject(); |
| 463 if (!pObject) { | 461 if (!pObject) { |
| 464 return; | 462 return; |
| 465 } | 463 } |
| 466 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | | 464 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | |
| 467 XFA_RESOLVENODE_Siblings; | 465 XFA_RESOLVENODE_Siblings; |
| 468 XFA_RESOLVENODE_RS resoveNodeRS; | 466 XFA_RESOLVENODE_RS resoveNodeRS; |
| 469 int32_t iRet = pScriptContext->ResolveObjects( | 467 int32_t iRet = pScriptContext->ResolveObjects(pObject, wsName.AsStringC(), |
| 470 pObject, wsName.AsWideStringC(), resoveNodeRS, dwFlag); | 468 resoveNodeRS, dwFlag); |
| 471 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { | 469 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { |
| 472 continue; | 470 continue; |
| 473 } | 471 } |
| 474 pNode = resoveNodeRS.nodes[0]->AsNode(); | 472 pNode = resoveNodeRS.nodes[0]->AsNode(); |
| 475 pNotify->ResetData(pNode->GetWidgetData()); | 473 pNotify->ResetData(pNode->GetWidgetData()); |
| 476 } | 474 } |
| 477 if (!pNode) { | 475 if (!pNode) { |
| 478 pNotify->ResetData(); | 476 pNotify->ResetData(); |
| 479 } | 477 } |
| 480 } | 478 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 } | 512 } |
| 515 CXFA_Node* pNode = NULL; | 513 CXFA_Node* pNode = NULL; |
| 516 if (iLength >= 1) { | 514 if (iLength >= 1) { |
| 517 FXJSE_HVALUE hValue = pArguments->GetValue(0); | 515 FXJSE_HVALUE hValue = pArguments->GetValue(0); |
| 518 if (FXJSE_Value_IsObject(hValue)) { | 516 if (FXJSE_Value_IsObject(hValue)) { |
| 519 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, NULL)); | 517 pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, NULL)); |
| 520 } else if (FXJSE_Value_IsUTF8String(hValue)) { | 518 } else if (FXJSE_Value_IsUTF8String(hValue)) { |
| 521 CFX_ByteString bsString; | 519 CFX_ByteString bsString; |
| 522 FXJSE_Value_ToUTF8String(hValue, bsString); | 520 FXJSE_Value_ToUTF8String(hValue, bsString); |
| 523 CFX_WideString wsExpression = | 521 CFX_WideString wsExpression = |
| 524 CFX_WideString::FromUTF8(bsString.AsByteStringC()); | 522 CFX_WideString::FromUTF8(bsString.AsStringC()); |
| 525 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 523 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 526 if (!pScriptContext) { | 524 if (!pScriptContext) { |
| 527 FXJSE_Value_Release(hValue); | 525 FXJSE_Value_Release(hValue); |
| 528 return; | 526 return; |
| 529 } | 527 } |
| 530 CXFA_Object* pObject = pScriptContext->GetThisObject(); | 528 CXFA_Object* pObject = pScriptContext->GetThisObject(); |
| 531 if (!pObject) { | 529 if (!pObject) { |
| 532 FXJSE_Value_Release(hValue); | 530 FXJSE_Value_Release(hValue); |
| 533 return; | 531 return; |
| 534 } | 532 } |
| 535 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | | 533 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | |
| 536 XFA_RESOLVENODE_Siblings; | 534 XFA_RESOLVENODE_Siblings; |
| 537 XFA_RESOLVENODE_RS resoveNodeRS; | 535 XFA_RESOLVENODE_RS resoveNodeRS; |
| 538 int32_t iRet = pScriptContext->ResolveObjects( | 536 int32_t iRet = pScriptContext->ResolveObjects( |
| 539 pObject, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag); | 537 pObject, wsExpression.AsStringC(), resoveNodeRS, dwFlag); |
| 540 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { | 538 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { |
| 541 FXJSE_Value_Release(hValue); | 539 FXJSE_Value_Release(hValue); |
| 542 return; | 540 return; |
| 543 } | 541 } |
| 544 pNode = resoveNodeRS.nodes[0]->AsNode(); | 542 pNode = resoveNodeRS.nodes[0]->AsNode(); |
| 545 } | 543 } |
| 546 FXJSE_Value_Release(hValue); | 544 FXJSE_Value_Release(hValue); |
| 547 } | 545 } |
| 548 pNotify->SetFocusWidgetNode(pNode); | 546 pNotify->SetFocusWidgetNode(pNode); |
| 549 } | 547 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 dwMessageType = XFA_MBICON_Error; | 592 dwMessageType = XFA_MBICON_Error; |
| 595 } | 593 } |
| 596 } | 594 } |
| 597 if (iLength >= 4) { | 595 if (iLength >= 4) { |
| 598 dwButtonType = pArguments->GetInt32(3); | 596 dwButtonType = pArguments->GetInt32(3); |
| 599 if (dwButtonType > XFA_MB_YesNoCancel) { | 597 if (dwButtonType > XFA_MB_YesNoCancel) { |
| 600 dwButtonType = XFA_MB_OK; | 598 dwButtonType = XFA_MB_OK; |
| 601 } | 599 } |
| 602 } | 600 } |
| 603 int32_t iValue = pNotify->GetAppProvider()->MsgBox( | 601 int32_t iValue = pNotify->GetAppProvider()->MsgBox( |
| 604 wsMessage.AsWideStringC(), bsTitle.AsWideStringC(), dwMessageType, | 602 wsMessage.AsStringC(), bsTitle.AsStringC(), dwMessageType, dwButtonType); |
| 605 dwButtonType); | |
| 606 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 603 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
| 607 if (hValue) { | 604 if (hValue) { |
| 608 FXJSE_Value_SetInteger(hValue, iValue); | 605 FXJSE_Value_SetInteger(hValue, iValue); |
| 609 } | 606 } |
| 610 } | 607 } |
| 611 FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( | 608 FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( |
| 612 CFXJSE_Arguments* pArguments, | 609 CFXJSE_Arguments* pArguments, |
| 613 int32_t iArgIndex, | 610 int32_t iArgIndex, |
| 614 CFX_WideString& wsValue) { | 611 CFX_WideString& wsValue) { |
| 615 if (pArguments == NULL || iArgIndex < 0) { | 612 if (pArguments == NULL || iArgIndex < 0) { |
| 616 return FALSE; | 613 return FALSE; |
| 617 } | 614 } |
| 618 FX_BOOL bIsJsType = FALSE; | 615 FX_BOOL bIsJsType = FALSE; |
| 619 if (m_pDocument->GetScriptContext()->GetType() == | 616 if (m_pDocument->GetScriptContext()->GetType() == |
| 620 XFA_SCRIPTLANGTYPE_Javascript) { | 617 XFA_SCRIPTLANGTYPE_Javascript) { |
| 621 bIsJsType = TRUE; | 618 bIsJsType = TRUE; |
| 622 } | 619 } |
| 623 FXJSE_HVALUE hValueArg = pArguments->GetValue(iArgIndex); | 620 FXJSE_HVALUE hValueArg = pArguments->GetValue(iArgIndex); |
| 624 if (!FXJSE_Value_IsUTF8String(hValueArg) && bIsJsType) { | 621 if (!FXJSE_Value_IsUTF8String(hValueArg) && bIsJsType) { |
| 625 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 622 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
| 626 FXJSE_Value_Release(hValueArg); | 623 FXJSE_Value_Release(hValueArg); |
| 627 return FALSE; | 624 return FALSE; |
| 628 } | 625 } |
| 629 if (FXJSE_Value_IsNull(hValueArg)) { | 626 if (FXJSE_Value_IsNull(hValueArg)) { |
| 630 wsValue = FX_WSTRC(L""); | 627 wsValue = FX_WSTRC(L""); |
| 631 } else { | 628 } else { |
| 632 CFX_ByteString byMessage; | 629 CFX_ByteString byMessage; |
| 633 FXJSE_Value_ToUTF8String(hValueArg, byMessage); | 630 FXJSE_Value_ToUTF8String(hValueArg, byMessage); |
| 634 wsValue = CFX_WideString::FromUTF8(byMessage.AsByteStringC()); | 631 wsValue = CFX_WideString::FromUTF8(byMessage.AsStringC()); |
| 635 } | 632 } |
| 636 FXJSE_Value_Release(hValueArg); | 633 FXJSE_Value_Release(hValueArg); |
| 637 return TRUE; | 634 return TRUE; |
| 638 } | 635 } |
| 639 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( | 636 void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( |
| 640 CFXJSE_Arguments* pArguments) { | 637 CFXJSE_Arguments* pArguments) { |
| 641 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 638 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 642 if (!pNotify) { | 639 if (!pNotify) { |
| 643 return; | 640 return; |
| 644 } | 641 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); | 721 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); |
| 725 return; | 722 return; |
| 726 } | 723 } |
| 727 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 724 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 728 if (!pNotify) { | 725 if (!pNotify) { |
| 729 return; | 726 return; |
| 730 } | 727 } |
| 731 CFX_WideString wsFilePath; | 728 CFX_WideString wsFilePath; |
| 732 if (iLength > 0) { | 729 if (iLength > 0) { |
| 733 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); | 730 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); |
| 734 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsByteStringC()); | 731 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); |
| 735 } | 732 } |
| 736 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 733 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 737 pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath.AsWideStringC()); | 734 pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath.AsStringC()); |
| 738 } | 735 } |
| 739 void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( | 736 void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( |
| 740 CFXJSE_Arguments* pArguments) { | 737 CFXJSE_Arguments* pArguments) { |
| 741 int32_t iLength = pArguments->GetLength(); | 738 int32_t iLength = pArguments->GetLength(); |
| 742 if (iLength < 0 || iLength > 2) { | 739 if (iLength < 0 || iLength > 2) { |
| 743 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); | 740 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); |
| 744 return; | 741 return; |
| 745 } | 742 } |
| 746 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 743 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 747 if (!pNotify) { | 744 if (!pNotify) { |
| 748 return; | 745 return; |
| 749 } | 746 } |
| 750 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 747 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 751 CFX_WideString wsFilePath; | 748 CFX_WideString wsFilePath; |
| 752 FX_BOOL bXDP = TRUE; | 749 FX_BOOL bXDP = TRUE; |
| 753 if (iLength >= 1) { | 750 if (iLength >= 1) { |
| 754 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); | 751 CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); |
| 755 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsByteStringC()); | 752 wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); |
| 756 } | 753 } |
| 757 if (iLength >= 2) { | 754 if (iLength >= 2) { |
| 758 bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; | 755 bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; |
| 759 } | 756 } |
| 760 pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath.AsWideStringC(), bXDP); | 757 pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath.AsStringC(), bXDP); |
| 761 } | 758 } |
| 762 void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( | 759 void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( |
| 763 CFXJSE_Arguments* pArguments) { | 760 CFXJSE_Arguments* pArguments) { |
| 764 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 761 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 765 if (!pNotify) { | 762 if (!pNotify) { |
| 766 return; | 763 return; |
| 767 } | 764 } |
| 768 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 765 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 769 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); | 766 int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); |
| 770 int32_t nNewPage = 0; | 767 int32_t nNewPage = 0; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 796 } | 793 } |
| 797 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( | 794 void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( |
| 798 CFXJSE_Arguments* pArguments) { | 795 CFXJSE_Arguments* pArguments) { |
| 799 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 796 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 800 if (!pNotify) { | 797 if (!pNotify) { |
| 801 return; | 798 return; |
| 802 } | 799 } |
| 803 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); | 800 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); |
| 804 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 801 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
| 805 if (hValue) { | 802 if (hValue) { |
| 806 FXJSE_Value_SetUTF8String(hValue, | 803 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime).AsStringC()); |
| 807 FX_UTF8Encode(wsDataTime).AsByteStringC()); | |
| 808 } | 804 } |
| 809 } | 805 } |
| OLD | NEW |