| 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_doc.h" | 7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" | 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" |
| 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" | 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" |
| 13 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" | 13 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" |
| 14 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" | 14 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" |
| 15 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" | 15 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" |
| 16 #include "fpdfsdk/include/cpdfdoc_environment.h" | |
| 17 #include "fpdfsdk/include/cpdfsdk_document.h" | 16 #include "fpdfsdk/include/cpdfsdk_document.h" |
| 17 #include "fpdfsdk/include/cpdfsdk_environment.h" |
| 18 #include "fpdfsdk/include/cpdfsdk_interform.h" | 18 #include "fpdfsdk/include/cpdfsdk_interform.h" |
| 19 #include "fpdfsdk/include/cpdfsdk_pageview.h" | 19 #include "fpdfsdk/include/cpdfsdk_pageview.h" |
| 20 #include "fpdfsdk/include/fsdk_define.h" | 20 #include "fpdfsdk/include/fsdk_define.h" |
| 21 #include "fpdfsdk/javascript/ijs_runtime.h" | 21 #include "fpdfsdk/javascript/ijs_runtime.h" |
| 22 #include "public/fpdf_formfill.h" | 22 #include "public/fpdf_formfill.h" |
| 23 #include "xfa/fxfa/include/cxfa_eventparam.h" | 23 #include "xfa/fxfa/include/cxfa_eventparam.h" |
| 24 #include "xfa/fxfa/include/xfa_ffapp.h" | 24 #include "xfa/fxfa/include/xfa_ffapp.h" |
| 25 #include "xfa/fxfa/include/xfa_ffdoc.h" | 25 #include "xfa/fxfa/include/xfa_ffdoc.h" |
| 26 #include "xfa/fxfa/include/xfa_ffdocview.h" | 26 #include "xfa/fxfa/include/xfa_ffdocview.h" |
| 27 #include "xfa/fxfa/include/xfa_ffpageview.h" | 27 #include "xfa/fxfa/include/xfa_ffpageview.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 if (CPDFXFA_Page* pPage = m_XFAPageList.GetAt(page_index)) | 207 if (CPDFXFA_Page* pPage = m_XFAPageList.GetAt(page_index)) |
| 208 pPage->Release(); | 208 pPage->Release(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { | 211 void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { |
| 212 m_XFAPageList.SetAt(page->GetPageIndex(), nullptr); | 212 m_XFAPageList.SetAt(page->GetPageIndex(), nullptr); |
| 213 } | 213 } |
| 214 | 214 |
| 215 CPDFSDK_Document* CPDFXFA_Document::GetSDKDocument( | 215 CPDFSDK_Document* CPDFXFA_Document::GetSDKDocument( |
| 216 CPDFDoc_Environment* pFormFillEnv) { | 216 CPDFSDK_Environment* pFormFillEnv) { |
| 217 if (!m_pSDKDoc && pFormFillEnv) | 217 if (!m_pSDKDoc && pFormFillEnv) |
| 218 m_pSDKDoc.reset(new CPDFSDK_Document(this, pFormFillEnv)); | 218 m_pSDKDoc.reset(new CPDFSDK_Document(this, pFormFillEnv)); |
| 219 return m_pSDKDoc.get(); | 219 return m_pSDKDoc.get(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void CPDFXFA_Document::FXRect2PDFRect(const CFX_RectF& fxRectF, | 222 void CPDFXFA_Document::FXRect2PDFRect(const CFX_RectF& fxRectF, |
| 223 CFX_FloatRect& pdfRect) { | 223 CFX_FloatRect& pdfRect) { |
| 224 pdfRect.left = fxRectF.left; | 224 pdfRect.left = fxRectF.left; |
| 225 pdfRect.top = fxRectF.bottom(); | 225 pdfRect.top = fxRectF.bottom(); |
| 226 pdfRect.right = fxRectF.right(); | 226 pdfRect.right = fxRectF.right(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 242 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) | 242 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) |
| 243 return; | 243 return; |
| 244 | 244 |
| 245 CFX_FloatRect rcPage; | 245 CFX_FloatRect rcPage; |
| 246 FXRect2PDFRect(rt, rcPage); | 246 FXRect2PDFRect(rt, rcPage); |
| 247 | 247 |
| 248 CPDFXFA_Page* pPage = GetPage(pPageView); | 248 CPDFXFA_Page* pPage = GetPage(pPageView); |
| 249 if (!pPage) | 249 if (!pPage) |
| 250 return; | 250 return; |
| 251 | 251 |
| 252 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 252 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 253 if (!pEnv) | 253 if (!pEnv) |
| 254 return; | 254 return; |
| 255 | 255 |
| 256 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, | 256 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, |
| 257 rcPage.right, rcPage.top); | 257 rcPage.right, rcPage.top); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget, | 260 void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget, |
| 261 FX_BOOL bVisible, | 261 FX_BOOL bVisible, |
| 262 const CFX_RectF* pRtAnchor) { | 262 const CFX_RectF* pRtAnchor) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 274 if (!pPageView) | 274 if (!pPageView) |
| 275 return; | 275 return; |
| 276 | 276 |
| 277 CPDFXFA_Page* pPage = GetPage(pPageView); | 277 CPDFXFA_Page* pPage = GetPage(pPageView); |
| 278 if (!pPage) | 278 if (!pPage) |
| 279 return; | 279 return; |
| 280 | 280 |
| 281 CFX_FloatRect rcCaret; | 281 CFX_FloatRect rcCaret; |
| 282 FXRect2PDFRect(*pRtAnchor, rcCaret); | 282 FXRect2PDFRect(*pRtAnchor, rcCaret); |
| 283 | 283 |
| 284 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 284 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 285 if (!pEnv) | 285 if (!pEnv) |
| 286 return; | 286 return; |
| 287 | 287 |
| 288 pEnv->FFI_DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top, | 288 pEnv->FFI_DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top, |
| 289 rcCaret.right, rcCaret.bottom); | 289 rcCaret.right, rcCaret.bottom); |
| 290 } | 290 } |
| 291 | 291 |
| 292 FX_BOOL CPDFXFA_Document::GetPopupPos(CXFA_FFWidget* hWidget, | 292 FX_BOOL CPDFXFA_Document::GetPopupPos(CXFA_FFWidget* hWidget, |
| 293 FX_FLOAT fMinPopup, | 293 FX_FLOAT fMinPopup, |
| 294 FX_FLOAT fMaxPopup, | 294 FX_FLOAT fMaxPopup, |
| 295 const CFX_RectF& rtAnchor, | 295 const CFX_RectF& rtAnchor, |
| 296 CFX_RectF& rtPopup) { | 296 CFX_RectF& rtPopup) { |
| 297 if (!hWidget) | 297 if (!hWidget) |
| 298 return FALSE; | 298 return FALSE; |
| 299 | 299 |
| 300 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); | 300 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); |
| 301 if (!pXFAPageView) | 301 if (!pXFAPageView) |
| 302 return FALSE; | 302 return FALSE; |
| 303 | 303 |
| 304 CPDFXFA_Page* pPage = GetPage(pXFAPageView); | 304 CPDFXFA_Page* pPage = GetPage(pXFAPageView); |
| 305 if (!pPage) | 305 if (!pPage) |
| 306 return FALSE; | 306 return FALSE; |
| 307 | 307 |
| 308 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); | 308 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); |
| 309 int nRotate = pWidgetAcc->GetRotate(); | 309 int nRotate = pWidgetAcc->GetRotate(); |
| 310 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 310 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 311 if (!pEnv) | 311 if (!pEnv) |
| 312 return FALSE; | 312 return FALSE; |
| 313 FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f}; | 313 FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 314 pEnv->FFI_GetPageViewRect(pPage, pageViewRect); | 314 pEnv->FFI_GetPageViewRect(pPage, pageViewRect); |
| 315 | 315 |
| 316 CFX_FloatRect rcAnchor; | 316 CFX_FloatRect rcAnchor; |
| 317 rcAnchor.left = rtAnchor.left; | 317 rcAnchor.left = rtAnchor.left; |
| 318 rcAnchor.top = rtAnchor.bottom(); | 318 rcAnchor.top = rtAnchor.bottom(); |
| 319 rcAnchor.right = rtAnchor.right(); | 319 rcAnchor.right = rtAnchor.right(); |
| 320 rcAnchor.bottom = rtAnchor.top; | 320 rcAnchor.bottom = rtAnchor.top; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 menuFlag |= FXFA_MEMU_REDO; | 437 menuFlag |= FXFA_MEMU_REDO; |
| 438 if (hWidget->CanPaste()) | 438 if (hWidget->CanPaste()) |
| 439 menuFlag |= FXFA_MEMU_PASTE; | 439 menuFlag |= FXFA_MEMU_PASTE; |
| 440 if (hWidget->CanCopy()) | 440 if (hWidget->CanCopy()) |
| 441 menuFlag |= FXFA_MEMU_COPY; | 441 menuFlag |= FXFA_MEMU_COPY; |
| 442 if (hWidget->CanCut()) | 442 if (hWidget->CanCut()) |
| 443 menuFlag |= FXFA_MEMU_CUT; | 443 menuFlag |= FXFA_MEMU_CUT; |
| 444 if (hWidget->CanSelectAll()) | 444 if (hWidget->CanSelectAll()) |
| 445 menuFlag |= FXFA_MEMU_SELECTALL; | 445 menuFlag |= FXFA_MEMU_SELECTALL; |
| 446 | 446 |
| 447 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 447 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 448 return pEnv && | 448 return pEnv && |
| 449 pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, nullptr); | 449 pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, nullptr); |
| 450 } | 450 } |
| 451 | 451 |
| 452 void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView, | 452 void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView, |
| 453 uint32_t dwFlags) { | 453 uint32_t dwFlags) { |
| 454 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 454 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 455 if (!pEnv) | 455 if (!pEnv) |
| 456 return; | 456 return; |
| 457 | 457 |
| 458 if (m_nLoadStatus != FXFA_LOADSTATUS_LOADING && | 458 if (m_nLoadStatus != FXFA_LOADSTATUS_LOADING && |
| 459 m_nLoadStatus != FXFA_LOADSTATUS_CLOSING && | 459 m_nLoadStatus != FXFA_LOADSTATUS_CLOSING && |
| 460 XFA_PAGEVIEWEVENT_StopLayout == dwFlags) { | 460 XFA_PAGEVIEWEVENT_StopLayout == dwFlags) { |
| 461 int nNewCount = GetPageCount(); | 461 int nNewCount = GetPageCount(); |
| 462 if (nNewCount == m_nPageCount) | 462 if (nNewCount == m_nPageCount) |
| 463 return; | 463 return; |
| 464 | 464 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 return GetPageCount(); | 529 return GetPageCount(); |
| 530 return 0; | 530 return 0; |
| 531 } | 531 } |
| 532 | 532 |
| 533 int32_t CPDFXFA_Document::GetCurrentPage(CXFA_FFDoc* hDoc) { | 533 int32_t CPDFXFA_Document::GetCurrentPage(CXFA_FFDoc* hDoc) { |
| 534 if (hDoc != m_pXFADoc.get() || !m_pSDKDoc) | 534 if (hDoc != m_pXFADoc.get() || !m_pSDKDoc) |
| 535 return -1; | 535 return -1; |
| 536 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) | 536 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) |
| 537 return -1; | 537 return -1; |
| 538 | 538 |
| 539 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 539 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 540 if (!pEnv) | 540 if (!pEnv) |
| 541 return -1; | 541 return -1; |
| 542 | 542 |
| 543 return pEnv->FFI_GetCurrentPageIndex(this); | 543 return pEnv->FFI_GetCurrentPageIndex(this); |
| 544 } | 544 } |
| 545 | 545 |
| 546 void CPDFXFA_Document::SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) { | 546 void CPDFXFA_Document::SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) { |
| 547 if (hDoc != m_pXFADoc.get() || !m_pSDKDoc || | 547 if (hDoc != m_pXFADoc.get() || !m_pSDKDoc || |
| 548 m_iDocType != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 || | 548 m_iDocType != DOCTYPE_DYNAMIC_XFA || iCurPage < 0 || |
| 549 iCurPage >= m_pSDKDoc->GetPageCount()) { | 549 iCurPage >= m_pSDKDoc->GetPageCount()) { |
| 550 return; | 550 return; |
| 551 } | 551 } |
| 552 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 552 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 553 if (!pEnv) | 553 if (!pEnv) |
| 554 return; | 554 return; |
| 555 pEnv->FFI_SetCurrentPage(this, iCurPage); | 555 pEnv->FFI_SetCurrentPage(this, iCurPage); |
| 556 } | 556 } |
| 557 FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { | 557 FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { |
| 558 if (hDoc != m_pXFADoc.get() || !m_pSDKDoc) | 558 if (hDoc != m_pXFADoc.get() || !m_pSDKDoc) |
| 559 return FALSE; | 559 return FALSE; |
| 560 if (m_pSDKDoc->GetInterForm()) | 560 if (m_pSDKDoc->GetInterForm()) |
| 561 return m_pSDKDoc->GetInterForm()->IsXfaCalculateEnabled(); | 561 return m_pSDKDoc->GetInterForm()->IsXfaCalculateEnabled(); |
| 562 | 562 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 594 |
| 595 void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, | 595 void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, |
| 596 const CFX_WideString& wsFilePath, | 596 const CFX_WideString& wsFilePath, |
| 597 FX_BOOL bXDP) { | 597 FX_BOOL bXDP) { |
| 598 if (hDoc != m_pXFADoc.get()) | 598 if (hDoc != m_pXFADoc.get()) |
| 599 return; | 599 return; |
| 600 | 600 |
| 601 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) | 601 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) |
| 602 return; | 602 return; |
| 603 | 603 |
| 604 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 604 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 605 if (!pEnv) | 605 if (!pEnv) |
| 606 return; | 606 return; |
| 607 | 607 |
| 608 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; | 608 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; |
| 609 CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); | 609 CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); |
| 610 if (wsFilePath.IsEmpty()) { | 610 if (wsFilePath.IsEmpty()) { |
| 611 if (!pEnv->GetFormFillInfo() || !pEnv->GetFormFillInfo()->m_pJsPlatform) | 611 if (!pEnv->GetFormFillInfo() || !pEnv->GetFormFillInfo()->m_pJsPlatform) |
| 612 return; | 612 return; |
| 613 CFX_WideString filepath = pEnv->JS_fieldBrowse(); | 613 CFX_WideString filepath = pEnv->JS_fieldBrowse(); |
| 614 bs = filepath.UTF16LE_Encode(); | 614 bs = filepath.UTF16LE_Encode(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 | 687 |
| 688 void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc, | 688 void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc, |
| 689 const CFX_WideString& bsURL, | 689 const CFX_WideString& bsURL, |
| 690 FX_BOOL bAppend) { | 690 FX_BOOL bAppend) { |
| 691 if (hDoc != m_pXFADoc.get()) | 691 if (hDoc != m_pXFADoc.get()) |
| 692 return; | 692 return; |
| 693 | 693 |
| 694 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) | 694 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) |
| 695 return; | 695 return; |
| 696 | 696 |
| 697 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 697 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 698 if (!pEnv) | 698 if (!pEnv) |
| 699 return; | 699 return; |
| 700 | 700 |
| 701 CFX_WideStringC str(bsURL.c_str()); | 701 CFX_WideStringC str(bsURL.c_str()); |
| 702 | 702 |
| 703 pEnv->FFI_GotoURL(this, str, bAppend); | 703 pEnv->FFI_GotoURL(this, str, bAppend); |
| 704 } | 704 } |
| 705 | 705 |
| 706 FX_BOOL CPDFXFA_Document::IsValidationsEnabled(CXFA_FFDoc* hDoc) { | 706 FX_BOOL CPDFXFA_Document::IsValidationsEnabled(CXFA_FFDoc* hDoc) { |
| 707 if (hDoc != m_pXFADoc.get() || !m_pSDKDoc) | 707 if (hDoc != m_pXFADoc.get() || !m_pSDKDoc) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 } | 740 } |
| 741 } | 741 } |
| 742 } | 742 } |
| 743 void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc, | 743 void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc, |
| 744 int32_t nStartPage, | 744 int32_t nStartPage, |
| 745 int32_t nEndPage, | 745 int32_t nEndPage, |
| 746 uint32_t dwOptions) { | 746 uint32_t dwOptions) { |
| 747 if (hDoc != m_pXFADoc.get()) | 747 if (hDoc != m_pXFADoc.get()) |
| 748 return; | 748 return; |
| 749 | 749 |
| 750 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 750 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 751 if (!pEnv || !pEnv->GetFormFillInfo() || | 751 if (!pEnv || !pEnv->GetFormFillInfo() || |
| 752 !pEnv->GetFormFillInfo()->m_pJsPlatform || | 752 !pEnv->GetFormFillInfo()->m_pJsPlatform || |
| 753 !pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) { | 753 !pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) { |
| 754 return; | 754 return; |
| 755 } | 755 } |
| 756 | 756 |
| 757 pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print( | 757 pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print( |
| 758 pEnv->GetFormFillInfo()->m_pJsPlatform, | 758 pEnv->GetFormFillInfo()->m_pJsPlatform, |
| 759 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage, | 759 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage, |
| 760 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage, | 760 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 FX_BOOL CPDFXFA_Document::Clear(CXFA_FFDoc* hDoc, | 802 FX_BOOL CPDFXFA_Document::Clear(CXFA_FFDoc* hDoc, |
| 803 CXFA_Node* pSigNode, | 803 CXFA_Node* pSigNode, |
| 804 FX_BOOL bCleared) { | 804 FX_BOOL bCleared) { |
| 805 return 0; | 805 return 0; |
| 806 } | 806 } |
| 807 | 807 |
| 808 void CPDFXFA_Document::GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) { | 808 void CPDFXFA_Document::GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) { |
| 809 if (hDoc != m_pXFADoc.get()) | 809 if (hDoc != m_pXFADoc.get()) |
| 810 return; | 810 return; |
| 811 | 811 |
| 812 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 812 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 813 if (!pEnv) | 813 if (!pEnv) |
| 814 return; | 814 return; |
| 815 | 815 |
| 816 pEnv->FFI_GetURL(this, wsDocURL); | 816 pEnv->FFI_GetURL(this, wsDocURL); |
| 817 } | 817 } |
| 818 | 818 |
| 819 FX_ARGB CPDFXFA_Document::GetHighlightColor(CXFA_FFDoc* hDoc) { | 819 FX_ARGB CPDFXFA_Document::GetHighlightColor(CXFA_FFDoc* hDoc) { |
| 820 if (hDoc != m_pXFADoc.get()) | 820 if (hDoc != m_pXFADoc.get()) |
| 821 return 0; | 821 return 0; |
| 822 if (m_pSDKDoc) { | 822 if (m_pSDKDoc) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param); | 858 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param); |
| 859 } | 859 } |
| 860 | 860 |
| 861 pWidgetAccIterator.reset(m_pXFADocView->CreateWidgetAccIterator()); | 861 pWidgetAccIterator.reset(m_pXFADocView->CreateWidgetAccIterator()); |
| 862 if (pWidgetAccIterator) { | 862 if (pWidgetAccIterator) { |
| 863 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); | 863 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); |
| 864 pWidgetAcc = pWidgetAccIterator->MoveToNext(); | 864 pWidgetAcc = pWidgetAccIterator->MoveToNext(); |
| 865 while (pWidgetAcc) { | 865 while (pWidgetAcc) { |
| 866 int fRet = pWidgetAcc->ProcessValidate(-1); | 866 int fRet = pWidgetAcc->ProcessValidate(-1); |
| 867 if (fRet == XFA_EVENTERROR_Error) { | 867 if (fRet == XFA_EVENTERROR_Error) { |
| 868 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 868 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 869 if (!pEnv) | 869 if (!pEnv) |
| 870 return FALSE; | 870 return FALSE; |
| 871 CFX_WideString ws; | 871 CFX_WideString ws; |
| 872 ws.FromLocal(IDS_XFA_Validate_Input); | 872 ws.FromLocal(IDS_XFA_Validate_Input); |
| 873 CFX_ByteString bs = ws.UTF16LE_Encode(); | 873 CFX_ByteString bs = ws.UTF16LE_Encode(); |
| 874 int len = bs.GetLength() / sizeof(unsigned short); | 874 int len = bs.GetLength() / sizeof(unsigned short); |
| 875 pEnv->FFI_Alert( | 875 pEnv->FFI_Alert( |
| 876 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), | 876 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), |
| 877 (FPDF_WIDESTRING)L"", 0, 1); | 877 (FPDF_WIDESTRING)L"", 0, 1); |
| 878 bs.ReleaseBuffer(len * sizeof(unsigned short)); | 878 bs.ReleaseBuffer(len * sizeof(unsigned short)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 | 928 |
| 929 FX_BOOL CPDFXFA_Document::GetSuggestWords( | 929 FX_BOOL CPDFXFA_Document::GetSuggestWords( |
| 930 CXFA_FFDoc* hDoc, | 930 CXFA_FFDoc* hDoc, |
| 931 const CFX_ByteStringC& sWord, | 931 const CFX_ByteStringC& sWord, |
| 932 std::vector<CFX_ByteString>& sSuggest) { | 932 std::vector<CFX_ByteString>& sSuggest) { |
| 933 return FALSE; | 933 return FALSE; |
| 934 } | 934 } |
| 935 | 935 |
| 936 IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc, | 936 IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc, |
| 937 const CFX_WideString& wsLink) { | 937 const CFX_WideString& wsLink) { |
| 938 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 938 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 939 if (!pEnv) | 939 if (!pEnv) |
| 940 return FALSE; | 940 return FALSE; |
| 941 CFX_ByteString bs = wsLink.UTF16LE_Encode(); | 941 CFX_ByteString bs = wsLink.UTF16LE_Encode(); |
| 942 int len = bs.GetLength() / sizeof(unsigned short); | 942 int len = bs.GetLength() / sizeof(unsigned short); |
| 943 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile( | 943 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile( |
| 944 0, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "rb"); | 944 0, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "rb"); |
| 945 bs.ReleaseBuffer(len * sizeof(unsigned short)); | 945 bs.ReleaseBuffer(len * sizeof(unsigned short)); |
| 946 | 946 |
| 947 if (!pFileHandler) | 947 if (!pFileHandler) |
| 948 return nullptr; | 948 return nullptr; |
| 949 return new CFPDF_FileStream(pFileHandler); | 949 return new CFPDF_FileStream(pFileHandler); |
| 950 } | 950 } |
| 951 FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, | 951 FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, |
| 952 int fileType, | 952 int fileType, |
| 953 FPDF_DWORD encodeType, | 953 FPDF_DWORD encodeType, |
| 954 FPDF_DWORD flag) { | 954 FPDF_DWORD flag) { |
| 955 if (!m_pXFADocView) | 955 if (!m_pXFADocView) |
| 956 return FALSE; | 956 return FALSE; |
| 957 | 957 |
| 958 CFX_ByteString content; | 958 CFX_ByteString content; |
| 959 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 959 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 960 if (!pEnv) | 960 if (!pEnv) |
| 961 return FALSE; | 961 return FALSE; |
| 962 | 962 |
| 963 CFPDF_FileStream fileStream(pFileHandler); | 963 CFPDF_FileStream fileStream(pFileHandler); |
| 964 | 964 |
| 965 if (fileType == FXFA_SAVEAS_XML) { | 965 if (fileType == FXFA_SAVEAS_XML) { |
| 966 const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; | 966 const char kContent[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; |
| 967 fileStream.WriteBlock(kContent, 0, strlen(kContent)); | 967 fileStream.WriteBlock(kContent, 0, strlen(kContent)); |
| 968 m_pXFADoc->SavePackage(XFA_HASHCODE_Data, &fileStream, nullptr); | 968 m_pXFADoc->SavePackage(XFA_HASHCODE_Data, &fileStream, nullptr); |
| 969 return TRUE; | 969 return TRUE; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 else | 1124 else |
| 1125 srcURL = srcURL.Right(csURL.GetLength() - (pos + 1)); | 1125 srcURL = srcURL.Right(csURL.GetLength() - (pos + 1)); |
| 1126 } | 1126 } |
| 1127 csToAddress.Replace(L",", L";"); | 1127 csToAddress.Replace(L",", L";"); |
| 1128 csCCAddress.Replace(L",", L";"); | 1128 csCCAddress.Replace(L",", L";"); |
| 1129 csBCCAddress.Replace(L",", L";"); | 1129 csBCCAddress.Replace(L",", L";"); |
| 1130 return TRUE; | 1130 return TRUE; |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 FX_BOOL CPDFXFA_Document::_SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { | 1133 FX_BOOL CPDFXFA_Document::_SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { |
| 1134 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 1134 CPDFSDK_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 1135 if (!pEnv) | 1135 if (!pEnv) |
| 1136 return FALSE; | 1136 return FALSE; |
| 1137 CFX_WideStringC csURLC; | 1137 CFX_WideStringC csURLC; |
| 1138 submit.GetSubmitTarget(csURLC); | 1138 submit.GetSubmitTarget(csURLC); |
| 1139 CFX_WideString csURL(csURLC); | 1139 CFX_WideString csURL(csURLC); |
| 1140 if (csURL.IsEmpty()) { | 1140 if (csURL.IsEmpty()) { |
| 1141 CFX_WideString ws; | 1141 CFX_WideString ws; |
| 1142 ws.FromLocal("Submit cancelled."); | 1142 ws.FromLocal("Submit cancelled."); |
| 1143 CFX_ByteString bs = ws.UTF16LE_Encode(); | 1143 CFX_ByteString bs = ws.UTF16LE_Encode(); |
| 1144 int len = bs.GetLength() / sizeof(unsigned short); | 1144 int len = bs.GetLength() / sizeof(unsigned short); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 | 1269 |
| 1270 return m_pSDKDoc->GetEnv()->GetJSRuntime()->GetValueByName(szPropName, | 1270 return m_pSDKDoc->GetEnv()->GetJSRuntime()->GetValueByName(szPropName, |
| 1271 pValue); | 1271 pValue); |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 CPDF_Document* CPDFXFA_Document::OpenPDF(CXFA_FFDoc* hDoc, | 1274 CPDF_Document* CPDFXFA_Document::OpenPDF(CXFA_FFDoc* hDoc, |
| 1275 IFX_FileRead* pFile, | 1275 IFX_FileRead* pFile, |
| 1276 FX_BOOL bTakeOverFile) { | 1276 FX_BOOL bTakeOverFile) { |
| 1277 return nullptr; | 1277 return nullptr; |
| 1278 } | 1278 } |
| OLD | NEW |