summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfeditpage.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-15 16:17:18 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-15 16:17:18 -0700
commit471a1034e70ddcfc93ce2a93b28a8385109e83de (patch)
treec845fb1b73b936023be1fc2e7699ff4768aec652 /fpdfsdk/src/fpdfeditpage.cpp
parentdfbf8e7ba55695c4e6cb30eadbe9c6a2955815ba (diff)
downloadpdfium-471a1034e70ddcfc93ce2a93b28a8385109e83de.tar.xz
Merge to XFA: Introduce CPDF_DocumentFromFPDFDocument().
Manual merges everywhere. Original Review URL: https://codereview.chromium.org/1395493007 . (cherry picked from commit bb51c4fb6bc6095984c303c95e5336f83e66bc67) Original Review URL: https://codereview.chromium.org/1396283006 . (cherry picked from commit 86adb658843658969041a13bf6cf0cc950ffe8ed) R=thestig@chromium.org Review URL: https://codereview.chromium.org/1395353004 .
Diffstat (limited to 'fpdfsdk/src/fpdfeditpage.cpp')
-rw-r--r--fpdfsdk/src/fpdfeditpage.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index 145d8ca5c3..e7bbf05f4a 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -48,10 +48,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() {
}
DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) {
- CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc();
- if (pDoc == NULL)
- return;
- if (page_index < 0 || page_index >= pDoc->GetPageCount())
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount())
return;
pDoc->DeletePage(page_index);
@@ -61,17 +59,14 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
int page_index,
double width,
double height) {
- if (!document)
- return NULL;
+ CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
+ if (!pDoc)
+ return nullptr;
- // CPDF_Parser* pParser = (CPDF_Parser*)document;
- CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc();
if (page_index < 0)
page_index = 0;
if (pDoc->GetPageCount() < page_index)
page_index = pDoc->GetPageCount();
- // if (page_index < 0 || page_index >= pDoc->GetPageCount())
- // return NULL;
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index);
if (!pPageDict)