summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-23 09:17:10 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-23 13:50:52 +0000
commitcdba747a53082a7f36534dffa6a3ad01628e53c3 (patch)
tree4df0b15de7600592588a263deb9a3adee617f417 /fpdfsdk/cpdfsdk_widget.cpp
parent1bbedec89cc59df3e305dc25082d9699237d70ab (diff)
downloadpdfium-cdba747a53082a7f36534dffa6a3ad01628e53c3.tar.xz
Cleanup DocType defines
This Cl synchronizes the DocType's defined in XFA with the DOCTYPE flag used in public/. The internal XFA version is converted to an enum class. Change-Id: I1f7be71a200c1ec0f09f9b08099791da1f4fa2e4 Reviewed-on: https://pdfium-review.googlesource.com/3152 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 75c34b38b4..ccfee05575 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() == DOCTYPE_STATIC_XFA) {
+ if (pContext->GetDocType() == XFA_DocType::Static) {
if (!m_hMixXFAWidget) {
if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) {
CFX_WideString sName;
@@ -96,28 +96,27 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
- if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) {
- CFX_WideString sName = GetName();
- if (!sName.IsEmpty())
- return pDocView->GetWidgetByName(sName, nullptr);
- }
- }
+ if (pContext->GetDocType() != XFA_DocType::Static)
+ return nullptr;
- return nullptr;
+ CXFA_FFDocView* pDocView = pContext->GetXFADocView();
+ if (!pDocView)
+ return nullptr;
+
+ CFX_WideString sName = GetName();
+ return !sName.IsEmpty() ? pDocView->GetWidgetByName(sName, nullptr) : nullptr;
}
CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
- if (!m_pWidgetHandler) {
- if (CXFA_FFDocView* pDocView = pContext->GetXFADocView())
- m_pWidgetHandler = pDocView->GetWidgetHandler();
- }
- return m_pWidgetHandler;
- }
+ if (pContext->GetDocType() != XFA_DocType::Static)
+ return nullptr;
- return nullptr;
+ if (!m_pWidgetHandler) {
+ if (CXFA_FFDocView* pDocView = pContext->GetXFADocView())
+ m_pWidgetHandler = pDocView->GetWidgetHandler();
+ }
+ return m_pWidgetHandler;
}
static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) {
@@ -505,8 +504,8 @@ int CPDFSDK_Widget::GetFieldType() const {
bool CPDFSDK_Widget::IsAppearanceValid() {
#ifdef PDF_ENABLE_XFA
CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext();
- int nDocType = pContext->GetDocType();
- if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA)
+ XFA_DocType nDocType = pContext->GetDocType();
+ if (nDocType != XFA_DocType::PDF && nDocType != XFA_DocType::Static)
return true;
#endif // PDF_ENABLE_XFA
return CPDFSDK_BAAnnot::IsAppearanceValid();