summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_contentparser.cpp12
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.h2
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp4
-rw-r--r--core/fpdfdoc/cpdf_linklist.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_annotiterator.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp2
-rw-r--r--fpdfsdk/fpdf_annot.cpp20
-rw-r--r--fpdfsdk/fpdf_doc.cpp4
-rw-r--r--fpdfsdk/fpdf_editpage.cpp10
-rw-r--r--fpdfsdk/fpdf_flatten.cpp2
-rw-r--r--fpdfsdk/fpdf_formfill.cpp2
-rw-r--r--fpdfsdk/fpdf_structtree.cpp2
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp8
14 files changed, 41 insertions, 37 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index e9b134fa6b..107f54efdb 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -81,7 +81,7 @@ void CPDF_PageContentGenerator::GenerateContent() {
buf << "Q\n";
// Add buffer to a stream in page's 'Contents'
- CPDF_Dictionary* pPageDict = m_pObjHolder->m_pFormDict.Get();
+ CPDF_Dictionary* pPageDict = m_pObjHolder->GetFormDict();
CPDF_Object* pContent =
pPageDict ? pPageDict->GetObjectFor("Contents") : nullptr;
CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>();
@@ -128,7 +128,7 @@ ByteString CPDF_PageContentGenerator::RealizeResource(
ASSERT(dwResourceObjNum);
if (!m_pObjHolder->m_pResources) {
m_pObjHolder->m_pResources = m_pDocument->NewIndirect<CPDF_Dictionary>();
- m_pObjHolder->m_pFormDict->SetNewFor<CPDF_Reference>(
+ m_pObjHolder->GetFormDict()->SetNewFor<CPDF_Reference>(
"Resources", m_pDocument.Get(),
m_pObjHolder->m_pResources->GetObjNum());
}
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp
index dcdf138779..f558ac823a 100644
--- a/core/fpdfapi/page/cpdf_contentparser.cpp
+++ b/core/fpdfapi/page/cpdf_contentparser.cpp
@@ -24,12 +24,12 @@
CPDF_ContentParser::CPDF_ContentParser(CPDF_Page* pPage)
: m_InternalStage(STAGE_GETCONTENT), m_pObjectHolder(pPage) {
- if (!pPage || !pPage->GetDocument() || !pPage->m_pFormDict) {
+ if (!pPage || !pPage->GetDocument() || !pPage->GetFormDict()) {
m_bIsDone = true;
return;
}
- CPDF_Object* pContent = pPage->m_pFormDict->GetDirectObjectFor("Contents");
+ CPDF_Object* pContent = pPage->GetFormDict()->GetDirectObjectFor("Contents");
if (!pContent) {
m_bIsDone = true;
return;
@@ -61,11 +61,11 @@ CPDF_ContentParser::CPDF_ContentParser(CPDF_Form* pForm,
: m_InternalStage(STAGE_PARSE),
m_pObjectHolder(pForm),
m_pType3Char(pType3Char) {
- CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixFor("Matrix");
+ CFX_Matrix form_matrix = pForm->GetFormDict()->GetMatrixFor("Matrix");
if (pGraphicStates)
form_matrix.Concat(pGraphicStates->m_CTM);
- CPDF_Array* pBBox = pForm->m_pFormDict->GetArrayFor("BBox");
+ CPDF_Array* pBBox = pForm->GetFormDict()->GetArrayFor("BBox");
CFX_FloatRect form_bbox;
CPDF_Path ClipPath;
if (pBBox) {
@@ -82,7 +82,7 @@ CPDF_ContentParser::CPDF_ContentParser(CPDF_Form* pForm,
form_bbox = pParentMatrix->TransformRect(form_bbox);
}
- CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDictFor("Resources");
+ CPDF_Dictionary* pResources = pForm->GetFormDict()->GetDictFor("Resources");
m_pParser = pdfium::MakeUnique<CPDF_StreamContentParser>(
pForm->GetDocument(), pForm->m_pPageResources.Get(),
pForm->m_pResources.Get(), pParentMatrix, pForm, pResources, form_bbox,
@@ -144,7 +144,7 @@ bool CPDF_ContentParser::Continue(PauseIndicatorIface* pPause) {
m_CurrentOffset = 0;
} else {
CPDF_Array* pContent =
- m_pObjectHolder->m_pFormDict->GetArrayFor("Contents");
+ m_pObjectHolder->GetFormDict()->GetArrayFor("Contents");
CPDF_Stream* pStreamObj = ToStream(
pContent ? pContent->GetDirectObjectAt(m_CurrentOffset) : nullptr);
m_StreamArray[m_CurrentOffset] =
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h
index 54c4f2b063..b26fc0d0e2 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.h
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.h
@@ -87,7 +87,6 @@ class CPDF_PageObjectHolder {
void Transform(const CFX_Matrix& matrix);
CFX_FloatRect CalcBoundingBox() const;
- const UnownedPtr<CPDF_Dictionary> m_pFormDict;
UnownedPtr<CPDF_Stream> m_pFormStream;
UnownedPtr<CPDF_Dictionary> m_pPageResources;
UnownedPtr<CPDF_Dictionary> m_pResources;
@@ -99,6 +98,7 @@ class CPDF_PageObjectHolder {
void LoadTransInfo();
+ const UnownedPtr<CPDF_Dictionary> m_pFormDict;
UnownedPtr<CPDF_Document> m_pDocument;
CFX_FloatRect m_BBox;
int m_iTransparency = 0;
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 6bf72fd5ef..0c548d8e0b 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -815,7 +815,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
const CFX_PointF& point,
int* z_order) const {
- CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayFor("Annots");
+ CPDF_Array* pAnnotList = pPage->GetFormDict()->GetArrayFor("Annots");
if (!pAnnotList)
return nullptr;
@@ -964,7 +964,7 @@ bool CPDF_InterForm::HasXFAForm() const {
}
void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
- CPDF_Dictionary* pPageDict = pPage->m_pFormDict.Get();
+ const CPDF_Dictionary* pPageDict = pPage->GetFormDict();
if (!pPageDict)
return;
diff --git a/core/fpdfdoc/cpdf_linklist.cpp b/core/fpdfdoc/cpdf_linklist.cpp
index 0620dbf32b..2f5d4aee3e 100644
--- a/core/fpdfdoc/cpdf_linklist.cpp
+++ b/core/fpdfdoc/cpdf_linklist.cpp
@@ -15,7 +15,7 @@ CPDF_LinkList::~CPDF_LinkList() {}
const std::vector<CPDF_Dictionary*>* CPDF_LinkList::GetPageLinks(
CPDF_Page* pPage) {
- uint32_t objnum = pPage->m_pFormDict->GetObjNum();
+ uint32_t objnum = pPage->GetFormDict()->GetObjNum();
if (objnum == 0)
return nullptr;
@@ -55,7 +55,7 @@ CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage,
void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage,
std::vector<CPDF_Dictionary*>* pList) {
- CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayFor("Annots");
+ CPDF_Array* pAnnotList = pPage->GetFormDict()->GetArrayFor("Annots");
if (!pAnnotList)
return;
diff --git a/fpdfsdk/cpdfsdk_annotiterator.cpp b/fpdfsdk/cpdfsdk_annotiterator.cpp
index 1c168454fe..fbba3d5f01 100644
--- a/fpdfsdk/cpdfsdk_annotiterator.cpp
+++ b/fpdfsdk/cpdfsdk_annotiterator.cpp
@@ -34,7 +34,7 @@ CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView,
m_pPageView(pPageView),
m_nAnnotSubtype(nAnnotSubtype) {
CPDF_Page* pPDFPage = m_pPageView->GetPDFPage();
- ByteString sTabs = pPDFPage->m_pFormDict->GetStringFor("Tabs");
+ ByteString sTabs = pPDFPage->GetFormDict()->GetStringFor("Tabs");
if (sTabs == "R")
m_eTabOrder = ROW;
else if (sTabs == "C")
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 08d1b8d1f0..2eab6ca32b 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -575,7 +575,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() {
}
int CPDFSDK_PageView::GetPageIndexForStaticPDF() const {
- CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict.Get();
+ const CPDF_Dictionary* pDict = GetPDFPage()->GetFormDict();
CPDF_Document* pDoc = m_pFormFillEnv->GetPDFDocument();
return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1;
}
diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
index 3aca16334b..d3bf38d315 100644
--- a/fpdfsdk/fpdf_annot.cpp
+++ b/fpdfsdk/fpdf_annot.cpp
@@ -229,9 +229,9 @@ FPDFPage_CreateAnnot(FPDF_PAGE page, FPDF_ANNOTATION_SUBTYPE subtype) {
auto pNewAnnot =
pdfium::MakeUnique<CPDF_AnnotContext>(pDict.get(), pPage, nullptr);
- CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayFor("Annots");
+ CPDF_Array* pAnnotList = pPage->GetFormDict()->GetArrayFor("Annots");
if (!pAnnotList)
- pAnnotList = pPage->m_pFormDict->SetNewFor<CPDF_Array>("Annots");
+ pAnnotList = pPage->GetFormDict()->SetNewFor<CPDF_Array>("Annots");
pAnnotList->Add(std::move(pDict));
// Caller takes ownership.
@@ -240,20 +240,20 @@ FPDFPage_CreateAnnot(FPDF_PAGE page, FPDF_ANNOTATION_SUBTYPE subtype) {
FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotCount(FPDF_PAGE page) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
- if (!pPage || !pPage->m_pFormDict)
+ if (!pPage || !pPage->GetFormDict())
return 0;
- CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots");
+ CPDF_Array* pAnnots = pPage->GetFormDict()->GetArrayFor("Annots");
return pAnnots ? pAnnots->GetCount() : 0;
}
FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV FPDFPage_GetAnnot(FPDF_PAGE page,
int index) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
- if (!pPage || !pPage->m_pFormDict || index < 0)
+ if (!pPage || !pPage->GetFormDict() || index < 0)
return nullptr;
- CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots");
+ CPDF_Array* pAnnots = pPage->GetFormDict()->GetArrayFor("Annots");
if (!pAnnots || static_cast<size_t>(index) >= pAnnots->GetCount())
return nullptr;
@@ -268,10 +268,10 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotIndex(FPDF_PAGE page,
FPDF_ANNOTATION annot) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
CPDF_AnnotContext* pAnnot = CPDFAnnotContextFromFPDFAnnotation(annot);
- if (!pPage || !pPage->m_pFormDict || !pAnnot || !pAnnot->GetAnnotDict())
+ if (!pPage || !pPage->GetFormDict() || !pAnnot || !pAnnot->GetAnnotDict())
return -1;
- CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots");
+ CPDF_Array* pAnnots = pPage->GetFormDict()->GetArrayFor("Annots");
if (!pAnnots)
return -1;
@@ -295,10 +295,10 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_CloseAnnot(FPDF_ANNOTATION annot) {
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_RemoveAnnot(FPDF_PAGE page,
int index) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
- if (!pPage || !pPage->m_pFormDict || index < 0)
+ if (!pPage || !pPage->GetFormDict() || index < 0)
return false;
- CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots");
+ CPDF_Array* pAnnots = pPage->GetFormDict()->GetArrayFor("Annots");
if (!pAnnots || static_cast<size_t>(index) >= pAnnots->GetCount())
return false;
diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp
index 3e8f436f2f..3bb89fc48a 100644
--- a/fpdfsdk/fpdf_doc.cpp
+++ b/fpdfsdk/fpdf_doc.cpp
@@ -339,9 +339,9 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page,
if (!start_pos || !link_annot)
return false;
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
- if (!pPage || !pPage->m_pFormDict)
+ if (!pPage || !pPage->GetFormDict())
return false;
- CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots");
+ CPDF_Array* pAnnots = pPage->GetFormDict()->GetArrayFor("Annots");
if (!pAnnots)
return false;
for (size_t i = *start_pos; i < pAnnots->GetCount(); i++) {
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 3f1098c371..19c301bf12 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -55,10 +55,14 @@ static_assert(FPDF_PAGEOBJ_FORM == CPDF_PageObject::FORM,
"FPDF_PAGEOBJ_FORM/CPDF_PageObject::FORM mismatch");
bool IsPageObject(CPDF_Page* pPage) {
- if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type"))
+ if (!pPage)
+ return false;
+
+ const CPDF_Dictionary* pFormDict = pPage->GetFormDict();
+ if (!pFormDict || !pFormDict->KeyExist("Type"))
return false;
- CPDF_Object* pObject = pPage->m_pFormDict->GetObjectFor("Type")->GetDirect();
+ const CPDF_Object* pObject = pFormDict->GetObjectFor("Type")->GetDirect();
return pObject && !pObject->GetString().Compare("Page");
}
@@ -479,7 +483,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetRotation(FPDF_PAGE page,
return;
rotate %= 4;
- pPage->m_pFormDict->SetNewFor<CPDF_Number>("Rotate", rotate * 90);
+ pPage->GetFormDict()->SetNewFor<CPDF_Number>("Rotate", rotate * 90);
}
FPDF_BOOL FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object,
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index b8c3f2c146..03a4f60b5c 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -240,7 +240,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
return FLATTEN_FAIL;
CPDF_Document* pDocument = pPage->GetDocument();
- CPDF_Dictionary* pPageDict = pPage->m_pFormDict.Get();
+ CPDF_Dictionary* pPageDict = pPage->GetFormDict();
if (!pDocument || !pPageDict)
return FLATTEN_FAIL;
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index d604bd0eb0..a3a471c1f8 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -649,7 +649,7 @@ FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page,
return;
CPDFSDK_ActionHandler* pActionHandler = pFormFillEnv->GetActionHandler();
- CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict.Get();
+ CPDF_Dictionary* pPageDict = pPDFPage->GetFormDict();
if (!pPageDict)
return;
diff --git a/fpdfsdk/fpdf_structtree.cpp b/fpdfsdk/fpdf_structtree.cpp
index 99fc302490..d39f8084c2 100644
--- a/fpdfsdk/fpdf_structtree.cpp
+++ b/fpdfsdk/fpdf_structtree.cpp
@@ -37,7 +37,7 @@ FPDF_StructTree_GetForPage(FPDF_PAGE page) {
// Caller takes onwership.
return FPDFStructTreeFromCPDFStructTree(
- CPDF_StructTree::LoadPage(pPage->GetDocument(), pPage->m_pFormDict.Get())
+ CPDF_StructTree::LoadPage(pPage->GetDocument(), pPage->GetFormDict())
.release());
}
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 5d4199c69c..9d541da0cd 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -27,7 +27,7 @@ namespace {
void SetBoundingBox(CPDF_Page* page,
const ByteString& key,
const CFX_FloatRect& rect) {
- page->m_pFormDict->SetRectFor(key, rect);
+ page->GetFormDict()->SetRectFor(key, rect);
}
bool GetBoundingBox(CPDF_Page* page,
@@ -36,7 +36,7 @@ bool GetBoundingBox(CPDF_Page* page,
float* bottom,
float* right,
float* top) {
- CPDF_Array* pArray = page->m_pFormDict->GetArrayFor(key);
+ CPDF_Array* pArray = page->GetFormDict()->GetArrayFor(key);
if (!pArray)
return false;
@@ -121,7 +121,7 @@ FPDFPage_TransFormWithClip(FPDF_PAGE page,
matrix->c, matrix->d, matrix->e, matrix->f);
}
- CPDF_Dictionary* pPageDict = pPage->m_pFormDict.Get();
+ CPDF_Dictionary* pPageDict = pPage->GetFormDict();
CPDF_Object* pContentObj = GetPageContent(pPageDict);
if (!pContentObj)
return false;
@@ -264,7 +264,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page,
if (!pPage)
return;
- CPDF_Dictionary* pPageDict = pPage->m_pFormDict.Get();
+ CPDF_Dictionary* pPageDict = pPage->GetFormDict();
CPDF_Object* pContentObj = GetPageContent(pPageDict);
if (!pContentObj)
return;