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