diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-12 11:56:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-12 11:56:23 -0700 |
commit | 7cbe68e34257b460bfa3baf0ea68fd6d50e1bc77 (patch) | |
tree | cc439488801d7a3e72a56ecd88df600e12b8a948 /fpdfsdk/cpdfsdk_formfillenvironment.h | |
parent | 7cc6a32693a07210e036a8d7131232231ec0fdb3 (diff) | |
download | pdfium-7cbe68e34257b460bfa3baf0ea68fd6d50e1bc77.tar.xz |
Merge CPDFSDK_Document into CPDFSDK_FormFillEnvironment
This CL merges the CPDFSDK_Document and CPDFSDK_FormFillEnvironment classes
as they always existed and always pointed at each other.
Review-Url: https://codereview.chromium.org/2410893002
Diffstat (limited to 'fpdfsdk/cpdfsdk_formfillenvironment.h')
-rw-r--r-- | fpdfsdk/cpdfsdk_formfillenvironment.h | 78 |
1 files changed, 71 insertions, 7 deletions
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h index e5a693288f..dd0e6bffe1 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.h +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -14,6 +14,7 @@ #include "core/fpdfdoc/cpdf_occontext.h" #include "core/fxcrt/cfx_observable.h" #include "fpdfsdk/cfx_systemhandler.h" +#include "fpdfsdk/cpdfsdk_annot.h" #include "fpdfsdk/fsdk_define.h" #include "public/fpdf_formfill.h" #include "public/fpdf_fwlevent.h" @@ -22,7 +23,8 @@ class CFFL_InteractiveFormFiller; class CFX_SystemHandler; class CPDFSDK_ActionHandler; class CPDFSDK_AnnotHandlerMgr; -class CPDFSDK_Document; +class CPDFSDK_InterForm; +class CPDFSDK_PageView; class IJS_Runtime; class CPDFSDK_FormFillEnvironment @@ -32,6 +34,68 @@ class CPDFSDK_FormFillEnvironment FPDF_FORMFILLINFO* pFFinfo); ~CPDFSDK_FormFillEnvironment(); + CPDFSDK_InterForm* GetInterForm(); + + // Gets the document object for the next layer down; for master this is + // a CPDF_Document, but for XFA it is a CPDFXFA_Document. + UnderlyingDocumentType* GetUnderlyingDocument() const { +#ifdef PDF_ENABLE_XFA + return GetXFADocument(); +#else // PDF_ENABLE_XFA + return GetPDFDocument(); +#endif // PDF_ENABLE_XFA + } + + // Gets the CPDF_Document, either directly in master, or from the + // CPDFXFA_Document for XFA. + CPDF_Document* GetPDFDocument() const { +#ifdef PDF_ENABLE_XFA + return m_pUnderlyingDoc ? m_pUnderlyingDoc->GetPDFDoc() : nullptr; +#else // PDF_ENABLE_XFA + return m_pUnderlyingDoc; +#endif // PDF_ENABLE_XFA + } + +#ifdef PDF_ENABLE_XFA + // Gets the XFA document directly (XFA-only). + CPDFXFA_Document* GetXFADocument() const { return m_pUnderlyingDoc; } + void ResetXFADocument() { m_pUnderlyingDoc = nullptr; } + + int GetPageViewCount() const { return m_pageMap.size(); } +#endif // PDF_ENABLE_XFA + + CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool ReNew); + CPDFSDK_PageView* GetPageView(int nIndex); + CPDFSDK_PageView* GetCurrentView(); + void RemovePageView(UnderlyingPageType* pPage); + void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); + + CPDFSDK_Annot* GetFocusAnnot() { return m_pFocusAnnot.Get(); } + FX_BOOL SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot); + FX_BOOL KillFocusAnnot(uint32_t nFlag); + void ClearAllFocusedAnnots(); + + FX_BOOL ExtractPages(const std::vector<uint16_t>& arrExtraPages, + CPDF_Document* pDstDoc); + FX_BOOL InsertPages(int nInsertAt, + const CPDF_Document* pSrcDoc, + const std::vector<uint16_t>& arrSrcPages); + FX_BOOL ReplacePages(int nPage, + const CPDF_Document* pSrcDoc, + const std::vector<uint16_t>& arrSrcPages); + + int GetPageCount() { return m_pUnderlyingDoc->GetPageCount(); } + FX_BOOL GetPermissions(int nFlag); + + FX_BOOL GetChangeMark() { return m_bChangeMask; } + void SetChangeMark() { m_bChangeMask = TRUE; } + void ClearChangeMark() { m_bChangeMask = FALSE; } + + UnderlyingPageType* GetPage(int nIndex); + + void ProcJavascriptFun(); + FX_BOOL ProcOpenAction(); + void Invalidate(FPDF_PAGE page, double left, double top, @@ -148,10 +212,6 @@ class CPDFSDK_FormFillEnvironment void JS_docgotoPage(int nPageNum); FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } - CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc.get(); } - UnderlyingDocumentType* GetUnderlyingDocument() const { - return m_pUnderlyingDoc; - } CFX_ByteString GetAppName() const { return ""; } CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } @@ -167,10 +227,14 @@ class CPDFSDK_FormFillEnvironment std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler; std::unique_ptr<IJS_Runtime> m_pJSRuntime; FPDF_FORMFILLINFO* const m_pInfo; - std::unique_ptr<CPDFSDK_Document> m_pSDKDoc; - UnderlyingDocumentType* const m_pUnderlyingDoc; + std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap; + std::unique_ptr<CPDFSDK_InterForm> m_pInterForm; + CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; + UnderlyingDocumentType* m_pUnderlyingDoc; std::unique_ptr<CFFL_InteractiveFormFiller> m_pFormFiller; std::unique_ptr<CFX_SystemHandler> m_pSysHandler; + FX_BOOL m_bChangeMask; + FX_BOOL m_bBeingDestroyed; }; #endif // FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_ |