Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: fpdfsdk/src/fpdfeditpage.cpp

Issue 1411623002: Merge to XFA: Introduce CPDFPageFromFPFDPage() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Stray file. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/fpdfeditimg.cpp ('k') | fpdfsdk/src/fpdfformfill.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfeditpage.cpp
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index e7bbf05f4a024ecd5b89a64dbcc628949a89f795..0cf7c880af2c0e50fa2a2173fc18ad01da886e1d 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -89,7 +89,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
}
DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) {
- CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage();
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
!pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
@@ -133,7 +133,7 @@ DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) {
DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
FPDF_PAGEOBJECT page_obj) {
- CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage();
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
!pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
@@ -175,9 +175,6 @@ DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
default:
break;
}
-
- // pPage->ParseContent();
- // pPage->GenerateContent();
}
DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) {
@@ -189,29 +186,22 @@ DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) {
return -1;
}
return pPage->CountObjects();
- // return 0;
}
DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page,
int index) {
- CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage();
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
"Page")) {
return NULL;
}
return pPage->GetObjectByIndex(index);
- // return NULL;
}
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page) {
- if (!page)
- return FALSE;
- CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage();
- if (!pPage)
- return FALSE;
-
- return pPage->BackgroundAlphaNeeded();
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
+ return pPage && pPage->BackgroundAlphaNeeded();
}
DLLEXPORT FPDF_BOOL STDCALL
@@ -253,7 +243,7 @@ FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) {
}
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page) {
- CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage();
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
!pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
@@ -288,9 +278,7 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
double d,
double e,
double f) {
- if (page == NULL)
- return;
- CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage();
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return;
CPDF_AnnotList AnnotList(pPage);
@@ -318,12 +306,7 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
}
DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) {
- if (page == NULL)
- return;
- CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage();
- if (!pPage)
- return;
-
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
!pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
« no previous file with comments | « fpdfsdk/src/fpdfeditimg.cpp ('k') | fpdfsdk/src/fpdfformfill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698