| 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/cpdfxfa_document.h" | 7 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/parser/cpdf_document.h" | 9 #include "core/fpdfapi/parser/cpdf_document.h" |
| 10 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" | 10 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
| 11 #include "fpdfsdk/cpdfsdk_interform.h" | 11 #include "fpdfsdk/cpdfsdk_interform.h" |
| 12 #include "fpdfsdk/cpdfsdk_pageview.h" | 12 #include "fpdfsdk/cpdfsdk_pageview.h" |
| 13 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" | 13 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" |
| 14 #include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h" | 14 #include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h" |
| 15 #include "fpdfsdk/fsdk_define.h" | 15 #include "fpdfsdk/fsdk_define.h" |
| 16 #include "fpdfsdk/javascript/cjs_runtime.h" | 16 #include "fpdfsdk/javascript/cjs_runtime.h" |
| 17 #include "fpdfsdk/javascript/ijs_runtime.h" | 17 #include "fpdfsdk/javascript/ijs_runtime.h" |
| 18 #include "public/fpdf_formfill.h" | 18 #include "public/fpdf_formfill.h" |
| 19 #include "third_party/base/ptr_util.h" | 19 #include "third_party/base/ptr_util.h" |
| 20 #include "xfa/fxfa/cxfa_eventparam.h" | 20 #include "xfa/fxfa/cxfa_eventparam.h" |
| 21 #include "xfa/fxfa/xfa_ffapp.h" | 21 #include "xfa/fxfa/xfa_ffapp.h" |
| 22 #include "xfa/fxfa/xfa_ffdoc.h" | 22 #include "xfa/fxfa/xfa_ffdoc.h" |
| 23 #include "xfa/fxfa/xfa_ffdocview.h" | 23 #include "xfa/fxfa/xfa_ffdocview.h" |
| 24 #include "xfa/fxfa/xfa_ffpageview.h" | 24 #include "xfa/fxfa/xfa_ffpageview.h" |
| 25 #include "xfa/fxfa/xfa_ffwidgethandler.h" | 25 #include "xfa/fxfa/xfa_ffwidgethandler.h" |
| 26 #include "xfa/fxfa/xfa_fontmgr.h" | 26 #include "xfa/fxfa/xfa_fontmgr.h" |
| 27 | 27 |
| 28 #ifndef _WIN32 | 28 #ifndef _WIN32 |
| 29 extern void SetLastError(int err); | 29 extern void SetLastError(int err); |
| 30 extern int GetLastError(); | 30 extern int GetLastError(); |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 CPDFXFA_Document::CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc) | 33 CPDFXFA_Context::CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc) |
| 34 : m_iDocType(DOCTYPE_PDF), | 34 : m_iDocType(DOCTYPE_PDF), |
| 35 m_pPDFDoc(std::move(pPDFDoc)), | 35 m_pPDFDoc(std::move(pPDFDoc)), |
| 36 m_pFormFillEnv(nullptr), | 36 m_pFormFillEnv(nullptr), |
| 37 m_pXFADocView(nullptr), | 37 m_pXFADocView(nullptr), |
| 38 m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD), | 38 m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD), |
| 39 m_nPageCount(0), | 39 m_nPageCount(0), |
| 40 m_DocEnv(this) { | 40 m_DocEnv(this) { |
| 41 m_pXFAApp = pdfium::MakeUnique<CXFA_FFApp>(this); | 41 m_pXFAApp = pdfium::MakeUnique<CXFA_FFApp>(this); |
| 42 m_pXFAApp->SetDefaultFontMgr(pdfium::MakeUnique<CXFA_DefFontMgr>()); | 42 m_pXFAApp->SetDefaultFontMgr(pdfium::MakeUnique<CXFA_DefFontMgr>()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 CPDFXFA_Document::~CPDFXFA_Document() { | 45 CPDFXFA_Context::~CPDFXFA_Context() { |
| 46 m_nLoadStatus = FXFA_LOADSTATUS_CLOSING; | 46 m_nLoadStatus = FXFA_LOADSTATUS_CLOSING; |
| 47 | 47 |
| 48 // Must happen before we remove the form fill environment. | 48 // Must happen before we remove the form fill environment. |
| 49 CloseXFADoc(); | 49 CloseXFADoc(); |
| 50 | 50 |
| 51 if (m_pFormFillEnv) { | 51 if (m_pFormFillEnv) { |
| 52 m_pFormFillEnv->ClearAllFocusedAnnots(); | 52 m_pFormFillEnv->ClearAllFocusedAnnots(); |
| 53 // Once we're deleted the FormFillEnvironment will point at a bad underlying | 53 // Once we're deleted the FormFillEnvironment will point at a bad underlying |
| 54 // doc so we need to reset it ... | 54 // doc so we need to reset it ... |
| 55 m_pFormFillEnv->ResetXFADocument(); | 55 m_pFormFillEnv->ResetXFADocument(); |
| 56 m_pFormFillEnv = nullptr; | 56 m_pFormFillEnv = nullptr; |
| 57 } | 57 } |
| 58 | 58 |
| 59 m_nLoadStatus = FXFA_LOADSTATUS_CLOSED; | 59 m_nLoadStatus = FXFA_LOADSTATUS_CLOSED; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void CPDFXFA_Document::CloseXFADoc() { | 62 void CPDFXFA_Context::CloseXFADoc() { |
| 63 if (!m_pXFADoc) | 63 if (!m_pXFADoc) |
| 64 return; | 64 return; |
| 65 m_pXFADoc->CloseDoc(); | 65 m_pXFADoc->CloseDoc(); |
| 66 m_pXFADoc.reset(); | 66 m_pXFADoc.reset(); |
| 67 m_pXFADocView = nullptr; | 67 m_pXFADocView = nullptr; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void CPDFXFA_Document::SetFormFillEnv( | 70 void CPDFXFA_Context::SetFormFillEnv( |
| 71 CPDFSDK_FormFillEnvironment* pFormFillEnv) { | 71 CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
| 72 // The layout data can have pointers back into the script context. That | 72 // The layout data can have pointers back into the script context. That |
| 73 // context will be different if the form fill environment closes, so, force | 73 // context will be different if the form fill environment closes, so, force |
| 74 // the layout data to clear. | 74 // the layout data to clear. |
| 75 if (m_pXFADoc && m_pXFADoc->GetXFADoc()) | 75 if (m_pXFADoc && m_pXFADoc->GetXFADoc()) |
| 76 m_pXFADoc->GetXFADoc()->ClearLayoutData(); | 76 m_pXFADoc->GetXFADoc()->ClearLayoutData(); |
| 77 | 77 |
| 78 m_pFormFillEnv = pFormFillEnv; | 78 m_pFormFillEnv = pFormFillEnv; |
| 79 } | 79 } |
| 80 | 80 |
| 81 FX_BOOL CPDFXFA_Document::LoadXFADoc() { | 81 FX_BOOL CPDFXFA_Context::LoadXFADoc() { |
| 82 m_nLoadStatus = FXFA_LOADSTATUS_LOADING; | 82 m_nLoadStatus = FXFA_LOADSTATUS_LOADING; |
| 83 | 83 |
| 84 if (!m_pPDFDoc) | 84 if (!m_pPDFDoc) |
| 85 return FALSE; | 85 return FALSE; |
| 86 | 86 |
| 87 m_XFAPageList.RemoveAll(); | 87 m_XFAPageList.RemoveAll(); |
| 88 | 88 |
| 89 CXFA_FFApp* pApp = GetXFAApp(); | 89 CXFA_FFApp* pApp = GetXFAApp(); |
| 90 if (!pApp) | 90 if (!pApp) |
| 91 return FALSE; | 91 return FALSE; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return FALSE; | 124 return FALSE; |
| 125 } | 125 } |
| 126 | 126 |
| 127 m_pXFADocView->DoLayout(nullptr); | 127 m_pXFADocView->DoLayout(nullptr); |
| 128 m_pXFADocView->StopLayout(); | 128 m_pXFADocView->StopLayout(); |
| 129 m_nLoadStatus = FXFA_LOADSTATUS_LOADED; | 129 m_nLoadStatus = FXFA_LOADSTATUS_LOADED; |
| 130 | 130 |
| 131 return TRUE; | 131 return TRUE; |
| 132 } | 132 } |
| 133 | 133 |
| 134 int CPDFXFA_Document::GetPageCount() const { | 134 int CPDFXFA_Context::GetPageCount() const { |
| 135 if (!m_pPDFDoc && !m_pXFADoc) | 135 if (!m_pPDFDoc && !m_pXFADoc) |
| 136 return 0; | 136 return 0; |
| 137 | 137 |
| 138 switch (m_iDocType) { | 138 switch (m_iDocType) { |
| 139 case DOCTYPE_PDF: | 139 case DOCTYPE_PDF: |
| 140 case DOCTYPE_STATIC_XFA: | 140 case DOCTYPE_STATIC_XFA: |
| 141 if (m_pPDFDoc) | 141 if (m_pPDFDoc) |
| 142 return m_pPDFDoc->GetPageCount(); | 142 return m_pPDFDoc->GetPageCount(); |
| 143 case DOCTYPE_DYNAMIC_XFA: | 143 case DOCTYPE_DYNAMIC_XFA: |
| 144 if (m_pXFADoc) | 144 if (m_pXFADoc) |
| 145 return m_pXFADocView->CountPageViews(); | 145 return m_pXFADocView->CountPageViews(); |
| 146 default: | 146 default: |
| 147 return 0; | 147 return 0; |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 CPDFXFA_Page* CPDFXFA_Document::GetXFAPage(int page_index) { | 151 CPDFXFA_Page* CPDFXFA_Context::GetXFAPage(int page_index) { |
| 152 if (page_index < 0) | 152 if (page_index < 0) |
| 153 return nullptr; | 153 return nullptr; |
| 154 | 154 |
| 155 CPDFXFA_Page* pPage = nullptr; | 155 CPDFXFA_Page* pPage = nullptr; |
| 156 int nCount = m_XFAPageList.GetSize(); | 156 int nCount = m_XFAPageList.GetSize(); |
| 157 if (nCount > 0 && page_index < nCount) { | 157 if (nCount > 0 && page_index < nCount) { |
| 158 pPage = m_XFAPageList.GetAt(page_index); | 158 pPage = m_XFAPageList.GetAt(page_index); |
| 159 if (pPage) | 159 if (pPage) |
| 160 pPage->Retain(); | 160 pPage->Retain(); |
| 161 } else { | 161 } else { |
| 162 m_nPageCount = GetPageCount(); | 162 m_nPageCount = GetPageCount(); |
| 163 m_XFAPageList.SetSize(m_nPageCount); | 163 m_XFAPageList.SetSize(m_nPageCount); |
| 164 } | 164 } |
| 165 if (pPage) | 165 if (pPage) |
| 166 return pPage; | 166 return pPage; |
| 167 | 167 |
| 168 pPage = new CPDFXFA_Page(this, page_index); | 168 pPage = new CPDFXFA_Page(this, page_index); |
| 169 if (!pPage->LoadPage()) { | 169 if (!pPage->LoadPage()) { |
| 170 pPage->Release(); | 170 pPage->Release(); |
| 171 return nullptr; | 171 return nullptr; |
| 172 } | 172 } |
| 173 m_XFAPageList.SetAt(page_index, pPage); | 173 m_XFAPageList.SetAt(page_index, pPage); |
| 174 return pPage; | 174 return pPage; |
| 175 } | 175 } |
| 176 | 176 |
| 177 CPDFXFA_Page* CPDFXFA_Document::GetXFAPage(CXFA_FFPageView* pPage) const { | 177 CPDFXFA_Page* CPDFXFA_Context::GetXFAPage(CXFA_FFPageView* pPage) const { |
| 178 if (!pPage) | 178 if (!pPage) |
| 179 return nullptr; | 179 return nullptr; |
| 180 | 180 |
| 181 if (!m_pXFADoc) | 181 if (!m_pXFADoc) |
| 182 return nullptr; | 182 return nullptr; |
| 183 | 183 |
| 184 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) | 184 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) |
| 185 return nullptr; | 185 return nullptr; |
| 186 | 186 |
| 187 int nSize = m_XFAPageList.GetSize(); | 187 int nSize = m_XFAPageList.GetSize(); |
| 188 for (int i = 0; i < nSize; i++) { | 188 for (int i = 0; i < nSize; i++) { |
| 189 CPDFXFA_Page* pTempPage = m_XFAPageList.GetAt(i); | 189 CPDFXFA_Page* pTempPage = m_XFAPageList.GetAt(i); |
| 190 if (!pTempPage) | 190 if (!pTempPage) |
| 191 continue; | 191 continue; |
| 192 if (pTempPage->GetXFAPageView() && pTempPage->GetXFAPageView() == pPage) | 192 if (pTempPage->GetXFAPageView() && pTempPage->GetXFAPageView() == pPage) |
| 193 return pTempPage; | 193 return pTempPage; |
| 194 } | 194 } |
| 195 | 195 |
| 196 return nullptr; | 196 return nullptr; |
| 197 } | 197 } |
| 198 | 198 |
| 199 void CPDFXFA_Document::DeletePage(int page_index) { | 199 void CPDFXFA_Context::DeletePage(int page_index) { |
| 200 // Delete from the document first because, if GetPage was never called for | 200 // Delete from the document first because, if GetPage was never called for |
| 201 // this |page_index| then |m_XFAPageList| may have size < |page_index| even | 201 // this |page_index| then |m_XFAPageList| may have size < |page_index| even |
| 202 // if it's a valid page in the document. | 202 // if it's a valid page in the document. |
| 203 if (m_pPDFDoc) | 203 if (m_pPDFDoc) |
| 204 m_pPDFDoc->DeletePage(page_index); | 204 m_pPDFDoc->DeletePage(page_index); |
| 205 | 205 |
| 206 if (page_index < 0 || page_index >= m_XFAPageList.GetSize()) | 206 if (page_index < 0 || page_index >= m_XFAPageList.GetSize()) |
| 207 return; | 207 return; |
| 208 | 208 |
| 209 if (CPDFXFA_Page* pPage = m_XFAPageList.GetAt(page_index)) | 209 if (CPDFXFA_Page* pPage = m_XFAPageList.GetAt(page_index)) |
| 210 pPage->Release(); | 210 pPage->Release(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { | 213 void CPDFXFA_Context::RemovePage(CPDFXFA_Page* page) { |
| 214 m_XFAPageList.SetAt(page->GetPageIndex(), nullptr); | 214 m_XFAPageList.SetAt(page->GetPageIndex(), nullptr); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void CPDFXFA_Document::ClearChangeMark() { | 217 void CPDFXFA_Context::ClearChangeMark() { |
| 218 if (m_pFormFillEnv) | 218 if (m_pFormFillEnv) |
| 219 m_pFormFillEnv->ClearChangeMark(); | 219 m_pFormFillEnv->ClearChangeMark(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 v8::Isolate* CPDFXFA_Document::GetJSERuntime() const { | 222 v8::Isolate* CPDFXFA_Context::GetJSERuntime() const { |
| 223 if (!m_pFormFillEnv) | 223 if (!m_pFormFillEnv) |
| 224 return nullptr; | 224 return nullptr; |
| 225 | 225 |
| 226 // XFA requires V8, if we have V8 then we have a CJS_Runtime and not the stub. | 226 // XFA requires V8, if we have V8 then we have a CJS_Runtime and not the stub. |
| 227 CJS_Runtime* runtime = | 227 CJS_Runtime* runtime = |
| 228 static_cast<CJS_Runtime*>(m_pFormFillEnv->GetJSRuntime()); | 228 static_cast<CJS_Runtime*>(m_pFormFillEnv->GetJSRuntime()); |
| 229 return runtime->GetIsolate(); | 229 return runtime->GetIsolate(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void CPDFXFA_Document::GetAppName(CFX_WideString& wsName) { | 232 void CPDFXFA_Context::GetAppName(CFX_WideString& wsName) { |
| 233 if (m_pFormFillEnv) | 233 if (m_pFormFillEnv) |
| 234 wsName = m_pFormFillEnv->FFI_GetAppName(); | 234 wsName = m_pFormFillEnv->FFI_GetAppName(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void CPDFXFA_Document::GetLanguage(CFX_WideString& wsLanguage) { | 237 void CPDFXFA_Context::GetLanguage(CFX_WideString& wsLanguage) { |
| 238 if (m_pFormFillEnv) | 238 if (m_pFormFillEnv) |
| 239 wsLanguage = m_pFormFillEnv->GetLanguage(); | 239 wsLanguage = m_pFormFillEnv->GetLanguage(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void CPDFXFA_Document::GetPlatform(CFX_WideString& wsPlatform) { | 242 void CPDFXFA_Context::GetPlatform(CFX_WideString& wsPlatform) { |
| 243 if (m_pFormFillEnv) | 243 if (m_pFormFillEnv) |
| 244 wsPlatform = m_pFormFillEnv->GetPlatform(); | 244 wsPlatform = m_pFormFillEnv->GetPlatform(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void CPDFXFA_Document::Beep(uint32_t dwType) { | 247 void CPDFXFA_Context::Beep(uint32_t dwType) { |
| 248 if (m_pFormFillEnv) | 248 if (m_pFormFillEnv) |
| 249 m_pFormFillEnv->JS_appBeep(dwType); | 249 m_pFormFillEnv->JS_appBeep(dwType); |
| 250 } | 250 } |
| 251 | 251 |
| 252 int32_t CPDFXFA_Document::MsgBox(const CFX_WideString& wsMessage, | 252 int32_t CPDFXFA_Context::MsgBox(const CFX_WideString& wsMessage, |
| 253 const CFX_WideString& wsTitle, | 253 const CFX_WideString& wsTitle, |
| 254 uint32_t dwIconType, | 254 uint32_t dwIconType, |
| 255 uint32_t dwButtonType) { | 255 uint32_t dwButtonType) { |
| 256 if (!m_pFormFillEnv) | 256 if (!m_pFormFillEnv) |
| 257 return -1; | 257 return -1; |
| 258 | 258 |
| 259 uint32_t iconType = 0; | 259 uint32_t iconType = 0; |
| 260 int iButtonType = 0; | 260 int iButtonType = 0; |
| 261 switch (dwIconType) { | 261 switch (dwIconType) { |
| 262 case XFA_MBICON_Error: | 262 case XFA_MBICON_Error: |
| 263 iconType |= 0; | 263 iconType |= 0; |
| 264 break; | 264 break; |
| 265 case XFA_MBICON_Warning: | 265 case XFA_MBICON_Warning: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 294 case 2: | 294 case 2: |
| 295 return XFA_IDCancel; | 295 return XFA_IDCancel; |
| 296 case 3: | 296 case 3: |
| 297 return XFA_IDNo; | 297 return XFA_IDNo; |
| 298 case 4: | 298 case 4: |
| 299 return XFA_IDYes; | 299 return XFA_IDYes; |
| 300 } | 300 } |
| 301 return XFA_IDYes; | 301 return XFA_IDYes; |
| 302 } | 302 } |
| 303 | 303 |
| 304 CFX_WideString CPDFXFA_Document::Response(const CFX_WideString& wsQuestion, | 304 CFX_WideString CPDFXFA_Context::Response(const CFX_WideString& wsQuestion, |
| 305 const CFX_WideString& wsTitle, | 305 const CFX_WideString& wsTitle, |
| 306 const CFX_WideString& wsDefaultAnswer, | 306 const CFX_WideString& wsDefaultAnswer, |
| 307 FX_BOOL bMark) { | 307 FX_BOOL bMark) { |
| 308 CFX_WideString wsAnswer; | 308 CFX_WideString wsAnswer; |
| 309 if (!m_pFormFillEnv) | 309 if (!m_pFormFillEnv) |
| 310 return wsAnswer; | 310 return wsAnswer; |
| 311 | 311 |
| 312 int nLength = 2048; | 312 int nLength = 2048; |
| 313 char* pBuff = new char[nLength]; | 313 char* pBuff = new char[nLength]; |
| 314 nLength = m_pFormFillEnv->JS_appResponse(wsQuestion.c_str(), wsTitle.c_str(), | 314 nLength = m_pFormFillEnv->JS_appResponse(wsQuestion.c_str(), wsTitle.c_str(), |
| 315 wsDefaultAnswer.c_str(), nullptr, | 315 wsDefaultAnswer.c_str(), nullptr, |
| 316 bMark, pBuff, nLength); | 316 bMark, pBuff, nLength); |
| 317 if (nLength > 0) { | 317 if (nLength > 0) { |
| 318 nLength = nLength > 2046 ? 2046 : nLength; | 318 nLength = nLength > 2046 ? 2046 : nLength; |
| 319 pBuff[nLength] = 0; | 319 pBuff[nLength] = 0; |
| 320 pBuff[nLength + 1] = 0; | 320 pBuff[nLength + 1] = 0; |
| 321 wsAnswer = CFX_WideString::FromUTF16LE( | 321 wsAnswer = CFX_WideString::FromUTF16LE( |
| 322 reinterpret_cast<const unsigned short*>(pBuff), | 322 reinterpret_cast<const unsigned short*>(pBuff), |
| 323 nLength / sizeof(unsigned short)); | 323 nLength / sizeof(unsigned short)); |
| 324 } | 324 } |
| 325 delete[] pBuff; | 325 delete[] pBuff; |
| 326 return wsAnswer; | 326 return wsAnswer; |
| 327 } | 327 } |
| 328 | 328 |
| 329 IFX_SeekableReadStream* CPDFXFA_Document::DownloadURL( | 329 IFX_SeekableReadStream* CPDFXFA_Context::DownloadURL( |
| 330 const CFX_WideString& wsURL) { | 330 const CFX_WideString& wsURL) { |
| 331 return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL.c_str()) | 331 return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL.c_str()) |
| 332 : nullptr; | 332 : nullptr; |
| 333 } | 333 } |
| 334 | 334 |
| 335 FX_BOOL CPDFXFA_Document::PostRequestURL(const CFX_WideString& wsURL, | 335 FX_BOOL CPDFXFA_Context::PostRequestURL(const CFX_WideString& wsURL, |
| 336 const CFX_WideString& wsData, | 336 const CFX_WideString& wsData, |
| 337 const CFX_WideString& wsContentType, | 337 const CFX_WideString& wsContentType, |
| 338 const CFX_WideString& wsEncode, | 338 const CFX_WideString& wsEncode, |
| 339 const CFX_WideString& wsHeader, | 339 const CFX_WideString& wsHeader, |
| 340 CFX_WideString& wsResponse) { | 340 CFX_WideString& wsResponse) { |
| 341 if (!m_pFormFillEnv) | 341 if (!m_pFormFillEnv) |
| 342 return FALSE; | 342 return FALSE; |
| 343 | 343 |
| 344 wsResponse = m_pFormFillEnv->PostRequestURL( | 344 wsResponse = m_pFormFillEnv->PostRequestURL( |
| 345 wsURL.c_str(), wsData.c_str(), wsContentType.c_str(), wsEncode.c_str(), | 345 wsURL.c_str(), wsData.c_str(), wsContentType.c_str(), wsEncode.c_str(), |
| 346 wsHeader.c_str()); | 346 wsHeader.c_str()); |
| 347 return TRUE; | 347 return TRUE; |
| 348 } | 348 } |
| 349 | 349 |
| 350 FX_BOOL CPDFXFA_Document::PutRequestURL(const CFX_WideString& wsURL, | 350 FX_BOOL CPDFXFA_Context::PutRequestURL(const CFX_WideString& wsURL, |
| 351 const CFX_WideString& wsData, | 351 const CFX_WideString& wsData, |
| 352 const CFX_WideString& wsEncode) { | 352 const CFX_WideString& wsEncode) { |
| 353 return m_pFormFillEnv && | 353 return m_pFormFillEnv && |
| 354 m_pFormFillEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(), | 354 m_pFormFillEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(), |
| 355 wsEncode.c_str()); | 355 wsEncode.c_str()); |
| 356 } | 356 } |
| 357 | 357 |
| 358 void CPDFXFA_Document::LoadString(int32_t iStringID, CFX_WideString& wsString) { | 358 void CPDFXFA_Context::LoadString(int32_t iStringID, CFX_WideString& wsString) { |
| 359 switch (iStringID) { | 359 switch (iStringID) { |
| 360 case XFA_IDS_ValidateFailed: | 360 case XFA_IDS_ValidateFailed: |
| 361 wsString = L"%s validation failed"; | 361 wsString = L"%s validation failed"; |
| 362 return; | 362 return; |
| 363 case XFA_IDS_CalcOverride: | 363 case XFA_IDS_CalcOverride: |
| 364 wsString = L"Calculate Override"; | 364 wsString = L"Calculate Override"; |
| 365 return; | 365 return; |
| 366 case XFA_IDS_ModifyField: | 366 case XFA_IDS_ModifyField: |
| 367 wsString = L"Are you sure you want to modify this field?"; | 367 wsString = L"Are you sure you want to modify this field?"; |
| 368 return; | 368 return; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 wsString = | 445 wsString = |
| 446 L"The value you entered for %s is invalid. To ignore validations for " | 446 L"The value you entered for %s is invalid. To ignore validations for " |
| 447 L"%s, click Ignore."; | 447 L"%s, click Ignore."; |
| 448 return; | 448 return; |
| 449 case XFA_IDS_ValidateError: | 449 case XFA_IDS_ValidateError: |
| 450 wsString = L"The value you entered for %s is invalid."; | 450 wsString = L"The value you entered for %s is invalid."; |
| 451 return; | 451 return; |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| 455 IFWL_AdapterTimerMgr* CPDFXFA_Document::GetTimerMgr() { | 455 IFWL_AdapterTimerMgr* CPDFXFA_Context::GetTimerMgr() { |
| 456 CXFA_FWLAdapterTimerMgr* pAdapter = nullptr; | 456 CXFA_FWLAdapterTimerMgr* pAdapter = nullptr; |
| 457 if (m_pFormFillEnv) | 457 if (m_pFormFillEnv) |
| 458 pAdapter = new CXFA_FWLAdapterTimerMgr(m_pFormFillEnv); | 458 pAdapter = new CXFA_FWLAdapterTimerMgr(m_pFormFillEnv); |
| 459 return pAdapter; | 459 return pAdapter; |
| 460 } | 460 } |
| OLD | NEW |