diff options
author | JUN FANG <jun_fang@foxitsoftware.com> | 2015-03-09 14:57:38 -0700 |
---|---|---|
committer | JUN FANG <jun_fang@foxitsoftware.com> | 2015-03-09 14:57:38 -0700 |
commit | 404e7e76fa8007468bd0ef58305ccff1895dfbf7 (patch) | |
tree | 8cc01456fd26b57886ada47cf73ca64ee478650e | |
parent | 4cc9acb6ca21590b68044d189d276985883373e4 (diff) | |
download | pdfium-404e7e76fa8007468bd0ef58305ccff1895dfbf7.tar.xz |
Remove the calling 'FPDF_HasXFAField' in LoadXFADoc
BUG=NA
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/983253004
-rw-r--r-- | fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp | 86 |
1 files changed, 36 insertions, 50 deletions
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp index f13870697b..87fb9d21ce 100644 --- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp @@ -92,64 +92,50 @@ FX_BOOL CPDFXFA_Document::LoadXFADoc() m_XFAPageList.RemoveAll();
- int iDocType = DOCTYPE_PDF;
- FX_BOOL hasXFAField = FPDF_HasXFAField(m_pPDFDoc, iDocType);
+ IXFA_App* pApp = m_pApp->GetXFAApp();
+ if (!pApp)
+ return FALSE;
- if (hasXFAField)
+ m_pXFADoc = pApp->CreateDoc(this, m_pPDFDoc);
+ if (!m_pXFADoc)
{
- IXFA_App* pApp = m_pApp->GetXFAApp();
- if (pApp)
- {
- m_pXFADoc = pApp->CreateDoc(this, m_pPDFDoc);
- if (!m_pXFADoc)
- {
- SetLastError(FPDF_ERR_XFALOAD);
- return FALSE;
- }
-
- IXFA_DocHandler* pDocHandler = pApp->GetDocHandler();
- if (pDocHandler)
- {
- int iStatus = pDocHandler->StartLoad(m_pXFADoc);
- iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL);
- if (iStatus != 100)
- {
- CloseXFADoc(pDocHandler);
- SetLastError(FPDF_ERR_XFALOAD);
- return FALSE;
- }
- pDocHandler->StopLoad(m_pXFADoc);
- pDocHandler->SetJSERuntime(m_pXFADoc, m_pApp->GetJSERuntime());
-
- if (pDocHandler->GetDocType(m_pXFADoc) == XFA_DOCTYPE_Dynamic)
- m_iDocType = DOCTYPE_DYNIMIC_XFA;
- else
- m_iDocType = DOCTYPE_STATIC_XFA;
-
- m_pXFADocView = pDocHandler->CreateDocView(m_pXFADoc, XFA_DOCVIEW_View);
- FXSYS_assert(m_pXFADocView);
+ SetLastError(FPDF_ERR_XFALOAD);
+ return FALSE;
+ }
- if (m_pXFADocView->StartLayout() < 0)
- {
- CloseXFADoc(pDocHandler);
- SetLastError(FPDF_ERR_XFALAYOUT);
- return FALSE;
- }
- else
- {
- m_pXFADocView->DoLayout(NULL);
- m_pXFADocView->StopLayout();
+ IXFA_DocHandler* pDocHandler = pApp->GetDocHandler();
+ if (!pDocHandler)
+ {
+ SetLastError(FPDF_ERR_XFALOAD);
+ return FALSE;
+ }
- return TRUE;
- }
- }
+ pDocHandler->StartLoad(m_pXFADoc);
+ int iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL);
+ if (iStatus != XFA_PARSESTATUS_Done)
+ {
+ CloseXFADoc(pDocHandler);
+ SetLastError(FPDF_ERR_XFALOAD);
+ return FALSE;
+ }
+ pDocHandler->StopLoad(m_pXFADoc);
+ pDocHandler->SetJSERuntime(m_pXFADoc, m_pApp->GetJSERuntime());
- return FALSE;
- }
+ if (pDocHandler->GetDocType(m_pXFADoc) == XFA_DOCTYPE_Dynamic)
+ m_iDocType = DOCTYPE_DYNIMIC_XFA;
+ else
+ m_iDocType = DOCTYPE_STATIC_XFA;
+ m_pXFADocView = pDocHandler->CreateDocView(m_pXFADoc, XFA_DOCVIEW_View);
+ if (m_pXFADocView->StartLayout() < 0)
+ {
+ CloseXFADoc(pDocHandler);
+ SetLastError(FPDF_ERR_XFALAYOUT);
return FALSE;
}
-
+
+ m_pXFADocView->DoLayout(NULL);
+ m_pXFADocView->StopLayout();
return TRUE;
}
|