summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfview.cpp
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-02-17 06:50:08 -0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-02-17 06:50:08 -0800
commite118ce99c52a21a1093badc9d180539a9a6e973f (patch)
tree1129f05665e216555dd41e5ea599d39e7d0e1bfd /fpdfsdk/src/fpdfview.cpp
parentccc948344564f0e2079c3c3a5b1483ab5203fec9 (diff)
downloadpdfium-e118ce99c52a21a1093badc9d180539a9a6e973f.tar.xz
Keep the declaration of FPDF_HasXFAField consistent with other XFA APIs
It's an enhancement requested in issue 452794. BUG=N/A R=tsepez@chromium.org Review URL: https://codereview.chromium.org/939483003
Diffstat (limited to 'fpdfsdk/src/fpdfview.cpp')
-rw-r--r--fpdfsdk/src/fpdfview.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index f726fc9ae0..6a8f890115 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -302,13 +302,41 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BY
CPDFXFA_Document* pDocument = FX_NEW CPDFXFA_Document(pPDFDoc, pProvider);
return pDocument;
}
+
+DLLEXPORT FX_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, int& docType)
+{
+ if (!document)
+ return FALSE;
+
+ CPDF_Dictionary* pRoot = ((CPDF_Document*)document)->GetRoot();
+ if (!pRoot)
+ return FALSE;
+
+ CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm");
+ if (!pAcroForm)
+ return FALSE;
+
+ CPDF_Object* pXFA = pAcroForm->GetElement("XFA");
+ if (!pXFA)
+ return FALSE;
+
+ FX_BOOL bDynamicXFA = pRoot->GetBoolean("NeedsRendering", FALSE);
+
+ if (bDynamicXFA)
+ docType = DOCTYPE_DYNIMIC_XFA;
+ else
+ docType = DOCTYPE_STATIC_XFA;
+
+ return TRUE;
+}
+
DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document)
{
- if (!document||!((CPDFXFA_Document*)document)->GetPDFDoc())
+ if (!document)
return FALSE;
int iDocType = DOCTYPE_PDF;
- FX_BOOL hasXFAField = FPDF_HasXFAField(((CPDFXFA_Document*)document)->GetPDFDoc(), iDocType);
+ FX_BOOL hasXFAField = FPDF_HasXFAField(document, iDocType);
if (!hasXFAField)
return FALSE;
return ((CPDFXFA_Document*)document)->LoadXFADoc();