summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-09-20 12:17:42 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-20 12:17:42 -0700
commit9f206f05eccf51089fe8a30bf52dc063ea5e2633 (patch)
tree484b1215a89619ca56b7957f07ff87f825bdcd80
parent5b7c9bbf6c26ca272706814ad3598894ce5e4e3b (diff)
downloadpdfium-9f206f05eccf51089fe8a30bf52dc063ea5e2633.tar.xz
Cleanup CPDFXFA and CPDF document methods
This CL renames and cleans up some methods that are similar between CPDF_Document and CPDFXFA_Document. Review-Url: https://codereview.chromium.org/2351673004
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_document.h5
-rw-r--r--fpdfsdk/fpdfview.cpp4
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp12
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp6
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h14
5 files changed, 21 insertions, 20 deletions
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
index 0b865cb7f2..5f3b2d277a 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
@@ -48,7 +48,9 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
CPDF_Dictionary* GetRoot() const { return m_pRootDict; }
CPDF_Dictionary* GetInfo() const { return m_pInfoDict; }
+ void DeletePage(int iPage);
int GetPageCount() const;
+
CPDF_Dictionary* GetPage(int iPage);
int GetPageIndex(uint32_t objnum);
uint32_t GetUserPermissions() const;
@@ -78,10 +80,9 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
void LoadLinearizedDoc(CPDF_Dictionary* pLinearizationParams);
void LoadPages();
- // Editing methods.
void CreateNewDoc();
CPDF_Dictionary* CreateNewPage(int iPage);
- void DeletePage(int iPage);
+
CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding);
CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 9f3ca0f9e8..c5b13f850d 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -537,7 +537,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
return nullptr;
#ifdef PDF_ENABLE_XFA
- return pDoc->GetPage(page_index);
+ return pDoc->GetXFAPage(page_index);
#else // PDF_ENABLE_XFA
CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
if (!pDict)
@@ -920,7 +920,7 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
int count = pDoc->GetPageCount();
if (page_index < 0 || page_index >= count)
return FALSE;
- CPDFXFA_Page* pPage = pDoc->GetPage(page_index);
+ CPDFXFA_Page* pPage = pDoc->GetXFAPage(page_index);
if (!pPage)
return FALSE;
*width = pPage->GetPageWidth();
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 3bf116e64a..7ee3cbb859 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -61,7 +61,7 @@ void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView,
if (m_pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA)
return;
- CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView);
+ CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView);
if (!pPage)
return;
@@ -93,7 +93,7 @@ void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
if (!pPageView)
return;
- CPDFXFA_Page* pPage = m_pDocument->GetPage(pPageView);
+ CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pPageView);
if (!pPage)
return;
@@ -118,7 +118,7 @@ FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
if (!pXFAPageView)
return FALSE;
- CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView);
+ CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView);
if (!pPage)
return FALSE;
@@ -231,7 +231,7 @@ FX_BOOL CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget,
if (!pXFAPageView)
return FALSE;
- CPDFXFA_Page* pPage = m_pDocument->GetPage(pXFAPageView);
+ CPDFXFA_Page* pPage = m_pDocument->GetXFAPage(pXFAPageView);
if (!pPage)
return FALSE;
@@ -302,7 +302,7 @@ void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget,
if (!pPageView)
return;
- CPDFXFA_Page* pXFAPage = m_pDocument->GetPage(pPageView);
+ CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView);
if (!pXFAPage)
return;
@@ -318,7 +318,7 @@ void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget,
if (!pPageView)
return;
- CPDFXFA_Page* pXFAPage = m_pDocument->GetPage(pPageView);
+ CPDFXFA_Page* pXFAPage = m_pDocument->GetXFAPage(pPageView);
if (!pXFAPage)
return;
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
index ed9407858b..8db16bf4e9 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
@@ -108,7 +108,7 @@ FX_BOOL CPDFXFA_Document::LoadXFADoc() {
return TRUE;
}
-int CPDFXFA_Document::GetPageCount() {
+int CPDFXFA_Document::GetPageCount() const {
if (!m_pPDFDoc && !m_pXFADoc)
return 0;
@@ -125,7 +125,7 @@ int CPDFXFA_Document::GetPageCount() {
}
}
-CPDFXFA_Page* CPDFXFA_Document::GetPage(int page_index) {
+CPDFXFA_Page* CPDFXFA_Document::GetXFAPage(int page_index) {
if (page_index < 0)
return nullptr;
@@ -151,7 +151,7 @@ CPDFXFA_Page* CPDFXFA_Document::GetPage(int page_index) {
return pPage;
}
-CPDFXFA_Page* CPDFXFA_Document::GetPage(CXFA_FFPageView* pPage) {
+CPDFXFA_Page* CPDFXFA_Document::GetXFAPage(CXFA_FFPageView* pPage) const {
if (!pPage)
return nullptr;
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
index 77597d47c2..ed788eac55 100644
--- a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
@@ -38,16 +38,16 @@ class CPDFXFA_Document {
CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); }
CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); }
CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; }
-
- int GetPageCount();
- CPDFXFA_Page* GetPage(int page_index);
- CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage);
+ CPDFSDK_Document* GetSDKDocument(CPDFSDK_Environment* pFormFillEnv);
+ int GetDocType() const { return m_iDocType; }
void DeletePage(int page_index);
- void RemovePage(CPDFXFA_Page* page);
- int GetDocType() { return m_iDocType; }
+ int GetPageCount() const;
- CPDFSDK_Document* GetSDKDocument(CPDFSDK_Environment* pFormFillEnv);
+ CPDFXFA_Page* GetXFAPage(int page_index);
+ CPDFXFA_Page* GetXFAPage(CXFA_FFPageView* pPage) const;
+
+ void RemovePage(CPDFXFA_Page* page);
void ClearChangeMark();