| 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 "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" | 7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" | 9 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" |
| 10 #include "fpdfsdk/include/cpdfsdk_environment.h" | 10 #include "fpdfsdk/include/cpdfsdk_environment.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 wsName = pEnv->FFI_GetAppName(); | 92 wsName = pEnv->FFI_GetAppName(); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 void CPDFXFA_App::SetAppType(const CFX_WideStringC& wsAppType) { | 96 void CPDFXFA_App::SetAppType(const CFX_WideStringC& wsAppType) { |
| 97 m_csAppType = wsAppType; | 97 m_csAppType = wsAppType; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void CPDFXFA_App::GetLanguage(CFX_WideString& wsLanguage) { | 100 void CPDFXFA_App::GetLanguage(CFX_WideString& wsLanguage) { |
| 101 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); | 101 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); |
| 102 if (pEnv) { | 102 if (pEnv) |
| 103 wsLanguage = pEnv->FFI_GetLanguage(); | 103 wsLanguage = pEnv->GetLanguage(); |
| 104 } | |
| 105 } | 104 } |
| 106 | 105 |
| 107 void CPDFXFA_App::GetPlatform(CFX_WideString& wsPlatform) { | 106 void CPDFXFA_App::GetPlatform(CFX_WideString& wsPlatform) { |
| 108 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); | 107 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); |
| 109 if (pEnv) { | 108 if (pEnv) { |
| 110 wsPlatform = pEnv->FFI_GetPlatform(); | 109 wsPlatform = pEnv->GetPlatform(); |
| 111 } | 110 } |
| 112 } | 111 } |
| 113 | 112 |
| 114 void CPDFXFA_App::GetVariation(CFX_WideString& wsVariation) { | 113 void CPDFXFA_App::GetVariation(CFX_WideString& wsVariation) { |
| 115 wsVariation = JS_STR_VIEWERVARIATION; | 114 wsVariation = JS_STR_VIEWERVARIATION; |
| 116 } | 115 } |
| 117 | 116 |
| 118 void CPDFXFA_App::GetVersion(CFX_WideString& wsVersion) { | 117 void CPDFXFA_App::GetVersion(CFX_WideString& wsVersion) { |
| 119 wsVersion = JS_STR_VIEWERVERSION_XFA; | 118 wsVersion = JS_STR_VIEWERVERSION_XFA; |
| 120 } | 119 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 pBuff[nLength + 1] = 0; | 196 pBuff[nLength + 1] = 0; |
| 198 wsAnswer = CFX_WideString::FromUTF16LE( | 197 wsAnswer = CFX_WideString::FromUTF16LE( |
| 199 reinterpret_cast<const unsigned short*>(pBuff), | 198 reinterpret_cast<const unsigned short*>(pBuff), |
| 200 nLength / sizeof(unsigned short)); | 199 nLength / sizeof(unsigned short)); |
| 201 } | 200 } |
| 202 delete[] pBuff; | 201 delete[] pBuff; |
| 203 } | 202 } |
| 204 return wsAnswer; | 203 return wsAnswer; |
| 205 } | 204 } |
| 206 | 205 |
| 207 int32_t CPDFXFA_App::GetCurDocumentInBatch() { | |
| 208 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); | |
| 209 if (pEnv) { | |
| 210 return pEnv->FFI_GetCurDocument(); | |
| 211 } | |
| 212 return 0; | |
| 213 } | |
| 214 | |
| 215 int32_t CPDFXFA_App::GetDocumentCountInBatch() { | |
| 216 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); | |
| 217 if (pEnv) { | |
| 218 return pEnv->FFI_GetDocumentCount(); | |
| 219 } | |
| 220 | |
| 221 return 0; | |
| 222 } | |
| 223 | |
| 224 IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { | 206 IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { |
| 225 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); | 207 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); |
| 226 return pEnv ? pEnv->FFI_DownloadFromURL(wsURL.c_str()) : nullptr; | 208 return pEnv ? pEnv->DownloadFromURL(wsURL.c_str()) : nullptr; |
| 227 } | 209 } |
| 228 | 210 |
| 229 FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideString& wsURL, | 211 FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideString& wsURL, |
| 230 const CFX_WideString& wsData, | 212 const CFX_WideString& wsData, |
| 231 const CFX_WideString& wsContentType, | 213 const CFX_WideString& wsContentType, |
| 232 const CFX_WideString& wsEncode, | 214 const CFX_WideString& wsEncode, |
| 233 const CFX_WideString& wsHeader, | 215 const CFX_WideString& wsHeader, |
| 234 CFX_WideString& wsResponse) { | 216 CFX_WideString& wsResponse) { |
| 235 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); | 217 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); |
| 236 if (!pEnv) | 218 if (!pEnv) |
| 237 return FALSE; | 219 return FALSE; |
| 238 | 220 |
| 239 wsResponse = pEnv->FFI_PostRequestURL(wsURL.c_str(), wsData.c_str(), | 221 wsResponse = |
| 240 wsContentType.c_str(), wsEncode.c_str(), | 222 pEnv->PostRequestURL(wsURL.c_str(), wsData.c_str(), wsContentType.c_str(), |
| 241 wsHeader.c_str()); | 223 wsEncode.c_str(), wsHeader.c_str()); |
| 242 return TRUE; | 224 return TRUE; |
| 243 } | 225 } |
| 244 | 226 |
| 245 FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideString& wsURL, | 227 FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideString& wsURL, |
| 246 const CFX_WideString& wsData, | 228 const CFX_WideString& wsData, |
| 247 const CFX_WideString& wsEncode) { | 229 const CFX_WideString& wsEncode) { |
| 248 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); | 230 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); |
| 249 return pEnv && | 231 return pEnv && |
| 250 pEnv->FFI_PutRequestURL(wsURL.c_str(), wsData.c_str(), | 232 pEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(), wsEncode.c_str()); |
| 251 wsEncode.c_str()); | |
| 252 } | 233 } |
| 253 | 234 |
| 254 void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { | 235 void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { |
| 255 switch (iStringID) { | 236 switch (iStringID) { |
| 256 case XFA_IDS_ValidateFailed: | 237 case XFA_IDS_ValidateFailed: |
| 257 wsString = L"%s validation failed"; | 238 wsString = L"%s validation failed"; |
| 258 return; | 239 return; |
| 259 case XFA_IDS_CalcOverride: | 240 case XFA_IDS_CalcOverride: |
| 260 wsString = L"Calculate Override"; | 241 wsString = L"Calculate Override"; |
| 261 return; | 242 return; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 329 } |
| 349 } | 330 } |
| 350 | 331 |
| 351 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { | 332 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { |
| 352 CXFA_FWLAdapterTimerMgr* pAdapter = nullptr; | 333 CXFA_FWLAdapterTimerMgr* pAdapter = nullptr; |
| 353 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); | 334 CPDFSDK_Environment* pEnv = m_pEnvList.GetAt(0); |
| 354 if (pEnv) | 335 if (pEnv) |
| 355 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); | 336 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); |
| 356 return pAdapter; | 337 return pAdapter; |
| 357 } | 338 } |
| OLD | NEW |