From bec76925d40d28e6c26ca4bb456368ff5f69a607 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 29 Sep 2016 16:52:30 -0700 Subject: Move fpdfsdk/fpdfxfa/include to fpdfsdk/fpdfxfa BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2381993002 --- BUILD.gn | 10 +- fpdfsdk/cpdfsdk_annot.cpp | 2 +- fpdfsdk/cpdfsdk_annothandlermgr.cpp | 2 +- fpdfsdk/cpdfsdk_baannothandler.cpp | 2 +- fpdfsdk/cpdfsdk_environment.cpp | 2 +- fpdfsdk/cpdfsdk_interform.cpp | 4 +- fpdfsdk/cpdfsdk_pageview.cpp | 2 +- fpdfsdk/cpdfsdk_widget.cpp | 2 +- fpdfsdk/cpdfsdk_widgethandler.cpp | 2 +- fpdfsdk/cpdfsdk_xfawidgethandler.cpp | 2 +- fpdfsdk/fpdf_ext.cpp | 2 +- fpdfsdk/fpdfdoc_unittest.cpp | 4 +- fpdfsdk/fpdfeditpage.cpp | 6 +- fpdfsdk/fpdfformfill.cpp | 6 +- fpdfsdk/fpdfsave.cpp | 6 +- fpdfsdk/fpdftext.cpp | 4 +- fpdfsdk/fpdfview.cpp | 8 +- fpdfsdk/fpdfxfa/DEPS | 1 + fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 6 +- fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h | 112 +++++++++++++++++++++++ fpdfsdk/fpdfxfa/fpdfxfa_app.cpp | 4 +- fpdfsdk/fpdfxfa/fpdfxfa_app.h | 79 ++++++++++++++++ fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 8 +- fpdfsdk/fpdfxfa/fpdfxfa_doc.h | 95 +++++++++++++++++++ fpdfsdk/fpdfxfa/fpdfxfa_page.cpp | 6 +- fpdfsdk/fpdfxfa/fpdfxfa_page.h | 85 +++++++++++++++++ fpdfsdk/fpdfxfa/fpdfxfa_util.cpp | 2 +- fpdfsdk/fpdfxfa/fpdfxfa_util.h | 48 ++++++++++ fpdfsdk/fpdfxfa/include/DEPS | 3 - fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h | 112 ----------------------- fpdfsdk/fpdfxfa/include/fpdfxfa_app.h | 79 ---------------- fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h | 95 ------------------- fpdfsdk/fpdfxfa/include/fpdfxfa_page.h | 85 ----------------- fpdfsdk/fpdfxfa/include/fpdfxfa_util.h | 48 ---------- fpdfsdk/include/fsdk_define.h | 2 +- fpdfsdk/javascript/cjs_runtime.cpp | 2 +- 36 files changed, 468 insertions(+), 470 deletions(-) create mode 100644 fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h create mode 100644 fpdfsdk/fpdfxfa/fpdfxfa_app.h create mode 100644 fpdfsdk/fpdfxfa/fpdfxfa_doc.h create mode 100644 fpdfsdk/fpdfxfa/fpdfxfa_page.h create mode 100644 fpdfsdk/fpdfxfa/fpdfxfa_util.h delete mode 100644 fpdfsdk/fpdfxfa/include/DEPS delete mode 100644 fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h delete mode 100644 fpdfsdk/fpdfxfa/include/fpdfxfa_app.h delete mode 100644 fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h delete mode 100644 fpdfsdk/fpdfxfa/include/fpdfxfa_page.h delete mode 100644 fpdfsdk/fpdfxfa/include/fpdfxfa_util.h diff --git a/BUILD.gn b/BUILD.gn index 315eaa207e..5f3b1bd9e9 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1050,15 +1050,15 @@ if (pdf_enable_xfa) { static_library("fpdfxfa") { sources = [ "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp", + "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h", "fpdfsdk/fpdfxfa/fpdfxfa_app.cpp", + "fpdfsdk/fpdfxfa/fpdfxfa_app.h", "fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp", + "fpdfsdk/fpdfxfa/fpdfxfa_doc.h", "fpdfsdk/fpdfxfa/fpdfxfa_page.cpp", + "fpdfsdk/fpdfxfa/fpdfxfa_page.h", "fpdfsdk/fpdfxfa/fpdfxfa_util.cpp", - "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h", - "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h", - "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h", - "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h", - "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h", + "fpdfsdk/fpdfxfa/fpdfxfa_util.h", ] deps = [ ":fxcrt", diff --git a/fpdfsdk/cpdfsdk_annot.cpp b/fpdfsdk/cpdfsdk_annot.cpp index 7752cf120f..a6166efa72 100644 --- a/fpdfsdk/cpdfsdk_annot.cpp +++ b/fpdfsdk/cpdfsdk_annot.cpp @@ -12,7 +12,7 @@ #include "third_party/base/stl_util.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" #endif // PDF_ENABLE_XFA namespace { diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index 9dd5a4e46f..9057d6bed5 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp @@ -18,7 +18,7 @@ #include "fpdfsdk/include/cpdfsdk_widgethandler.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" #include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h" #include "xfa/fxfa/include/xfa_ffpageview.h" #include "xfa/fxfa/include/xfa_ffwidget.h" diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp index 4f5213e42e..5811218417 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.cpp +++ b/fpdfsdk/cpdfsdk_baannothandler.cpp @@ -18,7 +18,7 @@ #include "fpdfsdk/include/cpdfsdk_pageview.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" #endif // PDF_ENABLE_XFA namespace { diff --git a/fpdfsdk/cpdfsdk_environment.cpp b/fpdfsdk/cpdfsdk_environment.cpp index 0f621eb887..94a89eea7c 100644 --- a/fpdfsdk/cpdfsdk_environment.cpp +++ b/fpdfsdk/cpdfsdk_environment.cpp @@ -15,7 +15,7 @@ #include "fpdfsdk/javascript/ijs_runtime.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" #endif // PDF_ENABLE_XFA namespace { diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index eb257cc581..b74f98a471 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -37,8 +37,8 @@ #include "third_party/base/stl_util.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_util.h" #include "fpdfsdk/include/cpdfsdk_xfawidget.h" #include "xfa/fxfa/include/cxfa_eventparam.h" #include "xfa/fxfa/include/xfa_ffdocview.h" diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index cb76a8a571..8144a91370 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -20,7 +20,7 @@ #include "fpdfsdk/include/cpdfsdk_interform.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" #include "xfa/fxfa/include/xfa_ffdocview.h" #include "xfa/fxfa/include/xfa_ffpageview.h" #include "xfa/fxfa/include/xfa_ffwidgethandler.h" diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index d41f8927d7..b6d946597c 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -31,7 +31,7 @@ #include "fpdfsdk/pdfwindow/PWL_Utils.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" #include "xfa/fxfa/include/cxfa_eventparam.h" #include "xfa/fxfa/include/fxfa_widget.h" #include "xfa/fxfa/include/xfa_ffdocview.h" diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp index 208877edaf..9f945748e6 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.cpp +++ b/fpdfsdk/cpdfsdk_widgethandler.cpp @@ -21,7 +21,7 @@ #include "fpdfsdk/include/cpdfsdk_widget.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" #endif // PDF_ENABLE_XFA CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(CPDFSDK_Environment* pEnv) diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp index 2abe9944f0..bf04707cd8 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp @@ -7,7 +7,7 @@ #include "fpdfsdk/include/cpdfsdk_xfawidgethandler.h" #include "core/fpdfdoc/cpdf_interform.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/cpdfsdk_annot.h" #include "fpdfsdk/include/cpdfsdk_document.h" #include "fpdfsdk/include/cpdfsdk_environment.h" diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp index b77e751a38..fed0d8c55f 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -20,7 +20,7 @@ #include "fpdfsdk/include/fsdk_define.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" #endif // PDF_ENABLE_XFA FX_BOOL FPDF_UnSupportError(int nError) { diff --git a/fpdfsdk/fpdfdoc_unittest.cpp b/fpdfsdk/fpdfdoc_unittest.cpp index 354608dad1..e39b732272 100644 --- a/fpdfsdk/fpdfdoc_unittest.cpp +++ b/fpdfsdk/fpdfdoc_unittest.cpp @@ -18,8 +18,8 @@ #include "testing/test_support.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" #endif // PDF_ENABLE_XFA class CPDF_TestDocument : public CPDF_Document { diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index acbb295a63..812035abcc 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -29,9 +29,9 @@ #include "third_party/base/stl_util.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" #endif // PDF_ENABLE_XFA #if _FX_OS_ == _FX_ANDROID_ diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index dfa63da491..97730bad09 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -27,9 +27,9 @@ #include "third_party/base/stl_util.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" #include "xfa/fxfa/include/xfa_ffdocview.h" #include "xfa/fxfa/include/xfa_ffpageview.h" #include "xfa/fxfa/include/xfa_ffwidget.h" diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index b6def4d8ff..c9872e2480 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -19,9 +19,9 @@ #include "public/fpdf_edit.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_util.h" #include "public/fpdf_formfill.h" #include "xfa/fxfa/include/cxfa_eventparam.h" #include "xfa/fxfa/include/xfa_checksum.h" diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp index 4a84c3589d..d2149eda6d 100644 --- a/fpdfsdk/fpdftext.cpp +++ b/fpdfsdk/fpdftext.cpp @@ -16,8 +16,8 @@ #include "third_party/base/stl_util.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" #endif // PDF_ENABLE_XFA #ifdef _WIN32 diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 50831d6d2e..a8a7a0b5ac 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -35,10 +35,10 @@ #include "third_party/base/numerics/safe_conversions_impl.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_util.h" #include "public/fpdf_formfill.h" #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/fpdfxfa/DEPS b/fpdfsdk/fpdfxfa/DEPS index 7f85f28f8b..b9a370408a 100644 --- a/fpdfsdk/fpdfxfa/DEPS +++ b/fpdfsdk/fpdfxfa/DEPS @@ -1,3 +1,4 @@ include_rules = [ + '+xfa/fwl/core/include', '+xfa/fxbarcode/include', ] diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index f51b02b4d8..3096b4ba8b 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -4,13 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h" +#include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" #include "core/fpdfapi/fpdf_parser/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fpdfapi/fpdf_parser/cpdf_string.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" #include "fpdfsdk/include/cpdfsdk_document.h" #include "fpdfsdk/include/cpdfsdk_environment.h" #include "fpdfsdk/include/cpdfsdk_interform.h" diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h new file mode 100644 index 0000000000..5b6c89dd42 --- /dev/null +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h @@ -0,0 +1,112 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ +#define FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ + +#include "public/fpdfview.h" +#include "xfa/fxfa/include/fxfa.h" + +class CPDFXFA_Document; +class IJS_Context; + +class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { + public: + CPDFXFA_DocEnvironment(CPDFXFA_Document*); + ~CPDFXFA_DocEnvironment() override; + + // IXFA_DocEnvironment + void SetChangeMark(CXFA_FFDoc* hDoc) override; + // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. + void InvalidateRect(CXFA_FFPageView* pPageView, + const CFX_RectF& rt, + uint32_t dwFlags) override; + // show or hide caret + void DisplayCaret(CXFA_FFWidget* hWidget, + FX_BOOL bVisible, + const CFX_RectF* pRtAnchor) override; + // dwPos: (0:bottom 1:top) + FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget, + FX_FLOAT fMinPopup, + FX_FLOAT fMaxPopup, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup) override; + FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) override; + + // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing + void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) override; + void WidgetPostAdd(CXFA_FFWidget* hWidget, + CXFA_WidgetAcc* pWidgetData) override; + void WidgetPreRemove(CXFA_FFWidget* hWidget, + CXFA_WidgetAcc* pWidgetData) override; + + // Host method + int32_t CountPages(CXFA_FFDoc* hDoc) override; + int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override; + void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override; + FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) override; + void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; + void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override; + void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override; + void ExportData(CXFA_FFDoc* hDoc, + const CFX_WideString& wsFilePath, + FX_BOOL bXDP) override; + void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) override; + FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) override; + void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; + void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; + void Print(CXFA_FFDoc* hDoc, + int32_t nStartPage, + int32_t nEndPage, + uint32_t dwOptions) override; + FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) override; + + /** + *Submit data to email, http, ftp. + * @param[in] hDoc The document handler. + * @param[in] eFormat Determines the format in which the data will be + *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml... + * @param[in] wsTarget The URL to which the data will be submitted. + * @param[in] eEncoding The encoding of text content. + * @param[in] pXDPContent Controls what subset of the data is submitted, used + *only when the format property is xdp. + * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted + *content or not. + */ + FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; + + FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, + const CFX_ByteStringC& szPropName, + CFXJSE_Value* pValue) override; + FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, + const CFX_ByteStringC& szPropName, + CFXJSE_Value* pValue) override; + + IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, + const CFX_WideString& wsLink) override; + + private: + FX_BOOL OnBeforeNotifySubmit(); + void OnAfterNotifySubmit(); + FX_BOOL NotifySubmit(FX_BOOL bPrevOrPost); + FX_BOOL SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); + FX_BOOL MailToInfo(CFX_WideString& csURL, + CFX_WideString& csToAddress, + CFX_WideString& csCCAddress, + CFX_WideString& csBCCAddress, + CFX_WideString& csSubject, + CFX_WideString& csMsg); + FX_BOOL ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, + int fileType, + FPDF_DWORD encodeType, + FPDF_DWORD flag); + void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); + + CPDFXFA_Document* const m_pDocument; // Not owned; + IJS_Context* m_pJSContext; +}; + +#endif // FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_ diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp index ccaceac413..28b9981d6c 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp @@ -4,11 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" #include -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_util.h" #include "fpdfsdk/include/cpdfsdk_environment.h" #include "fpdfsdk/include/fsdk_define.h" #include "xfa/fxbarcode/include/BC_Library.h" diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.h b/fpdfsdk/fpdfxfa/fpdfxfa_app.h new file mode 100644 index 0000000000..c8e00cbe0b --- /dev/null +++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.h @@ -0,0 +1,79 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_FPDFXFA_FPDFXFA_APP_H_ +#define FPDFSDK_FPDFXFA_FPDFXFA_APP_H_ + +#include "xfa/fxfa/include/fxfa.h" + +class CPDFSDK_Environment; +class IFXJS_Runtime; + +class CPDFXFA_App : public IXFA_AppProvider { + public: + static CPDFXFA_App* GetInstance(); + static void ReleaseInstance(); + + CPDFXFA_App(); + ~CPDFXFA_App() override; + + FX_BOOL Initialize(v8::Isolate* pIsolate); + CXFA_FFApp* GetXFAApp() { return m_pXFAApp.get(); } + + FX_BOOL AddFormFillEnv(CPDFSDK_Environment* pEnv); + FX_BOOL RemoveFormFillEnv(CPDFSDK_Environment* pEnv); + + FX_BOOL IsJavaScriptInitialized() const { return m_bJavaScriptInitialized; } + void SetJavaScriptInitialized(FX_BOOL bInitialized) { + m_bJavaScriptInitialized = bInitialized; + } + + v8::Isolate* GetJSERuntime() const { return m_pIsolate; } + + // IFXA_AppProvider: + void GetAppType(CFX_WideString& wsAppType) override; + void SetAppType(const CFX_WideStringC& wsAppType) override; + + void GetLanguage(CFX_WideString& wsLanguage) override; + void GetPlatform(CFX_WideString& wsPlatform) override; + void GetVariation(CFX_WideString& wsVariation) override; + void GetVersion(CFX_WideString& wsVersion) override; + void GetAppName(CFX_WideString& wsName) override; + + void Beep(uint32_t dwType) override; + int32_t MsgBox(const CFX_WideString& wsMessage, + const CFX_WideString& wsTitle, + uint32_t dwIconType, + uint32_t dwButtonType) override; + CFX_WideString Response(const CFX_WideString& wsQuestion, + const CFX_WideString& wsTitle, + const CFX_WideString& wsDefaultAnswer, + FX_BOOL bMark) override; + + IFX_FileRead* DownloadURL(const CFX_WideString& wsURL) override; + FX_BOOL PostRequestURL(const CFX_WideString& wsURL, + const CFX_WideString& wsData, + const CFX_WideString& wsContentType, + const CFX_WideString& wsEncode, + const CFX_WideString& wsHeader, + CFX_WideString& wsResponse) override; + FX_BOOL PutRequestURL(const CFX_WideString& wsURL, + const CFX_WideString& wsData, + const CFX_WideString& wsEncode) override; + + void LoadString(int32_t iStringID, CFX_WideString& wsString) override; + IFWL_AdapterTimerMgr* GetTimerMgr() override; + + CFX_ArrayTemplate m_pEnvList; + + protected: + FX_BOOL m_bJavaScriptInitialized; + std::unique_ptr m_pXFAApp; + v8::Isolate* m_pIsolate; + CFX_WideString m_csAppType; +}; + +#endif // FPDFSDK_FPDFXFA_FPDFXFA_APP_H_ diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index 52a00e6126..f99fcb2716 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -4,12 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" #include "core/fpdfapi/fpdf_parser/cpdf_document.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_util.h" #include "fpdfsdk/include/cpdfsdk_document.h" #include "fpdfsdk/include/cpdfsdk_environment.h" #include "fpdfsdk/include/cpdfsdk_interform.h" diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/fpdfxfa_doc.h new file mode 100644 index 0000000000..3f3ea21a7d --- /dev/null +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.h @@ -0,0 +1,95 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_FPDFXFA_FPDFXFA_DOC_H_ +#define FPDFSDK_FPDFXFA_FPDFXFA_DOC_H_ + +#include + +#include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" +#include "xfa/fxfa/include/xfa_ffdoc.h" + +class CPDFSDK_Document; +class CPDFSDK_Environment; +class CPDFXFA_App; +class CPDFXFA_Page; +class CXFA_FFDocHandler; +class IJS_Runtime; +class IJS_Context; + +enum LoadStatus { + FXFA_LOADSTATUS_PRELOAD = 0, + FXFA_LOADSTATUS_LOADING, + FXFA_LOADSTATUS_LOADED, + FXFA_LOADSTATUS_CLOSING, + FXFA_LOADSTATUS_CLOSED +}; + +class CPDFXFA_Document { + public: + CPDFXFA_Document(std::unique_ptr pPDFDoc, + CPDFXFA_App* pProvider); + ~CPDFXFA_Document(); + + FX_BOOL LoadXFADoc(); + CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); } + CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } + CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } + int GetDocType() const { return m_iDocType; } + + CPDFSDK_Document* GetSDKDoc() const { return m_pSDKDoc.get(); } + void SetSDKDoc(std::unique_ptr pSDKDoc); + + void DeletePage(int page_index); + int GetPageCount() const; + + CPDFXFA_Page* GetXFAPage(int page_index); + CPDFXFA_Page* GetXFAPage(CXFA_FFPageView* pPage) const; + + void RemovePage(CPDFXFA_Page* page); + + void ClearChangeMark(); + + protected: + friend class CPDFXFA_DocEnvironment; + + int GetOriginalPageCount() const { return m_nPageCount; } + void SetOriginalPageCount(int count) { + m_nPageCount = count; + m_XFAPageList.SetSize(count); + } + + LoadStatus GetLoadStatus() const { return m_nLoadStatus; } + + CFX_ArrayTemplate* GetXFAPageList() { return &m_XFAPageList; } + + private: + void CloseXFADoc(CXFA_FFDocHandler* pDoc) { + if (pDoc) { + m_pXFADoc->CloseDoc(); + m_pXFADoc.reset(); + m_pXFADocView = nullptr; + } + } + + int m_iDocType; + + std::unique_ptr m_pPDFDoc; + // |m_pSDKDoc| must be destroyed before |m_pPDFDoc| since it needs to access + // it to kill focused annotations. + std::unique_ptr m_pSDKDoc; + std::unique_ptr m_pXFADoc; + CXFA_FFDocView* m_pXFADocView; // not owned. + CPDFXFA_App* const m_pApp; + CFX_ArrayTemplate m_XFAPageList; + LoadStatus m_nLoadStatus; + int m_nPageCount; + + // Must be destroy before |m_pSDKDoc|. + CPDFXFA_DocEnvironment m_DocEnv; +}; + +#endif // FPDFSDK_FPDFXFA_FPDFXFA_DOC_H_ diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp index a930404228..6f6b35239f 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp @@ -4,12 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" #include "core/fpdfapi/fpdf_page/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/cpdf_document.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_util.h" #include "fpdfsdk/include/fsdk_define.h" #include "public/fpdf_formfill.h" #include "xfa/fxfa/include/xfa_ffdocview.h" diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.h b/fpdfsdk/fpdfxfa/fpdfxfa_page.h new file mode 100644 index 0000000000..cc622b7a40 --- /dev/null +++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.h @@ -0,0 +1,85 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_FPDFXFA_FPDFXFA_PAGE_H_ +#define FPDFSDK_FPDFXFA_FPDFXFA_PAGE_H_ + +#include + +#include "core/fxcrt/fx_system.h" + +class CFX_Matrix; +class CPDFXFA_Document; +class CPDF_Dictionary; +class CPDF_Page; +class CXFA_FFPageView; + +class CPDFXFA_Page { + public: + CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index); + + void Retain() { m_iRef++; } + void Release() { + if (--m_iRef <= 0) + delete this; + } + + FX_BOOL LoadPage(); + FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict); + CPDFXFA_Document* GetDocument() const { return m_pDocument; } + int GetPageIndex() const { return m_iPageIndex; } + CPDF_Page* GetPDFPage() const { return m_pPDFPage.get(); } + CXFA_FFPageView* GetXFAPageView() const { return m_pXFAPageView; } + + void SetXFAPageView(CXFA_FFPageView* pPageView) { + m_pXFAPageView = pPageView; + } + + FX_FLOAT GetPageWidth() const; + FX_FLOAT GetPageHeight() const; + + void DeviceToPage(int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int device_x, + int device_y, + double* page_x, + double* page_y); + void PageToDevice(int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + double page_x, + double page_y, + int* device_x, + int* device_y); + + void GetDisplayMatrix(CFX_Matrix& matrix, + int xPos, + int yPos, + int xSize, + int ySize, + int iRotate) const; + + protected: + // Refcounted class. + ~CPDFXFA_Page(); + + FX_BOOL LoadPDFPage(); + FX_BOOL LoadXFAPageView(); + + private: + std::unique_ptr m_pPDFPage; + CXFA_FFPageView* m_pXFAPageView; + CPDFXFA_Document* const m_pDocument; + const int m_iPageIndex; + int m_iRef; +}; + +#endif // FPDFSDK_FPDFXFA_FPDFXFA_PAGE_H_ diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp index 5b050afa35..13501df949 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_util.h" #include diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_util.h b/fpdfsdk/fpdfxfa/fpdfxfa_util.h new file mode 100644 index 0000000000..74f4f31d7c --- /dev/null +++ b/fpdfsdk/fpdfxfa/fpdfxfa_util.h @@ -0,0 +1,48 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_FPDFXFA_FPDFXFA_UTIL_H_ +#define FPDFSDK_FPDFXFA_FPDFXFA_UTIL_H_ + +#include + +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" +#include "xfa/fwl/core/include/ifwl_adaptertimermgr.h" + +#define JS_STR_VIEWERTYPE_STANDARD L"Exchange" +#define JS_STR_LANGUANGE L"ENU" +#define JS_STR_VIEWERVARIATION L"Full" +#define JS_STR_VIEWERVERSION_XFA L"11" + +struct CFWL_TimerInfo; + +class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr { + public: + CXFA_FWLAdapterTimerMgr(CPDFSDK_Environment* pEnv) : m_pEnv(pEnv) {} + + FWL_Error Start(IFWL_Timer* pTimer, + uint32_t dwElapse, + bool bImmediately, + IFWL_TimerInfo** pTimerInfo) override; + FWL_Error Stop(IFWL_TimerInfo* pTimerInfo) override; + + protected: + static void TimerProc(int32_t idEvent); + + static std::vector* s_TimerArray; + CPDFSDK_Environment* const m_pEnv; +}; + +struct CFWL_TimerInfo : public IFWL_TimerInfo { + CFWL_TimerInfo() : pTimer(nullptr) {} + CFWL_TimerInfo(int32_t event, IFWL_Timer* timer) + : idEvent(event), pTimer(timer) {} + + int32_t idEvent; + IFWL_Timer* pTimer; +}; + +#endif // FPDFSDK_FPDFXFA_FPDFXFA_UTIL_H_ diff --git a/fpdfsdk/fpdfxfa/include/DEPS b/fpdfsdk/fpdfxfa/include/DEPS deleted file mode 100644 index f207778cb2..0000000000 --- a/fpdfsdk/fpdfxfa/include/DEPS +++ /dev/null @@ -1,3 +0,0 @@ -include_rules = [ - "+xfa/fwl/core/include", -] diff --git a/fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h deleted file mode 100644 index 26ff86122a..0000000000 --- a/fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_FPDFXFA_INCLUDE_CPDFXFA_DOCENVIRONMENT_H_ -#define FPDFSDK_FPDFXFA_INCLUDE_CPDFXFA_DOCENVIRONMENT_H_ - -#include "public/fpdfview.h" -#include "xfa/fxfa/include/fxfa.h" - -class CPDFXFA_Document; -class IJS_Context; - -class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { - public: - CPDFXFA_DocEnvironment(CPDFXFA_Document*); - ~CPDFXFA_DocEnvironment() override; - - // IXFA_DocEnvironment - void SetChangeMark(CXFA_FFDoc* hDoc) override; - // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros. - void InvalidateRect(CXFA_FFPageView* pPageView, - const CFX_RectF& rt, - uint32_t dwFlags) override; - // show or hide caret - void DisplayCaret(CXFA_FFWidget* hWidget, - FX_BOOL bVisible, - const CFX_RectF* pRtAnchor) override; - // dwPos: (0:bottom 1:top) - FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget, - FX_FLOAT fMinPopup, - FX_FLOAT fMaxPopup, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup) override; - FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) override; - - // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing - void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) override; - void WidgetPostAdd(CXFA_FFWidget* hWidget, - CXFA_WidgetAcc* pWidgetData) override; - void WidgetPreRemove(CXFA_FFWidget* hWidget, - CXFA_WidgetAcc* pWidgetData) override; - - // Host method - int32_t CountPages(CXFA_FFDoc* hDoc) override; - int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override; - void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override; - FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) override; - void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; - void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override; - void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override; - void ExportData(CXFA_FFDoc* hDoc, - const CFX_WideString& wsFilePath, - FX_BOOL bXDP) override; - void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) override; - FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) override; - void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override; - void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; - void Print(CXFA_FFDoc* hDoc, - int32_t nStartPage, - int32_t nEndPage, - uint32_t dwOptions) override; - FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) override; - - /** - *Submit data to email, http, ftp. - * @param[in] hDoc The document handler. - * @param[in] eFormat Determines the format in which the data will be - *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml... - * @param[in] wsTarget The URL to which the data will be submitted. - * @param[in] eEncoding The encoding of text content. - * @param[in] pXDPContent Controls what subset of the data is submitted, used - *only when the format property is xdp. - * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted - *content or not. - */ - FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; - - FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pValue) override; - FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pValue) override; - - IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, - const CFX_WideString& wsLink) override; - - private: - FX_BOOL OnBeforeNotifySubmit(); - void OnAfterNotifySubmit(); - FX_BOOL NotifySubmit(FX_BOOL bPrevOrPost); - FX_BOOL SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); - FX_BOOL MailToInfo(CFX_WideString& csURL, - CFX_WideString& csToAddress, - CFX_WideString& csCCAddress, - CFX_WideString& csBCCAddress, - CFX_WideString& csSubject, - CFX_WideString& csMsg); - FX_BOOL ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, - int fileType, - FPDF_DWORD encodeType, - FPDF_DWORD flag); - void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); - - CPDFXFA_Document* const m_pDocument; // Not owned; - IJS_Context* m_pJSContext; -}; - -#endif // FPDFSDK_FPDFXFA_INCLUDE_CPDFXFA_DOCENVIRONMENT_H_ diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h deleted file mode 100644 index fefe088507..0000000000 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_app.h +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_ -#define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_ - -#include "xfa/fxfa/include/fxfa.h" - -class CPDFSDK_Environment; -class IFXJS_Runtime; - -class CPDFXFA_App : public IXFA_AppProvider { - public: - static CPDFXFA_App* GetInstance(); - static void ReleaseInstance(); - - CPDFXFA_App(); - ~CPDFXFA_App() override; - - FX_BOOL Initialize(v8::Isolate* pIsolate); - CXFA_FFApp* GetXFAApp() { return m_pXFAApp.get(); } - - FX_BOOL AddFormFillEnv(CPDFSDK_Environment* pEnv); - FX_BOOL RemoveFormFillEnv(CPDFSDK_Environment* pEnv); - - FX_BOOL IsJavaScriptInitialized() const { return m_bJavaScriptInitialized; } - void SetJavaScriptInitialized(FX_BOOL bInitialized) { - m_bJavaScriptInitialized = bInitialized; - } - - v8::Isolate* GetJSERuntime() const { return m_pIsolate; } - - // IFXA_AppProvider: - void GetAppType(CFX_WideString& wsAppType) override; - void SetAppType(const CFX_WideStringC& wsAppType) override; - - void GetLanguage(CFX_WideString& wsLanguage) override; - void GetPlatform(CFX_WideString& wsPlatform) override; - void GetVariation(CFX_WideString& wsVariation) override; - void GetVersion(CFX_WideString& wsVersion) override; - void GetAppName(CFX_WideString& wsName) override; - - void Beep(uint32_t dwType) override; - int32_t MsgBox(const CFX_WideString& wsMessage, - const CFX_WideString& wsTitle, - uint32_t dwIconType, - uint32_t dwButtonType) override; - CFX_WideString Response(const CFX_WideString& wsQuestion, - const CFX_WideString& wsTitle, - const CFX_WideString& wsDefaultAnswer, - FX_BOOL bMark) override; - - IFX_FileRead* DownloadURL(const CFX_WideString& wsURL) override; - FX_BOOL PostRequestURL(const CFX_WideString& wsURL, - const CFX_WideString& wsData, - const CFX_WideString& wsContentType, - const CFX_WideString& wsEncode, - const CFX_WideString& wsHeader, - CFX_WideString& wsResponse) override; - FX_BOOL PutRequestURL(const CFX_WideString& wsURL, - const CFX_WideString& wsData, - const CFX_WideString& wsEncode) override; - - void LoadString(int32_t iStringID, CFX_WideString& wsString) override; - IFWL_AdapterTimerMgr* GetTimerMgr() override; - - CFX_ArrayTemplate m_pEnvList; - - protected: - FX_BOOL m_bJavaScriptInitialized; - std::unique_ptr m_pXFAApp; - v8::Isolate* m_pIsolate; - CFX_WideString m_csAppType; -}; - -#endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_ diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h deleted file mode 100644 index 5398c57519..0000000000 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ -#define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ - -#include - -#include "fpdfsdk/fpdfxfa/include/cpdfxfa_docenvironment.h" -#include "xfa/fxfa/include/xfa_ffdoc.h" - -class CPDFSDK_Document; -class CPDFSDK_Environment; -class CPDFXFA_App; -class CPDFXFA_Page; -class CXFA_FFDocHandler; -class IJS_Runtime; -class IJS_Context; - -enum LoadStatus { - FXFA_LOADSTATUS_PRELOAD = 0, - FXFA_LOADSTATUS_LOADING, - FXFA_LOADSTATUS_LOADED, - FXFA_LOADSTATUS_CLOSING, - FXFA_LOADSTATUS_CLOSED -}; - -class CPDFXFA_Document { - public: - CPDFXFA_Document(std::unique_ptr pPDFDoc, - CPDFXFA_App* pProvider); - ~CPDFXFA_Document(); - - FX_BOOL LoadXFADoc(); - CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); } - CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } - CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } - int GetDocType() const { return m_iDocType; } - - CPDFSDK_Document* GetSDKDoc() const { return m_pSDKDoc.get(); } - void SetSDKDoc(std::unique_ptr pSDKDoc); - - void DeletePage(int page_index); - int GetPageCount() const; - - CPDFXFA_Page* GetXFAPage(int page_index); - CPDFXFA_Page* GetXFAPage(CXFA_FFPageView* pPage) const; - - void RemovePage(CPDFXFA_Page* page); - - void ClearChangeMark(); - - protected: - friend class CPDFXFA_DocEnvironment; - - int GetOriginalPageCount() const { return m_nPageCount; } - void SetOriginalPageCount(int count) { - m_nPageCount = count; - m_XFAPageList.SetSize(count); - } - - LoadStatus GetLoadStatus() const { return m_nLoadStatus; } - - CFX_ArrayTemplate* GetXFAPageList() { return &m_XFAPageList; } - - private: - void CloseXFADoc(CXFA_FFDocHandler* pDoc) { - if (pDoc) { - m_pXFADoc->CloseDoc(); - m_pXFADoc.reset(); - m_pXFADocView = nullptr; - } - } - - int m_iDocType; - - std::unique_ptr m_pPDFDoc; - // |m_pSDKDoc| must be destroyed before |m_pPDFDoc| since it needs to access - // it to kill focused annotations. - std::unique_ptr m_pSDKDoc; - std::unique_ptr m_pXFADoc; - CXFA_FFDocView* m_pXFADocView; // not owned. - CPDFXFA_App* const m_pApp; - CFX_ArrayTemplate m_XFAPageList; - LoadStatus m_nLoadStatus; - int m_nPageCount; - - // Must be destroy before |m_pSDKDoc|. - CPDFXFA_DocEnvironment m_DocEnv; -}; - -#endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h deleted file mode 100644 index bd60366a6b..0000000000 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_ -#define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_ - -#include - -#include "core/fxcrt/fx_system.h" - -class CFX_Matrix; -class CPDFXFA_Document; -class CPDF_Dictionary; -class CPDF_Page; -class CXFA_FFPageView; - -class CPDFXFA_Page { - public: - CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index); - - void Retain() { m_iRef++; } - void Release() { - if (--m_iRef <= 0) - delete this; - } - - FX_BOOL LoadPage(); - FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict); - CPDFXFA_Document* GetDocument() const { return m_pDocument; } - int GetPageIndex() const { return m_iPageIndex; } - CPDF_Page* GetPDFPage() const { return m_pPDFPage.get(); } - CXFA_FFPageView* GetXFAPageView() const { return m_pXFAPageView; } - - void SetXFAPageView(CXFA_FFPageView* pPageView) { - m_pXFAPageView = pPageView; - } - - FX_FLOAT GetPageWidth() const; - FX_FLOAT GetPageHeight() const; - - void DeviceToPage(int start_x, - int start_y, - int size_x, - int size_y, - int rotate, - int device_x, - int device_y, - double* page_x, - double* page_y); - void PageToDevice(int start_x, - int start_y, - int size_x, - int size_y, - int rotate, - double page_x, - double page_y, - int* device_x, - int* device_y); - - void GetDisplayMatrix(CFX_Matrix& matrix, - int xPos, - int yPos, - int xSize, - int ySize, - int iRotate) const; - - protected: - // Refcounted class. - ~CPDFXFA_Page(); - - FX_BOOL LoadPDFPage(); - FX_BOOL LoadXFAPageView(); - - private: - std::unique_ptr m_pPDFPage; - CXFA_FFPageView* m_pXFAPageView; - CPDFXFA_Document* const m_pDocument; - const int m_iPageIndex; - int m_iRef; -}; - -#endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_ diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h deleted file mode 100644 index fd7a678fdd..0000000000 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_UTIL_H_ -#define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_UTIL_H_ - -#include - -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" -#include "xfa/fwl/core/include/ifwl_adaptertimermgr.h" - -#define JS_STR_VIEWERTYPE_STANDARD L"Exchange" -#define JS_STR_LANGUANGE L"ENU" -#define JS_STR_VIEWERVARIATION L"Full" -#define JS_STR_VIEWERVERSION_XFA L"11" - -struct CFWL_TimerInfo; - -class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr { - public: - CXFA_FWLAdapterTimerMgr(CPDFSDK_Environment* pEnv) : m_pEnv(pEnv) {} - - FWL_Error Start(IFWL_Timer* pTimer, - uint32_t dwElapse, - bool bImmediately, - IFWL_TimerInfo** pTimerInfo) override; - FWL_Error Stop(IFWL_TimerInfo* pTimerInfo) override; - - protected: - static void TimerProc(int32_t idEvent); - - static std::vector* s_TimerArray; - CPDFSDK_Environment* const m_pEnv; -}; - -struct CFWL_TimerInfo : public IFWL_TimerInfo { - CFWL_TimerInfo() : pTimer(nullptr) {} - CFWL_TimerInfo(int32_t event, IFWL_Timer* timer) - : idEvent(event), pTimer(timer) {} - - int32_t idEvent; - IFWL_Timer* pTimer; -}; - -#endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_UTIL_H_ diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index ec99dbbf50..d6e98731d8 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -12,7 +12,7 @@ #include "public/fpdfview.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" #endif // PDF_ENABLE_XFA #ifdef _WIN32 diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index 0ca64b10f3..074061436a 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -32,7 +32,7 @@ #include "third_party/base/stl_util.h" #ifdef PDF_ENABLE_XFA -#include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" +#include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" #include "fxjs/include/cfxjse_value.h" #endif // PDF_ENABLE_XFA -- cgit v1.2.3