summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
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 /fpdfsdk/cpdfsdk_widget.cpp
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 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 0e121e8596..0c525129c4 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -72,7 +72,7 @@ CPDFSDK_Widget::~CPDFSDK_Widget() {}
#ifdef PDF_ENABLE_XFA
CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- if (pContext->GetDocType() == XFA_DocType::kForegroundOnly) {
+ if (pContext->GetFormType() == FormType::kXFAForeground) {
if (!m_hMixXFAWidget) {
if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) {
WideString sName;
@@ -95,7 +95,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- if (pContext->GetDocType() != XFA_DocType::kForegroundOnly)
+ if (pContext->GetFormType() != FormType::kXFAForeground)
return nullptr;
CXFA_FFDocView* pDocView = pContext->GetXFADocView();
@@ -108,7 +108,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- if (pContext->GetDocType() != XFA_DocType::kForegroundOnly)
+ if (pContext->GetFormType() != FormType::kXFAForeground)
return nullptr;
if (!m_pWidgetHandler) {
@@ -506,9 +506,8 @@ int CPDFSDK_Widget::GetFieldType() const {
bool CPDFSDK_Widget::IsAppearanceValid() {
#ifdef PDF_ENABLE_XFA
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- XFA_DocType nDocType = pContext->GetDocType();
- if (nDocType != XFA_DocType::kNone &&
- nDocType != XFA_DocType::kForegroundOnly)
+ FormType formType = pContext->GetFormType();
+ if (formType == FormType::kXFAFull)
return true;
#endif // PDF_ENABLE_XFA
return CPDFSDK_BAAnnot::IsAppearanceValid();