diff options
author | Jun Fang <jun_fang@foxitsoftware.com> | 2015-02-17 06:50:08 -0800 |
---|---|---|
committer | Jun Fang <jun_fang@foxitsoftware.com> | 2015-02-17 06:50:08 -0800 |
commit | e118ce99c52a21a1093badc9d180539a9a6e973f (patch) | |
tree | 1129f05665e216555dd41e5ea599d39e7d0e1bfd /fpdfsdk | |
parent | ccc948344564f0e2079c3c3a5b1483ab5203fec9 (diff) | |
download | pdfium-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')
-rw-r--r-- | fpdfsdk/include/fpdfformfill.h | 14 | ||||
-rw-r--r-- | fpdfsdk/include/fpdfxfa/fpdfxfa_util.h | 6 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfsave.cpp | 1 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfview.cpp | 32 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfxfa/fpdfxfa_util.cpp | 28 |
5 files changed, 45 insertions, 36 deletions
diff --git a/fpdfsdk/include/fpdfformfill.h b/fpdfsdk/include/fpdfformfill.h index 442b93fb0f..5191fd75a8 100644 --- a/fpdfsdk/include/fpdfformfill.h +++ b/fpdfsdk/include/fpdfformfill.h @@ -11,6 +11,10 @@ typedef void* FPDF_FORMHANDLE; +#define DOCTYPE_PDF 0 //Normal pdf Document +#define DOCTYPE_DYNIMIC_XFA 1 //Dynimic xfa Document Type +#define DOCTYPE_STATIC_XFA 2 //Static xfa Document Type + // Exported Functions #ifdef __cplusplus extern "C" { @@ -1094,6 +1098,16 @@ DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle); **/ DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags); +/** + * Function: FPDF_HasXFAField + * This method is designed to check whether a pdf document has XFA fields. + * Parameters: + * document - Handle to document. Returned by FPDF_LoadDocument function. + * docType - Document type defined as DOCTYPE_xxx. + * Return Value: + * TRUE indicates that the input document has XFA fields, otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, int& docType); /** * Function: FPDF_LoadXFA diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h index 07ea65f2b1..28904e2ca6 100644 --- a/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h +++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h @@ -7,17 +7,11 @@ #ifndef _FPDFXFA_UTIL_H_
#define _FPDFXFA_UTIL_H_
-#define DOCTYPE_PDF 0
-#define DOCTYPE_DYNIMIC_XFA 1 //Dynimic xfa Document Type
-#define DOCTYPE_STATIC_XFA 2 //Static xfa Document Type
-
#define JS_STR_VIEWERTYPE_STANDARD L"Exchange"
#define JS_STR_LANGUANGE L"ENU"
#define JS_STR_VIEWERVARIATION L"Full"
#define JS_STR_VIEWERVERSION_XFA L"11"
-FX_BOOL FPDF_HasXFAField(CPDF_Document* pPDFDoc, int& docType);
-
class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr, public CFX_Object
{
public:
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp index 229e580dec..de645a2841 100644 --- a/fpdfsdk/src/fpdfsave.cpp +++ b/fpdfsdk/src/fpdfsave.cpp @@ -7,6 +7,7 @@ #include "../include/fsdk_define.h" #include "../include/fpdfsave.h" #include "../include/fpdfedit.h" +#include "../include/fpdfformfill.h" #include "../include/fpdfxfa/fpdfxfa_doc.h" #include "../include/fpdfxfa/fpdfxfa_app.h" #include "../include/fpdfxfa/fpdfxfa_util.h" 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(); diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_util.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_util.cpp index 9bf1b63c8f..fb625d2738 100644 --- a/fpdfsdk/src/fpdfxfa/fpdfxfa_util.cpp +++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_util.cpp @@ -8,34 +8,6 @@ #include "../../include/fsdk_mgr.h"
#include "../../include/fpdfxfa/fpdfxfa_util.h"
-FX_BOOL FPDF_HasXFAField(CPDF_Document* pPDFDoc, int& docType)
-{
- if (!pPDFDoc)
- return FALSE;
-
- CPDF_Dictionary* pRoot = pPDFDoc->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 bDymasticXFA = FALSE;
- bDymasticXFA = pRoot->GetBoolean("NeedsRendering", FALSE);
-
- if(bDymasticXFA)
- docType = DOCTYPE_DYNIMIC_XFA;
- else
- docType = DOCTYPE_STATIC_XFA;
-
- return TRUE;
-}
-
CFX_PtrArray CXFA_FWLAdapterTimerMgr::ms_timerArray;
FWL_ERR CXFA_FWLAdapterTimerMgr::Start(IFWL_Timer *pTimer, FX_DWORD dwElapse, FWL_HTIMER &hTimer, FX_BOOL bImmediately /* = TRUE */)
|