diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-10-16 14:00:21 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-10-16 14:00:21 -0700 |
commit | db0be96179f0cd5f1787564cbccf86320a4d54ae (patch) | |
tree | 447ba797f172bfffa2d21dacc7dbf6fb2900bfd7 /fpdfsdk/src/fpdfeditpage.cpp | |
parent | cebdda5a686251087f14e8df19b7f988dfae46de (diff) | |
download | pdfium-db0be96179f0cd5f1787564cbccf86320a4d54ae.tar.xz |
Merge to XFA: Introduce CPDFPageFromFPFDPage()
Original Review URL: https://codereview.chromium.org/1406543004 .
(cherry picked from commit 943ea142b6a7e6edc91fe3c307013129e6eb0ef3)
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1411623002 .
Diffstat (limited to 'fpdfsdk/src/fpdfeditpage.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfeditpage.cpp | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp index e7bbf05f4a..0cf7c880af 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( |