From 22a1bb99afe62a032ab1fbac9f594c5c182ca880 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 23 Jan 2018 15:19:34 +0000 Subject: Remove CXFA_WidgetAcc from CXFA_FFField::CalculateNode This CL changes CXFA_FFField::CalculateNode to use a CXFA_Node instead of a CXFA_WidgetAcc. Change-Id: I305e0d48f321df845ca2c1ff0f446d201ae7b3fb Reviewed-on: https://pdfium-review.googlesource.com/23471 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/cxfa_fffield.cpp | 30 ++++++++++++------------------ xfa/fxfa/cxfa_fffield.h | 4 ++-- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index e9f3101068..971936a86d 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -636,34 +636,28 @@ bool CXFA_FFField::ProcessCommittedData() { int32_t CXFA_FFField::CalculateOverride() { CXFA_Node* exclNode = m_pNode->GetExclGroupIfExists(); - if (!exclNode) - return CalculateWidgetAcc(m_pNode->GetWidgetAcc()); - - CXFA_WidgetAcc* pAcc = exclNode->GetWidgetAcc(); - if (!pAcc) - return CalculateWidgetAcc(m_pNode->GetWidgetAcc()); - if (CalculateWidgetAcc(pAcc) == 0) + if (!exclNode || !exclNode->IsWidgetReady()) + return CalculateNode(m_pNode.Get()); + if (CalculateNode(exclNode) == 0) return 0; - CXFA_Node* pNode = pAcc->GetExclGroupFirstMember(); + CXFA_Node* pNode = exclNode->GetWidgetAcc()->GetExclGroupFirstMember(); if (!pNode) return 1; - CXFA_WidgetAcc* pWidgetAcc = nullptr; while (pNode) { - pWidgetAcc = pNode->GetWidgetAcc(); - if (!pWidgetAcc) + if (!pNode->IsWidgetReady()) return 1; - if (CalculateWidgetAcc(pWidgetAcc) == 0) + if (CalculateNode(pNode) == 0) return 0; - pNode = pWidgetAcc->GetExclGroupNextMember(pNode); + pNode = pNode->GetWidgetAcc()->GetExclGroupNextMember(pNode); } return 1; } -int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { - CXFA_Calculate* calc = pAcc->GetNode()->GetCalculateIfExists(); +int32_t CXFA_FFField::CalculateNode(CXFA_Node* pNode) { + CXFA_Calculate* calc = pNode->GetCalculateIfExists(); if (!calc) return 1; @@ -690,7 +684,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { return 1; } - if (pAcc->GetNode()->IsUserInteractive()) + if (pNode->IsUserInteractive()) return 1; IXFA_AppProvider* pAppProvider = GetApp()->GetAppProvider(); @@ -704,7 +698,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { wsMessage += L"Are you sure you want to modify this field?"; if (pAppProvider->MsgBox(wsMessage, L"Calculate Override", XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { - pAcc->GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); + pNode->SetFlag(XFA_NodeFlag_UserInteractive, false); return 1; } return 0; @@ -712,7 +706,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { case XFA_AttributeEnum::Ignore: return 0; case XFA_AttributeEnum::Disabled: - pAcc->GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); + pNode->SetFlag(XFA_NodeFlag_UserInteractive, false); return 1; default: return 1; diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h index 20e3b904a2..a27b3844b6 100644 --- a/xfa/fxfa/cxfa_fffield.h +++ b/xfa/fxfa/cxfa_fffield.h @@ -14,7 +14,7 @@ #include "xfa/fxfa/cxfa_ffpageview.h" #include "xfa/fxfa/cxfa_ffwidget.h" -class CXFA_WidgetAcc; +class CXFA_Node; #define XFA_MINUI_HEIGHT 4.32f #define XFA_DEFAULTUI_HEIGHT 2.0f @@ -74,7 +74,7 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { void RenderCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix); int32_t CalculateOverride(); - int32_t CalculateWidgetAcc(CXFA_WidgetAcc* pAcc); + int32_t CalculateNode(CXFA_Node* pNode); bool ProcessCommittedData(); virtual bool CommitData(); virtual bool IsDataChanged(); -- cgit v1.2.3