diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-11-24 13:33:57 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-11-24 13:33:57 -0800 |
commit | 540c436dc8e7d7b700b448acc8536f5cf68d4b74 (patch) | |
tree | bff6a2297a280b39753d93b64ec61d6c9459b50a /fpdfsdk/src/fpdfformfill.cpp | |
parent | ed19d211f96f47e06dc1b597c5a054e17d7e160d (diff) | |
download | pdfium-540c436dc8e7d7b700b448acc8536f5cf68d4b74.tar.xz |
XFA: more underlying type changes to match master
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1474663004 .
Diffstat (limited to 'fpdfsdk/src/fpdfformfill.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfformfill.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp index a1e807224d..5dcfb47890 100644 --- a/fpdfsdk/src/fpdfformfill.cpp +++ b/fpdfsdk/src/fpdfformfill.cpp @@ -28,11 +28,12 @@ CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle, FPDF_PAGE page) { - if (!page) + UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); + if (!pPage) return nullptr; CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); - return pSDKDoc ? pSDKDoc->GetPageView((CPDFXFA_Page*)page, TRUE) : nullptr; + return pSDKDoc ? pSDKDoc->GetPageView(pPage, TRUE) : nullptr; } } // namespace @@ -128,16 +129,19 @@ DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, DLLEXPORT FPDF_FORMHANDLE STDCALL FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, FPDF_FORMFILLINFO* formInfo) { - if (!document || !formInfo || formInfo->version != 2) + const int kRequiredVersion = 2; + if (!formInfo || formInfo->version != kRequiredVersion) + return nullptr; + + UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); + if (!pDocument) return nullptr; - CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo); pEnv->SetSDKDocument(pDocument->GetSDKDocument(pEnv)); CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); pApp->AddFormFillEnv(pEnv); - return pEnv; } @@ -600,14 +604,17 @@ DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle) { - if (!hHandle || !page) + if (!hHandle) return; CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); if (!pSDKDoc) return; - CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; + UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); + if (!pPage) + return; + CPDFSDK_PageView* pPageView = pSDKDoc->GetPageView(pPage, FALSE); if (pPageView) { pPageView->SetValid(FALSE); @@ -653,11 +660,11 @@ DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandle, int aaType) { - if (!hHandle || !page) + if (!hHandle) return; CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); - CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; - CPDF_Page* pPDFPage = pPage->GetPDFPage(); + UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); + CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); if (!pPDFPage) return; if (pSDKDoc->GetPageView(pPage, FALSE)) { |