Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
dsinclair | 89bdd08 | 2016-04-06 10:47:54 -0700 | [diff] [blame] | 7 | #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" |
weili | 625ad66 | 2016-06-15 11:21:33 -0700 | [diff] [blame] | 8 | |
dsinclair | 89bdd08 | 2016-04-06 10:47:54 -0700 | [diff] [blame] | 9 | #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" |
Dan Sinclair | 61046b9 | 2016-02-18 14:48:48 -0500 | [diff] [blame] | 10 | #include "fpdfsdk/include/fsdk_define.h" |
| 11 | #include "fpdfsdk/include/fsdk_mgr.h" |
Dan Sinclair | a98600a | 2016-03-21 15:15:56 -0400 | [diff] [blame] | 12 | #include "xfa/fxbarcode/include/BC_Library.h" |
dsinclair | 7222ea6 | 2016-04-06 14:33:07 -0700 | [diff] [blame] | 13 | #include "xfa/fxfa/include/xfa_ffapp.h" |
| 14 | #include "xfa/fxfa/include/xfa_fontmgr.h" |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 15 | |
thestig | 1cd352e | 2016-06-07 17:53:06 -0700 | [diff] [blame] | 16 | CPDFXFA_App* CPDFXFA_App::g_pApp = nullptr; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 17 | |
| 18 | CPDFXFA_App* CPDFXFA_App::GetInstance() { |
| 19 | if (!g_pApp) { |
| 20 | g_pApp = new CPDFXFA_App(); |
| 21 | } |
| 22 | return g_pApp; |
| 23 | } |
| 24 | |
| 25 | void CPDFXFA_App::ReleaseInstance() { |
| 26 | delete g_pApp; |
thestig | 1cd352e | 2016-06-07 17:53:06 -0700 | [diff] [blame] | 27 | g_pApp = nullptr; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | CPDFXFA_App::CPDFXFA_App() |
| 31 | : m_bJavaScriptInitialized(FALSE), |
thestig | 1cd352e | 2016-06-07 17:53:06 -0700 | [diff] [blame] | 32 | m_pXFAApp(nullptr), |
dsinclair | ec3da5b | 2016-05-25 16:42:05 -0700 | [diff] [blame] | 33 | m_pIsolate(nullptr), |
tsepez | d5f7261 | 2016-06-01 14:01:31 -0700 | [diff] [blame] | 34 | m_csAppType(JS_STR_VIEWERTYPE_STANDARD) { |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 35 | m_pEnvList.RemoveAll(); |
| 36 | } |
| 37 | |
| 38 | CPDFXFA_App::~CPDFXFA_App() { |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 39 | delete m_pXFAApp; |
thestig | 1cd352e | 2016-06-07 17:53:06 -0700 | [diff] [blame] | 40 | m_pXFAApp = nullptr; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 41 | |
tsepez | d5f7261 | 2016-06-01 14:01:31 -0700 | [diff] [blame] | 42 | FXJSE_Runtime_Release(m_pIsolate); |
dsinclair | ec3da5b | 2016-05-25 16:42:05 -0700 | [diff] [blame] | 43 | m_pIsolate = nullptr; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 44 | |
| 45 | FXJSE_Finalize(); |
| 46 | BC_Library_Destory(); |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 47 | } |
| 48 | |
dsinclair | ec3da5b | 2016-05-25 16:42:05 -0700 | [diff] [blame] | 49 | FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) { |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 50 | BC_Library_Init(); |
| 51 | FXJSE_Initialize(); |
| 52 | |
tsepez | d5f7261 | 2016-06-01 14:01:31 -0700 | [diff] [blame] | 53 | m_pIsolate = pIsolate ? pIsolate : FXJSE_Runtime_Create_Own(); |
dsinclair | ec3da5b | 2016-05-25 16:42:05 -0700 | [diff] [blame] | 54 | if (!m_pIsolate) |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 55 | return FALSE; |
| 56 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 57 | m_pXFAApp = new CXFA_FFApp(this); |
thestig | 4dce6d4 | 2016-05-31 05:46:52 -0700 | [diff] [blame] | 58 | m_pXFAApp->SetDefaultFontMgr( |
| 59 | std::unique_ptr<CXFA_DefFontMgr>(new CXFA_DefFontMgr)); |
tsepez | d5f7261 | 2016-06-01 14:01:31 -0700 | [diff] [blame] | 60 | |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 61 | return TRUE; |
| 62 | } |
| 63 | |
| 64 | FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFDoc_Environment* pEnv) { |
| 65 | if (!pEnv) |
| 66 | return FALSE; |
| 67 | |
| 68 | m_pEnvList.Add(pEnv); |
| 69 | return TRUE; |
| 70 | } |
| 71 | |
| 72 | FX_BOOL CPDFXFA_App::RemoveFormFillEnv(CPDFDoc_Environment* pEnv) { |
| 73 | if (!pEnv) |
| 74 | return FALSE; |
| 75 | |
| 76 | int nFind = m_pEnvList.Find(pEnv); |
| 77 | if (nFind != -1) { |
| 78 | m_pEnvList.RemoveAt(nFind); |
| 79 | return TRUE; |
| 80 | } |
| 81 | |
| 82 | return FALSE; |
| 83 | } |
| 84 | |
| 85 | void CPDFXFA_App::GetAppType(CFX_WideString& wsAppType) { |
| 86 | wsAppType = m_csAppType; |
| 87 | } |
| 88 | |
| 89 | void CPDFXFA_App::GetAppName(CFX_WideString& wsName) { |
| 90 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 91 | if (pEnv) { |
| 92 | wsName = pEnv->FFI_GetAppName(); |
| 93 | } |
| 94 | } |
| 95 | |
weili | 625ad66 | 2016-06-15 11:21:33 -0700 | [diff] [blame] | 96 | void CPDFXFA_App::GetFoxitAppName(CFX_WideString& wsFoxitName) { |
| 97 | wsFoxitName = L"Foxit"; |
| 98 | } |
| 99 | |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 100 | void CPDFXFA_App::SetAppType(const CFX_WideStringC& wsAppType) { |
| 101 | m_csAppType = wsAppType; |
| 102 | } |
| 103 | |
weili | 625ad66 | 2016-06-15 11:21:33 -0700 | [diff] [blame] | 104 | void CPDFXFA_App::SetFoxitAppType(const CFX_WideStringC& wsFoxitAppType) {} |
| 105 | |
| 106 | void CPDFXFA_App::GetFoxitAppType(CFX_WideString& wsFoxitAppType) { |
| 107 | wsFoxitAppType.clear(); |
| 108 | } |
| 109 | |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 110 | void CPDFXFA_App::GetLanguage(CFX_WideString& wsLanguage) { |
| 111 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 112 | if (pEnv) { |
| 113 | wsLanguage = pEnv->FFI_GetLanguage(); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | void CPDFXFA_App::GetPlatform(CFX_WideString& wsPlatform) { |
| 118 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 119 | if (pEnv) { |
| 120 | wsPlatform = pEnv->FFI_GetPlatform(); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | void CPDFXFA_App::GetVariation(CFX_WideString& wsVariation) { |
| 125 | wsVariation = JS_STR_VIEWERVARIATION; |
| 126 | } |
| 127 | |
| 128 | void CPDFXFA_App::GetVersion(CFX_WideString& wsVersion) { |
| 129 | wsVersion = JS_STR_VIEWERVERSION_XFA; |
| 130 | } |
| 131 | |
weili | 625ad66 | 2016-06-15 11:21:33 -0700 | [diff] [blame] | 132 | void CPDFXFA_App::GetFoxitVersion(CFX_WideString& wsFoxitVersion) { |
| 133 | wsFoxitVersion = L"7.0"; |
| 134 | } |
| 135 | |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 136 | void CPDFXFA_App::Beep(uint32_t dwType) { |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 137 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 138 | if (pEnv) { |
| 139 | pEnv->JS_appBeep(dwType); |
| 140 | } |
| 141 | } |
| 142 | |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 143 | int32_t CPDFXFA_App::MsgBox(const CFX_WideString& wsMessage, |
| 144 | const CFX_WideString& wsTitle, |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 145 | uint32_t dwIconType, |
| 146 | uint32_t dwButtonType) { |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 147 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 148 | if (!pEnv) |
| 149 | return -1; |
| 150 | |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 151 | uint32_t iconType = 0; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 152 | int iButtonType = 0; |
| 153 | switch (dwIconType) { |
| 154 | case XFA_MBICON_Error: |
| 155 | iconType |= 0; |
| 156 | break; |
| 157 | case XFA_MBICON_Warning: |
| 158 | iconType |= 1; |
| 159 | break; |
| 160 | case XFA_MBICON_Question: |
| 161 | iconType |= 2; |
| 162 | break; |
| 163 | case XFA_MBICON_Status: |
| 164 | iconType |= 3; |
| 165 | break; |
| 166 | } |
| 167 | switch (dwButtonType) { |
| 168 | case XFA_MB_OK: |
| 169 | iButtonType |= 0; |
| 170 | break; |
| 171 | case XFA_MB_OKCancel: |
| 172 | iButtonType |= 1; |
| 173 | break; |
| 174 | case XFA_MB_YesNo: |
| 175 | iButtonType |= 2; |
| 176 | break; |
| 177 | case XFA_MB_YesNoCancel: |
| 178 | iButtonType |= 3; |
| 179 | break; |
| 180 | } |
tsepez | 660956f | 2016-04-06 06:27:29 -0700 | [diff] [blame] | 181 | int32_t iRet = pEnv->JS_appAlert(wsMessage.c_str(), wsTitle.c_str(), |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 182 | iButtonType, iconType); |
| 183 | switch (iRet) { |
| 184 | case 1: |
| 185 | return XFA_IDOK; |
| 186 | case 2: |
| 187 | return XFA_IDCancel; |
| 188 | case 3: |
| 189 | return XFA_IDNo; |
| 190 | case 4: |
| 191 | return XFA_IDYes; |
| 192 | } |
| 193 | return XFA_IDYes; |
| 194 | } |
| 195 | |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 196 | CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, |
| 197 | const CFX_WideString& wsTitle, |
| 198 | const CFX_WideString& wsDefaultAnswer, |
| 199 | FX_BOOL bMark) { |
| 200 | CFX_WideString wsAnswer; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 201 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 202 | if (pEnv) { |
| 203 | int nLength = 2048; |
| 204 | char* pBuff = new char[nLength]; |
tsepez | 660956f | 2016-04-06 06:27:29 -0700 | [diff] [blame] | 205 | nLength = pEnv->JS_appResponse(wsQuestion.c_str(), wsTitle.c_str(), |
thestig | 1cd352e | 2016-06-07 17:53:06 -0700 | [diff] [blame] | 206 | wsDefaultAnswer.c_str(), nullptr, bMark, |
| 207 | pBuff, nLength); |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 208 | if (nLength > 0) { |
| 209 | nLength = nLength > 2046 ? 2046 : nLength; |
| 210 | pBuff[nLength] = 0; |
| 211 | pBuff[nLength + 1] = 0; |
| 212 | wsAnswer = CFX_WideString::FromUTF16LE( |
| 213 | reinterpret_cast<const unsigned short*>(pBuff), |
| 214 | nLength / sizeof(unsigned short)); |
| 215 | } |
| 216 | delete[] pBuff; |
| 217 | } |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 218 | return wsAnswer; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | int32_t CPDFXFA_App::GetCurDocumentInBatch() { |
| 222 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 223 | if (pEnv) { |
| 224 | return pEnv->FFI_GetCurDocument(); |
| 225 | } |
| 226 | return 0; |
| 227 | } |
| 228 | |
| 229 | int32_t CPDFXFA_App::GetDocumentCountInBatch() { |
| 230 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 231 | if (pEnv) { |
| 232 | return pEnv->FFI_GetDocumentCount(); |
| 233 | } |
| 234 | |
| 235 | return 0; |
| 236 | } |
| 237 | |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 238 | IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 239 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 240 | return pEnv ? pEnv->FFI_DownloadFromURL(wsURL.c_str()) : nullptr; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 241 | } |
| 242 | |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 243 | FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideString& wsURL, |
| 244 | const CFX_WideString& wsData, |
| 245 | const CFX_WideString& wsContentType, |
| 246 | const CFX_WideString& wsEncode, |
| 247 | const CFX_WideString& wsHeader, |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 248 | CFX_WideString& wsResponse) { |
| 249 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 250 | if (!pEnv) |
| 251 | return FALSE; |
| 252 | |
| 253 | wsResponse = pEnv->FFI_PostRequestURL(wsURL.c_str(), wsData.c_str(), |
| 254 | wsContentType.c_str(), wsEncode.c_str(), |
| 255 | wsHeader.c_str()); |
| 256 | return TRUE; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 257 | } |
| 258 | |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 259 | FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideString& wsURL, |
| 260 | const CFX_WideString& wsData, |
| 261 | const CFX_WideString& wsEncode) { |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 262 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 263 | return pEnv && |
| 264 | pEnv->FFI_PutRequestURL(wsURL.c_str(), wsData.c_str(), |
| 265 | wsEncode.c_str()); |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { |
| 269 | switch (iStringID) { |
| 270 | case XFA_IDS_ValidateFailed: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 271 | wsString = L"%s validation failed"; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 272 | return; |
| 273 | case XFA_IDS_CalcOverride: |
| 274 | wsString = L"Calculate Override"; |
| 275 | return; |
| 276 | case XFA_IDS_ModifyField: |
| 277 | wsString = L"Are you sure you want to modify this field?"; |
| 278 | return; |
| 279 | case XFA_IDS_NotModifyField: |
| 280 | wsString = L"You are not allowed to modify this field."; |
| 281 | return; |
| 282 | case XFA_IDS_AppName: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 283 | wsString = L"pdfium"; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 284 | return; |
| 285 | case XFA_IDS_Unable_TO_SET: |
| 286 | wsString = L"Unable to set "; |
| 287 | return; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 288 | case XFA_IDS_INVAlID_PROP_SET: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 289 | wsString = L"Invalid property set operation."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 290 | return; |
| 291 | case XFA_IDS_NOT_DEFAUL_VALUE: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 292 | wsString = L" doesn't have a default property."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 293 | return; |
| 294 | case XFA_IDS_UNABLE_SET_LANGUAGE: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 295 | wsString = L"Unable to set language value."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 296 | return; |
| 297 | case XFA_IDS_UNABLE_SET_NUMPAGES: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 298 | wsString = L"Unable to set numPages value."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 299 | return; |
| 300 | case XFA_IDS_UNABLE_SET_PLATFORM: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 301 | wsString = L"Unable to set platform value."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 302 | return; |
| 303 | case XFA_IDS_UNABLE_SET_VARIATION: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 304 | wsString = L"Unable to set variation value."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 305 | return; |
| 306 | case XFA_IDS_UNABLE_SET_VERSION: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 307 | wsString = L"Unable to set version value."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 308 | return; |
| 309 | case XFA_IDS_UNABLE_SET_READY: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 310 | wsString = L"Unable to set ready value."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 311 | return; |
| 312 | case XFA_IDS_COMPILER_ERROR: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 313 | wsString = L"Compiler error."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 314 | return; |
| 315 | case XFA_IDS_DIVIDE_ZERO: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 316 | wsString = L"Divide by zero."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 317 | return; |
| 318 | case XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT: |
| 319 | wsString = |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 320 | L"An attempt was made to reference property '%s' of a non-object in " |
| 321 | L"SOM expression %s."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 322 | return; |
| 323 | case XFA_IDS_INDEX_OUT_OF_BOUNDS: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 324 | wsString = L"Index value is out of bounds."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 325 | return; |
| 326 | case XFA_IDS_INCORRECT_NUMBER_OF_METHOD: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 327 | wsString = L"Incorrect number of parameters calling method '%s'."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 328 | return; |
| 329 | case XFA_IDS_ARGUMENT_MISMATCH: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 330 | wsString = L"Argument mismatch in property or function argument."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 331 | return; |
| 332 | case XFA_IDS_NOT_HAVE_PROPERTY: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 333 | wsString = L"'%s' doesn't have property '%s'."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 334 | return; |
| 335 | case XFA_IDS_VIOLATE_BOUNDARY: |
| 336 | wsString = |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 337 | L"The element [%s] has violated its allowable number of occurrences."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 338 | return; |
| 339 | case XFA_IDS_SERVER_DENY: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 340 | wsString = L"Server does not permit."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 341 | return; |
| 342 | case XFA_IDS_ValidateLimit: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 343 | wsString = |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 344 | L"Message limit exceeded. Remaining %d validation errors not " |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 345 | L"reported."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 346 | return; |
| 347 | case XFA_IDS_ValidateNullWarning: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 348 | wsString = |
| 349 | L"%s cannot be blank. To ignore validations for %s, click Ignore."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 350 | return; |
| 351 | case XFA_IDS_ValidateNullError: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 352 | wsString = L"%s cannot be blank."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 353 | return; |
| 354 | case XFA_IDS_ValidateWarning: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 355 | wsString = |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 356 | L"The value you entered for %s is invalid. To ignore validations for " |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 357 | L"%s, click Ignore."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 358 | return; |
| 359 | case XFA_IDS_ValidateError: |
dsinclair | 0e0a86a | 2016-06-01 18:56:51 -0700 | [diff] [blame] | 360 | wsString = L"The value you entered for %s is invalid."; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 361 | return; |
| 362 | } |
| 363 | } |
| 364 | |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 365 | IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { |
thestig | 1cd352e | 2016-06-07 17:53:06 -0700 | [diff] [blame] | 366 | CXFA_FWLAdapterTimerMgr* pAdapter = nullptr; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 367 | CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 368 | if (pEnv) |
| 369 | pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); |
| 370 | return pAdapter; |
| 371 | } |