summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-10-18 12:28:14 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-18 16:41:35 +0000
commit854d71c1420eb80ec79755a6cdf829f3f39aead7 (patch)
treeba5f94431c46bcf8fa5b8e873304f14c8c69088c /xfa/fxfa
parent7c2daec0a5f5d5e0f442db7946e9356daa7c55b2 (diff)
downloadpdfium-854d71c1420eb80ec79755a6cdf829f3f39aead7.tar.xz
Refactor HasXFAField into HasFormInfo
The existing API is too restrictive for collection the metrics information that we want. Specifically it only tells us if there are XFA forms in the document, but not AcroForms. This refactoring makes the method more general, so that non-XFA information is provided also. This change in semantics of the return value required some changes at the call sites of the API. BUG=chromium:775519 Change-Id: Id421c66c09b47196c252c64cdc2c711ca1911de0 Reviewed-on: https://pdfium-review.googlesource.com/16210 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/cxfa_ffdoc.cpp6
-rw-r--r--xfa/fxfa/cxfa_ffdoc.h4
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp2
-rw-r--r--xfa/fxfa/fxfa.h9
4 files changed, 13 insertions, 8 deletions
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index 23b3df638e..fed20caaa4 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -160,7 +160,7 @@ CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment)
m_pApp(pApp),
m_pNotify(nullptr),
m_pPDFDoc(nullptr),
- m_dwDocType(XFA_DocType::kForegroundOnly) {}
+ m_FormType(FormType::kXFAForeground) {}
CXFA_FFDoc::~CXFA_FFDoc() {
CloseDoc();
@@ -244,7 +244,7 @@ void CXFA_FFDoc::StopLoad() {
m_pPDFFontMgr = pdfium::MakeUnique<CFGAS_PDFFontMgr>(
GetPDFDoc(), GetApp()->GetFDEFontMgr());
- m_dwDocType = XFA_DocType::kForegroundOnly;
+ m_FormType = FormType::kXFAForeground;
CXFA_Node* pConfig = ToNode(
m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
if (!pConfig)
@@ -265,7 +265,7 @@ void CXFA_FFDoc::StopLoad() {
WideString wsType;
if (pDynamicRender->TryContent(wsType) && wsType == L"required")
- m_dwDocType = XFA_DocType::kFull;
+ m_FormType = FormType::kXFAFull;
}
CXFA_FFDocView* CXFA_FFDoc::CreateDocView() {
diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h
index c85c951e04..490b023f0d 100644
--- a/xfa/fxfa/cxfa_ffdoc.h
+++ b/xfa/fxfa/cxfa_ffdoc.h
@@ -54,7 +54,7 @@ class CXFA_FFDoc {
IXFA_DocEnvironment* GetDocEnvironment() const {
return m_pDocEnvironment.Get();
}
- XFA_DocType GetDocType() const { return m_dwDocType; }
+ FormType GetFormType() const { return m_FormType; }
int32_t StartLoad();
int32_t DoLoad();
@@ -91,7 +91,7 @@ class CXFA_FFDoc {
std::map<uint32_t, FX_IMAGEDIB_AND_DPI> m_HashToDibDpiMap;
std::unique_ptr<CXFA_FFDocView> m_DocView;
std::unique_ptr<CFGAS_PDFFontMgr> m_pPDFFontMgr;
- XFA_DocType m_dwDocType;
+ FormType m_FormType;
};
#endif // XFA_FXFA_CXFA_FFDOC_H_
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 0e895b676e..3ac705c8b2 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -622,7 +622,7 @@ void CXFA_FFDocView::DestroyDocView() {
}
bool CXFA_FFDocView::IsStaticNotify() {
- return m_pDoc->GetDocType() == XFA_DocType::kForegroundOnly;
+ return m_pDoc->GetFormType() == FormType::kXFAForeground;
}
void CXFA_FFDocView::AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h
index 9f5432e3ad..ee74fc14dd 100644
--- a/xfa/fxfa/fxfa.h
+++ b/xfa/fxfa/fxfa.h
@@ -40,8 +40,13 @@ class IXFA_WidgetIterator;
#define XFA_IDNo 3
#define XFA_IDYes 4
-// Note, values match fpdf_formfill.h XFADOCTYPE_* flags.
-enum class XFA_DocType { kNone = 0, kFull = 1, kForegroundOnly = 2 };
+// Note, values must match fpdf_formfill.h FORMTYPE_* flags.
+enum class FormType {
+ kNone = 0,
+ kAcroForm = 1,
+ kXFAFull = 2,
+ kXFAForeground = 3
+};
#define XFA_PARSESTATUS_StatusErr -3
#define XFA_PARSESTATUS_StreamErr -2