From 8f63763317ae1ef65d1ac2719624adeb728f2207 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 7 May 2018 23:36:26 +0000 Subject: Make more CPDF_PageObjectHolder members protected. Change-Id: Id31b9f6ac33971c47cdb378ff7f9ca7d33f899b9 Reviewed-on: https://pdfium-review.googlesource.com/32112 Commit-Queue: Lei Zhang Reviewed-by: dsinclair --- core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 2 +- core/fpdfapi/page/cpdf_contentparser.cpp | 8 ++++---- core/fpdfapi/page/cpdf_pageobjectholder.h | 4 ++-- fpdfsdk/cpdf_annotcontext.cpp | 2 +- fpdfsdk/cpdfsdk_pageview.cpp | 2 +- fpdfsdk/cpdfsdk_widgethandler.cpp | 2 +- fpdfsdk/formfiller/cba_fontmap.cpp | 2 +- fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 2 +- fpdfsdk/fpdf_annot.cpp | 8 ++++---- fpdfsdk/fpdf_doc.cpp | 2 +- fpdfsdk/fpdf_editimg.cpp | 4 ++-- fpdfsdk/fpdf_flatten.cpp | 2 +- fpdfsdk/fpdf_formfill.cpp | 6 +++--- fpdfsdk/fpdf_structtree.cpp | 3 +-- fpdfsdk/fpdf_text.cpp | 2 +- fpdfsdk/fpdf_transformpage.cpp | 4 ++-- fpdfsdk/fpdf_view.cpp | 2 +- 17 files changed, 28 insertions(+), 29 deletions(-) diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 92b92ecf01..e9b134fa6b 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -52,7 +52,7 @@ bool GetColor(const CPDF_Color* pColor, float* rgb) { CPDF_PageContentGenerator::CPDF_PageContentGenerator( CPDF_PageObjectHolder* pObjHolder) - : m_pObjHolder(pObjHolder), m_pDocument(pObjHolder->m_pDocument.Get()) { + : m_pObjHolder(pObjHolder), m_pDocument(pObjHolder->GetDocument()) { for (const auto& pObj : *pObjHolder->GetPageObjectList()) { if (pObj) m_pageObjects.emplace_back(pObj.get()); diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index 0b11da5554..dcdf138779 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -24,7 +24,7 @@ CPDF_ContentParser::CPDF_ContentParser(CPDF_Page* pPage) : m_InternalStage(STAGE_GETCONTENT), m_pObjectHolder(pPage) { - if (!pPage || !pPage->m_pDocument || !pPage->m_pFormDict) { + if (!pPage || !pPage->GetDocument() || !pPage->m_pFormDict) { m_bIsDone = true; return; } @@ -84,7 +84,7 @@ CPDF_ContentParser::CPDF_ContentParser(CPDF_Form* pForm, CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDictFor("Resources"); m_pParser = pdfium::MakeUnique( - pForm->m_pDocument.Get(), pForm->m_pPageResources.Get(), + pForm->GetDocument(), pForm->m_pPageResources.Get(), pForm->m_pResources.Get(), pParentMatrix, pForm, pResources, form_bbox, pGraphicStates, parsedSet); m_pParser->GetCurStates()->m_CTM = form_matrix; @@ -157,10 +157,10 @@ bool CPDF_ContentParser::Continue(PauseIndicatorIface* pPause) { if (!m_pParser) { m_parsedSet = pdfium::MakeUnique>(); m_pParser = pdfium::MakeUnique( - m_pObjectHolder->m_pDocument.Get(), + m_pObjectHolder->GetDocument(), m_pObjectHolder->m_pPageResources.Get(), nullptr, nullptr, m_pObjectHolder.Get(), m_pObjectHolder->m_pResources.Get(), - m_pObjectHolder->m_BBox, nullptr, m_parsedSet.get()); + m_pObjectHolder->GetBBox(), nullptr, m_parsedSet.get()); m_pParser->GetCurStates()->m_ColorState.SetDefault(); } if (m_CurrentOffset >= m_Size) { diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h index 98cd97adb2..54c4f2b063 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.h +++ b/core/fpdfapi/page/cpdf_pageobjectholder.h @@ -89,18 +89,18 @@ class CPDF_PageObjectHolder { const UnownedPtr m_pFormDict; UnownedPtr m_pFormStream; - UnownedPtr m_pDocument; UnownedPtr m_pPageResources; UnownedPtr m_pResources; std::map m_GraphicsMap; std::map m_FontsMap; - CFX_FloatRect m_BBox; protected: enum ParseState { CONTENT_NOT_PARSED, CONTENT_PARSING, CONTENT_PARSED }; void LoadTransInfo(); + UnownedPtr m_pDocument; + CFX_FloatRect m_BBox; int m_iTransparency = 0; bool m_bBackgroundAlphaNeeded = false; std::vector m_MaskBoundingBoxes; diff --git a/fpdfsdk/cpdf_annotcontext.cpp b/fpdfsdk/cpdf_annotcontext.cpp index d76d5d2f8c..20c5fc343e 100644 --- a/fpdfsdk/cpdf_annotcontext.cpp +++ b/fpdfsdk/cpdf_annotcontext.cpp @@ -30,6 +30,6 @@ void CPDF_AnnotContext::SetForm(CPDF_Stream* pStream) { pStream->GetDict()->SetMatrixFor("Matrix", CFX_Matrix()); m_pAnnotForm = pdfium::MakeUnique( - m_pPage->m_pDocument.Get(), m_pPage->m_pResources.Get(), pStream); + m_pPage->GetDocument(), m_pPage->m_pResources.Get(), pStream); m_pAnnotForm->ParseContent(); } diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index 87856fb0f0..08d1b8d1f0 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -211,7 +211,7 @@ CPDF_Document* CPDFSDK_PageView::GetPDFDocument() { #ifdef PDF_ENABLE_XFA return m_page->GetDocumentExtension()->GetPDFDoc(); #else // PDF_ENABLE_XFA - return m_page->m_pDocument.Get(); + return m_page->GetDocument(); #endif // PDF_ENABLE_XFA } return nullptr; diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp index 17d783fcbe..a21063d55e 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.cpp +++ b/fpdfsdk/cpdfsdk_widgethandler.cpp @@ -47,7 +47,7 @@ bool CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { return true; CPDF_Page* pPage = pWidget->GetPDFPage(); - uint32_t dwPermissions = pPage->m_pDocument->GetUserPermissions(); + uint32_t dwPermissions = pPage->GetDocument()->GetUserPermissions(); return (dwPermissions & FPDFPERM_FILL_FORM) || (dwPermissions & FPDFPERM_ANNOT_FORM); } diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index 2e11fa8908..6b31de7b37 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -28,7 +28,7 @@ CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, m_sAPType("N") { CPDF_Page* pPage = pAnnot->GetPDFPage(); - m_pDocument = pPage->m_pDocument.Get(); + m_pDocument = pPage->GetDocument(); m_pAnnotDict = pAnnot->GetPDFAnnot()->GetAnnotDict(); Initialize(); } diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 6b34ca3ae2..3db7aa9ab9 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -459,7 +459,7 @@ bool CFFL_InteractiveFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { return false; CPDF_Page* pPage = pWidget->GetPDFPage(); - uint32_t dwPermissions = pPage->m_pDocument->GetUserPermissions(); + uint32_t dwPermissions = pPage->GetDocument()->GetUserPermissions(); return (dwPermissions & FPDFPERM_FILL_FORM) || (dwPermissions & FPDFPERM_ANNOT_FORM) || (dwPermissions & FPDFPERM_MODIFY); diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp index 0dbad498ce..3aca16334b 100644 --- a/fpdfsdk/fpdf_annot.cpp +++ b/fpdfsdk/fpdf_annot.cpp @@ -221,7 +221,7 @@ FPDFPage_CreateAnnot(FPDF_PAGE page, FPDF_ANNOTATION_SUBTYPE subtype) { return nullptr; auto pDict = pdfium::MakeUnique( - pPage->m_pDocument->GetByteStringPool()); + pPage->GetDocument()->GetByteStringPool()); pDict->SetNewFor("Type", "Annot"); pDict->SetNewFor("Subtype", CPDF_Annot::AnnotSubtypeToString( @@ -380,7 +380,7 @@ FPDFAnnot_AppendObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj) { CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(pAnnot->GetAnnotDict(), CPDF_Annot::AppearanceMode::Normal); if (!pStream) { - CPVT_GenerateAP::GenerateEmptyAP(pPage->m_pDocument.Get(), pAnnotDict); + CPVT_GenerateAP::GenerateEmptyAP(pPage->GetDocument(), pAnnotDict); pStream = FPDFDOC_GetAnnotAP(pAnnotDict, CPDF_Annot::AppearanceMode::Normal); if (!pStream) @@ -873,7 +873,7 @@ FPDFAnnot_GetFormFieldFlags(FPDF_PAGE page, FPDF_ANNOTATION annot) { if (!pAnnotDict) return FPDF_FORMFLAG_NONE; - CPDF_InterForm interform(pPage->m_pDocument.Get()); + CPDF_InterForm interform(pPage->GetDocument()); CPDF_FormField* pFormField = interform.GetFieldByDict(pAnnotDict); return pFormField ? pFormField->GetFieldFlags() : FPDF_FORMFLAG_NONE; } @@ -887,7 +887,7 @@ FPDFAnnot_GetFormFieldAtPoint(FPDF_FORMHANDLE hHandle, if (!hHandle || !pPage) return nullptr; - CPDF_InterForm interform(pPage->m_pDocument.Get()); + CPDF_InterForm interform(pPage->GetDocument()); int annot_index = -1; CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( pPage, CFX_PointF(static_cast(page_x), static_cast(page_y)), diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp index 17cfce0b24..3e8f436f2f 100644 --- a/fpdfsdk/fpdf_doc.cpp +++ b/fpdfsdk/fpdf_doc.cpp @@ -54,7 +54,7 @@ CPDF_LinkList* GetLinkList(CPDF_Page* page) { if (!page) return nullptr; - CPDF_Document* pDoc = page->m_pDocument.Get(); + CPDF_Document* pDoc = page->GetDocument(); std::unique_ptr* pHolder = pDoc->LinksContext(); if (!pHolder->get()) *pHolder = pdfium::MakeUnique(); diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp index 9485a75002..fed1581e2d 100644 --- a/fpdfsdk/fpdf_editimg.cpp +++ b/fpdfsdk/fpdf_editimg.cpp @@ -305,12 +305,12 @@ FPDFImageObj_GetImageMetadata(FPDF_PAGEOBJECT image_object, metadata->colorspace = FPDF_COLORSPACE_UNKNOWN; CPDF_Page* pPage = CPDFPageFromFPDFPage(page); - if (!pPage || !pPage->m_pDocument.Get() || !pImg->GetStream()) + if (!pPage || !pPage->GetDocument() || !pImg->GetStream()) return true; auto pSource = pdfium::MakeRetain(); CPDF_DIBSource::LoadState ret = pSource->StartLoadDIBSource( - pPage->m_pDocument.Get(), pImg->GetStream(), false, nullptr, + pPage->GetDocument(), pImg->GetStream(), false, nullptr, pPage->m_pPageResources.Get()); if (ret == CPDF_DIBSource::LoadState::kFail) return true; diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index f1d95c7d7e..b8c3f2c146 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -239,7 +239,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { if (!page) return FLATTEN_FAIL; - CPDF_Document* pDocument = pPage->m_pDocument.Get(); + CPDF_Document* pDocument = pPage->GetDocument(); CPDF_Dictionary* pPageDict = pPage->m_pFormDict.Get(); if (!pDocument || !pPageDict) return FLATTEN_FAIL; diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp index c92fc7b718..d604bd0eb0 100644 --- a/fpdfsdk/fpdf_formfill.cpp +++ b/fpdfsdk/fpdf_formfill.cpp @@ -184,7 +184,7 @@ void FFLCommon(FPDF_FORMHANDLE hHandle, pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, rect); #else // PDF_ENABLE_XFA options.SetOCContext(pdfium::MakeRetain( - pPage->m_pDocument.Get(), CPDF_OCContext::View)); + pPage->GetDocument(), CPDF_OCContext::View)); if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, FPDFPageFromUnderlying(pPage))) pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); @@ -207,7 +207,7 @@ FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, return -1; CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (pPage) { - CPDF_InterForm interform(pPage->m_pDocument.Get()); + CPDF_InterForm interform(pPage->GetDocument()); CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( pPage, CFX_PointF(static_cast(page_x), static_cast(page_y)), @@ -269,7 +269,7 @@ FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage) return -1; - CPDF_InterForm interform(pPage->m_pDocument.Get()); + CPDF_InterForm interform(pPage->GetDocument()); int z_order = -1; (void)interform.GetControlAtPoint( pPage, CFX_PointF(static_cast(page_x), static_cast(page_y)), diff --git a/fpdfsdk/fpdf_structtree.cpp b/fpdfsdk/fpdf_structtree.cpp index 027695e36d..99fc302490 100644 --- a/fpdfsdk/fpdf_structtree.cpp +++ b/fpdfsdk/fpdf_structtree.cpp @@ -37,8 +37,7 @@ FPDF_StructTree_GetForPage(FPDF_PAGE page) { // Caller takes onwership. return FPDFStructTreeFromCPDFStructTree( - CPDF_StructTree::LoadPage(pPage->m_pDocument.Get(), - pPage->m_pFormDict.Get()) + CPDF_StructTree::LoadPage(pPage->GetDocument(), pPage->m_pFormDict.Get()) .release()); } diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp index edca0669ab..a1bbbb4a7a 100644 --- a/fpdfsdk/fpdf_text.cpp +++ b/fpdfsdk/fpdf_text.cpp @@ -45,7 +45,7 @@ FPDF_EXPORT FPDF_TEXTPAGE FPDF_CALLCONV FPDFText_LoadPage(FPDF_PAGE page) { auto* pContext = static_cast(pPage->GetDocumentExtension()); CPDF_ViewerPreferences viewRef(pContext->GetPDFDoc()); #else // PDF_ENABLE_XFA - CPDF_ViewerPreferences viewRef(pPDFPage->m_pDocument.Get()); + CPDF_ViewerPreferences viewRef(pPDFPage->GetDocument()); #endif // PDF_ENABLE_XFA CPDF_TextPage* textpage = new CPDF_TextPage( diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index 6706a18354..5d4199c69c 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -126,7 +126,7 @@ FPDFPage_TransFormWithClip(FPDF_PAGE page, if (!pContentObj) return false; - CPDF_Document* pDoc = pPage->m_pDocument.Get(); + CPDF_Document* pDoc = pPage->GetDocument(); if (!pDoc) return false; @@ -284,7 +284,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page, strClip << "W* n\n"; } } - CPDF_Document* pDoc = pPage->m_pDocument.Get(); + CPDF_Document* pDoc = pPage->GetDocument(); if (!pDoc) return; diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index f4a761000b..919690f9eb 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -111,7 +111,7 @@ void RenderPageImpl(CPDF_PageRenderContext* pContext, const CPDF_OCContext::UsageType usage = (flags & FPDF_PRINTING) ? CPDF_OCContext::Print : CPDF_OCContext::View; pContext->m_pOptions->SetOCContext( - pdfium::MakeRetain(pPage->m_pDocument.Get(), usage)); + pdfium::MakeRetain(pPage->GetDocument(), usage)); pContext->m_pDevice->SaveState(); pContext->m_pDevice->SetClip_Rect(clipping_rect); -- cgit v1.2.3