summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-16 17:15:32 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-16 17:15:32 -0800
commit32c70815316672091946be88e5941089c359d151 (patch)
tree5c09a48725bb43b07d09a435f38ead6a933e1712 /fpdfsdk
parent4e44b4049bd4790bcb6c835455632c81c34e78b6 (diff)
downloadpdfium-32c70815316672091946be88e5941089c359d151.tar.xz
Split CPDF_PageObjectHolder off from CPDF_PageObjectList
Eventually, we're going to expose an iterator over CPDF_PageObjectList that we don't want to be inherited by the CPDF_PageObjectHolder sub-classes: page and form. Also, the operations that the object holder performs dealing with inquiring about masks and such seem beyond the scope of what a list would provide. Hence the "Holder" name. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1701073002 .
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/include/fxedit/fx_edit.h8
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Edit.h4
-rw-r--r--fpdfsdk/src/fpdf_flatten.cpp5
-rw-r--r--fpdfsdk/src/fpdfeditpage.cpp8
-rw-r--r--fpdfsdk/src/fxedit/fxet_pageobjs.cpp33
-rw-r--r--fpdfsdk/src/javascript/Document.cpp13
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Edit.cpp4
7 files changed, 38 insertions, 37 deletions
diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h
index 59ac2b13ba..359f7d85e1 100644
--- a/fpdfsdk/include/fxedit/fx_edit.h
+++ b/fpdfsdk/include/fxedit/fx_edit.h
@@ -14,7 +14,7 @@
class CFX_RenderDevice;
class CPDF_Font;
class CFX_Matrix;
-class CPDF_PageObjectList;
+class CPDF_PageObjectHolder;
class CPDF_Point;
class CPDF_TextObject;
class IFX_Edit;
@@ -458,19 +458,19 @@ class IFX_Edit {
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange);
static void GeneratePageObjects(
- CPDF_PageObjectList* pPageObjects,
+ CPDF_PageObjectHolder* pPageObjects,
IFX_Edit* pEdit,
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange,
FX_COLORREF crText,
CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
static void GenerateRichPageObjects(
- CPDF_PageObjectList* pPageObjects,
+ CPDF_PageObjectHolder* pPageObjects,
IFX_Edit* pEdit,
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange,
CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
- static void GenerateUnderlineObjects(CPDF_PageObjectList* pPageObjects,
+ static void GenerateUnderlineObjects(CPDF_PageObjectHolder* pPageObjects,
IFX_Edit* pEdit,
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange,
diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h
index 7885331bc7..4b3411b772 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Edit.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h
@@ -110,10 +110,10 @@ class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify {
m_pFillerNotify = pNotify;
}
- void GeneratePageObjects(CPDF_PageObjectList* pPageObjects,
+ void GeneratePageObjects(CPDF_PageObjectHolder* pPageObjects,
const CPDF_Point& ptOffset,
CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
- void GeneratePageObjects(CPDF_PageObjectList* pPageObjects,
+ void GeneratePageObjects(CPDF_PageObjectHolder* pPageObjects,
const CPDF_Point& ptOffset);
protected:
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp
index 413b391eee..36b8319dca 100644
--- a/fpdfsdk/src/fpdf_flatten.cpp
+++ b/fpdfsdk/src/fpdf_flatten.cpp
@@ -42,9 +42,10 @@ FX_BOOL GetContentsRect(CPDF_Document* pDoc,
pPDFPage->Load(pDoc, pDict, FALSE);
pPDFPage->ParseContent(nullptr);
- FX_POSITION pos = pPDFPage->GetFirstObjectPosition();
+ FX_POSITION pos = pPDFPage->GetPageObjectList()->GetHeadPosition();
while (pos) {
- CPDF_PageObject* pPageObject = pPDFPage->GetNextObject(pos);
+ CPDF_PageObject* pPageObject =
+ pPDFPage->GetPageObjectList()->GetNextObject(pos);
if (!pPageObject)
continue;
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index f964172d10..6d39cb100f 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -135,9 +135,9 @@ DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj;
if (!pPageObj)
return;
- FX_POSITION LastPersition = pPage->GetLastObjectPosition();
+ FX_POSITION LastPersition = pPage->GetPageObjectList()->GetTailPosition();
- pPage->InsertObject(LastPersition, pPageObj);
+ pPage->GetPageObjectList()->InsertObject(LastPersition, pPageObj);
switch (pPageObj->m_Type) {
case FPDF_PAGEOBJ_PATH: {
CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj;
@@ -177,7 +177,7 @@ DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) {
"Page")) {
return -1;
}
- return pPage->CountObjects();
+ return pPage->GetPageObjectList()->GetCount();
}
DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page,
@@ -188,7 +188,7 @@ DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page,
"Page")) {
return NULL;
}
- return pPage->GetObjectByIndex(index);
+ return pPage->GetPageObjectList()->GetObjectByIndex(index);
}
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page) {
diff --git a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp
index 6cdcc84991..d54e4649db 100644
--- a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp
+++ b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp
@@ -409,7 +409,7 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice,
pDevice->RestoreState();
}
-static void AddRectToPageObjects(CPDF_PageObjectList* pPageObjs,
+static void AddRectToPageObjects(CPDF_PageObjectHolder* pPageObjs,
FX_COLORREF crFill,
const CPDF_Rect& rcFill) {
CPDF_PathObject* pPathObj = new CPDF_PathObject;
@@ -425,18 +425,19 @@ static void AddRectToPageObjects(CPDF_PageObjectList* pPageObjs,
pPathObj->m_FillType = FXFILL_ALTERNATE;
pPathObj->m_bStroke = FALSE;
-
- pPageObjs->InsertObject(pPageObjs->GetLastObjectPosition(), pPathObj);
+ pPageObjs->GetPageObjectList()->InsertObject(
+ pPageObjs->GetPageObjectList()->GetTailPosition(), pPathObj);
}
-static CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectList* pPageObjs,
- FX_COLORREF crText,
- CPDF_Font* pFont,
- FX_FLOAT fFontSize,
- FX_FLOAT fCharSpace,
- int32_t nHorzScale,
- const CPDF_Point& point,
- const CFX_ByteString& text) {
+static CPDF_TextObject* AddTextObjToPageObjects(
+ CPDF_PageObjectHolder* pPageObjs,
+ FX_COLORREF crText,
+ CPDF_Font* pFont,
+ FX_FLOAT fFontSize,
+ FX_FLOAT fCharSpace,
+ int32_t nHorzScale,
+ const CPDF_Point& point,
+ const CFX_ByteString& text) {
CPDF_TextObject* pTxtObj = new CPDF_TextObject;
CPDF_TextStateData* pTextStateData = pTxtObj->m_TextState.GetModify();
@@ -461,14 +462,14 @@ static CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectList* pPageObjs,
pTxtObj->SetPosition(point.x, point.y);
pTxtObj->SetText(text);
-
- pPageObjs->InsertObject(pPageObjs->GetLastObjectPosition(), pTxtObj);
+ pPageObjs->GetPageObjectList()->InsertObject(
+ pPageObjs->GetPageObjectList()->GetTailPosition(), pTxtObj);
return pTxtObj;
}
void IFX_Edit::GeneratePageObjects(
- CPDF_PageObjectList* pPageObjects,
+ CPDF_PageObjectHolder* pPageObjects,
IFX_Edit* pEdit,
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange,
@@ -532,7 +533,7 @@ void IFX_Edit::GeneratePageObjects(
}
void IFX_Edit::GenerateRichPageObjects(
- CPDF_PageObjectList* pPageObjects,
+ CPDF_PageObjectHolder* pPageObjects,
IFX_Edit* pEdit,
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange,
@@ -624,7 +625,7 @@ void IFX_Edit::GenerateRichPageObjects(
}
}
-void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectList* pPageObjects,
+void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pPageObjects,
IFX_Edit* pEdit,
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange,
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 0bd754af76..e869e72310 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1380,14 +1380,12 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc,
page.Load(pDocument, pPageDict);
page.ParseContent(nullptr);
- FX_POSITION pos = page.GetFirstObjectPosition();
-
int nWords = 0;
-
CFX_WideString swRet;
-
+ FX_POSITION pos = page.GetPageObjectList()->GetHeadPosition();
while (pos) {
- if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) {
+ if (CPDF_PageObject* pPageObj =
+ page.GetPageObjectList()->GetNextObject(pos)) {
if (pPageObj->m_Type == CPDF_PageObject::TEXT) {
int nObjWords = CountWords((CPDF_TextObject*)pPageObj);
@@ -1444,9 +1442,10 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc,
page.ParseContent(nullptr);
int nWords = 0;
- FX_POSITION pos = page.GetFirstObjectPosition();
+ FX_POSITION pos = page.GetPageObjectList()->GetHeadPosition();
while (pos) {
- if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) {
+ if (CPDF_PageObject* pPageObj =
+ page.GetPageObjectList()->GetNextObject(pos)) {
if (pPageObj->m_Type == CPDF_PageObject::TEXT) {
CPDF_TextObject* pTextObj = (CPDF_TextObject*)pPageObj;
nWords += CountWords(pTextObj);
diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
index cbef23cc19..057cb4191e 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
@@ -1168,7 +1168,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place,
}
void CPWL_Edit::GeneratePageObjects(
- CPDF_PageObjectList* pPageObjects,
+ CPDF_PageObjectHolder* pPageObjects,
const CPDF_Point& ptOffset,
CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) {
IFX_Edit::GeneratePageObjects(
@@ -1177,7 +1177,7 @@ void CPWL_Edit::GeneratePageObjects(
ObjArray);
}
-void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectList* pPageObjects,
+void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pPageObjects,
const CPDF_Point& ptOffset) {
CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
IFX_Edit::GeneratePageObjects(