From da8063f087c379bfd286624338d31a112cae5ba4 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 30 Apr 2018 17:41:49 +0000 Subject: Make CPDFSDK_FormFillEnvironment always hold a CPDF_Document. Small step towards removing UnderlyingDocumentType and making FPDF documents always be CPDF documents, regardless of XFA. This improves layering a bit in the process. Change-Id: Ice5ed7ba1ffdd7edfc9c4719f0e3a9cfb22f5790 Reviewed-on: https://pdfium-review.googlesource.com/31672 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- fpdfsdk/cpdfsdk_formfillenvironment.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'fpdfsdk/cpdfsdk_formfillenvironment.h') diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h index aba3f39c69..8baa5848fd 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.h +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -47,8 +47,7 @@ FPDF_WIDESTRING AsFPDFWideString(ByteString* bsUTF16LE); class CPDFSDK_FormFillEnvironment : public Observable { public: - CPDFSDK_FormFillEnvironment(UnderlyingDocumentType* pDoc, - FPDF_FORMFILLINFO* pFFinfo); + CPDFSDK_FormFillEnvironment(CPDF_Document* pDoc, FPDF_FORMFILLINFO* pFFinfo); ~CPDFSDK_FormFillEnvironment(); static bool IsSHIFTKeyDown(uint32_t nFlag) { @@ -112,16 +111,10 @@ class CPDFSDK_FormFillEnvironment float* fPosArray, int sizeOfArray); - UnderlyingDocumentType* GetUnderlyingDocument() const { - return m_pUnderlyingDoc.Get(); - } + CPDF_Document* GetPDFDocument() const { return m_pCPDFDoc.Get(); } #ifdef PDF_ENABLE_XFA - CPDF_Document* GetPDFDocument() const; - - CPDFXFA_Context* GetXFAContext() const { return m_pUnderlyingDoc.Get(); } - void ResetXFADocument() { m_pUnderlyingDoc = nullptr; } - + CPDFXFA_Context* GetXFAContext() const; int GetPageViewCount() const { return m_PageMap.size(); } void DisplayCaret(CPDFXFA_Page* page, @@ -169,8 +162,6 @@ class CPDFSDK_FormFillEnvironment WideString GetLanguage(); void PageEvent(int iPageCount, uint32_t dwEventType) const; -#else // PDF_ENABLE_XFA - CPDF_Document* GetPDFDocument() const { return m_pUnderlyingDoc.Get(); } #endif // PDF_ENABLE_XFA int JS_appAlert(const WideString& Msg, @@ -228,7 +219,7 @@ class CPDFSDK_FormFillEnvironment std::map> m_PageMap; std::unique_ptr m_pInterForm; CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; - UnownedPtr m_pUnderlyingDoc; + UnownedPtr const m_pCPDFDoc; std::unique_ptr m_pFormFiller; std::unique_ptr m_pSysHandler; bool m_bChangeMask; -- cgit v1.2.3