From ccd9421589922b8f35ee5330d7fdac7edea081db Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 3 May 2018 13:53:02 +0000 Subject: Add CPDF_Page::Extension::GetDocExtension() In turn, add CPDF_Document::Extension::GetPDFDoc() so that we can use the abstract return type in more places. Mark an internal-only cpdfxfa_context method as private while we're at it. Change-Id: I08e64f4b9438bf2f731c3a37cf2a41152bbbd8fa Reviewed-on: https://pdfium-review.googlesource.com/31916 Commit-Queue: dsinclair Reviewed-by: dsinclair --- fpdfsdk/cpdfsdk_pageview.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'fpdfsdk/cpdfsdk_pageview.cpp') diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index e648e596c4..87856fb0f0 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -89,7 +89,8 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, if (!pPage) return; - if (pPage->GetContext()->GetFormType() == FormType::kXFAFull) { + auto* pContext = static_cast(pPage->GetDocumentExtension()); + if (pContext->GetFormType() == FormType::kXFAFull) { CFX_RectF rectClip( static_cast(pClip.left), static_cast(pClip.top), static_cast(pClip.Width()), static_cast(pClip.Height())); @@ -177,7 +178,11 @@ bool CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { return false; CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage(); - if (!pPage || !pPage->GetContext()->ContainsXFAForm()) + if (!pPage) + return false; + + auto* pContext = static_cast(pPage->GetDocumentExtension()); + if (!pContext->ContainsXFAForm()) return false; CPDFSDK_Annot::ObservedPtr pObserved(pAnnot); @@ -204,7 +209,7 @@ bool CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { CPDF_Document* CPDFSDK_PageView::GetPDFDocument() { if (m_page) { #ifdef PDF_ENABLE_XFA - return m_page->GetContext()->GetPDFDoc(); + return m_page->GetDocumentExtension()->GetPDFDoc(); #else // PDF_ENABLE_XFA return m_page->m_pDocument.Get(); #endif // PDF_ENABLE_XFA @@ -530,7 +535,9 @@ int CPDFSDK_PageView::GetPageIndex() const { return -1; #ifdef PDF_ENABLE_XFA - switch (m_page->GetContext()->GetFormType()) { + auto* pContext = + static_cast(m_page->GetDocumentExtension()); + switch (pContext->GetFormType()) { case FormType::kXFAFull: { CXFA_FFPageView* pPageView = m_page->GetXFAPageView(); return pPageView ? pPageView->GetPageIndex() : -1; -- cgit v1.2.3