From 368c634f87eb5fdf03a532d3125d9b6c5400f61a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 3 Jan 2018 15:22:37 -0500 Subject: Fold CXFA_BindItemsData into CXFA_BindItems This CL merges CXFA_BindItemsData into the CXFA_BindItems class. Change-Id: I424274fcd6a9a4376d78794b1014988c3649602f Reviewed-on: https://pdfium-review.googlesource.com/22170 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/cxfa_ffdocview.cpp | 9 ++++----- xfa/fxfa/cxfa_ffdocview.h | 8 +++++--- xfa/fxfa/cxfa_ffnotify.cpp | 3 ++- xfa/fxfa/parser/cxfa_binditems.cpp | 12 ++++++++++++ xfa/fxfa/parser/cxfa_binditems.h | 4 ++++ xfa/fxfa/parser/cxfa_binditemsdata.cpp | 24 ------------------------ xfa/fxfa/parser/cxfa_binditemsdata.h | 24 ------------------------ 7 files changed, 27 insertions(+), 57 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_binditemsdata.cpp delete mode 100644 xfa/fxfa/parser/cxfa_binditemsdata.h (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index bd2b70920d..1160d55999 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -30,7 +30,7 @@ #include "xfa/fxfa/cxfa_textprovider.h" #include "xfa/fxfa/cxfa_widgetacciterator.h" #include "xfa/fxfa/parser/cxfa_acrobat.h" -#include "xfa/fxfa/parser/cxfa_binditemsdata.h" +#include "xfa/fxfa/parser/cxfa_binditems.h" #include "xfa/fxfa/parser/cxfa_calculate.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_pageset.h" @@ -717,10 +717,9 @@ void CXFA_FFDocView::RunBindItems() { if (!pAcc) continue; - CXFA_BindItemsData bindItemsData(item); CFXJSE_Engine* pScriptContext = pWidgetNode->GetDocument()->GetScriptContext(); - WideString wsRef = bindItemsData.GetRef(); + WideString wsRef = item->GetRef(); uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_ALL; @@ -731,8 +730,8 @@ void CXFA_FFDocView::RunBindItems() { if (rs.dwFlags != XFA_ResolveNode_RSType_Nodes || rs.objects.empty()) continue; - WideString wsValueRef = bindItemsData.GetValueRef(); - WideString wsLabelRef = bindItemsData.GetLabelRef(); + WideString wsValueRef = item->GetValueRef(); + WideString wsLabelRef = item->GetLabelRef(); const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; const bool bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == L"$"; const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == L"$"; diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h index e5b27b58ea..be03c10043 100644 --- a/xfa/fxfa/cxfa_ffdocview.h +++ b/xfa/fxfa/cxfa_ffdocview.h @@ -15,6 +15,7 @@ #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/cxfa_ffdoc.h" +class CXFA_BindItems; class CXFA_FFWidgetHandler; class CXFA_FFDoc; class CXFA_FFWidget; @@ -102,14 +103,15 @@ class CXFA_FFDocView { bool bIsFormReady, bool bRecursive, CXFA_Node* pExclude); + + void AddBindItem(CXFA_BindItems* item) { m_BindItems.push_back(item); } + bool m_bLayoutEvent; std::vector m_arrNullTestMsg; CXFA_FFWidget* m_pListFocusWidget; bool m_bInLayoutStatus; private: - friend class CXFA_FFNotify; - bool RunEventLayoutReady(); void RunBindItems(); void InitCalculate(CXFA_Node* pNode); @@ -128,7 +130,7 @@ class CXFA_FFDocView { std::map> m_mapPageInvalidate; std::vector m_ValidateAccs; std::vector m_CalculateAccs; - std::vector m_BindItems; + std::vector m_BindItems; std::vector m_NewAddedNodes; std::vector m_IndexChangedSubforms; XFA_DOCVIEW_LAYOUTSTATUS m_iStatus; diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp index 9da75bde23..5b47d99387 100644 --- a/xfa/fxfa/cxfa_ffnotify.cpp +++ b/xfa/fxfa/cxfa_ffnotify.cpp @@ -37,6 +37,7 @@ #include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h" #include "xfa/fxfa/cxfa_textlayout.h" #include "xfa/fxfa/cxfa_textprovider.h" +#include "xfa/fxfa/parser/cxfa_binditems.h" #include "xfa/fxfa/parser/cxfa_node.h" namespace { @@ -346,7 +347,7 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { } switch (eType) { case XFA_Element::BindItems: - pDocView->m_BindItems.push_back(pNode); + pDocView->AddBindItem(static_cast(pNode)); break; case XFA_Element::Validate: pNode->SetFlag(XFA_NodeFlag_NeedsInitApp, false); diff --git a/xfa/fxfa/parser/cxfa_binditems.cpp b/xfa/fxfa/parser/cxfa_binditems.cpp index 1c33e4c1c5..d7d72a7e3a 100644 --- a/xfa/fxfa/parser/cxfa_binditems.cpp +++ b/xfa/fxfa/parser/cxfa_binditems.cpp @@ -34,3 +34,15 @@ CXFA_BindItems::CXFA_BindItems(CXFA_Document* doc, XFA_PacketType packet) pdfium::MakeUnique(this)) {} CXFA_BindItems::~CXFA_BindItems() {} + +WideString CXFA_BindItems::GetLabelRef() { + return JSObject()->GetCData(XFA_Attribute::LabelRef); +} + +WideString CXFA_BindItems::GetValueRef() { + return JSObject()->GetCData(XFA_Attribute::ValueRef); +} + +WideString CXFA_BindItems::GetRef() { + return JSObject()->GetCData(XFA_Attribute::Ref); +} diff --git a/xfa/fxfa/parser/cxfa_binditems.h b/xfa/fxfa/parser/cxfa_binditems.h index f2263429b1..f1a490d13e 100644 --- a/xfa/fxfa/parser/cxfa_binditems.h +++ b/xfa/fxfa/parser/cxfa_binditems.h @@ -13,6 +13,10 @@ class CXFA_BindItems : public CXFA_Node { public: CXFA_BindItems(CXFA_Document* doc, XFA_PacketType packet); ~CXFA_BindItems() override; + + WideString GetLabelRef(); + WideString GetValueRef(); + WideString GetRef(); }; #endif // XFA_FXFA_PARSER_CXFA_BINDITEMS_H_ diff --git a/xfa/fxfa/parser/cxfa_binditemsdata.cpp b/xfa/fxfa/parser/cxfa_binditemsdata.cpp deleted file mode 100644 index 0477d3e5d5..0000000000 --- a/xfa/fxfa/parser/cxfa_binditemsdata.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fxfa/parser/cxfa_binditemsdata.h" - -#include "xfa/fxfa/parser/cxfa_node.h" - -CXFA_BindItemsData::CXFA_BindItemsData(CXFA_Node* pNode) - : CXFA_DataData(pNode) {} - -WideString CXFA_BindItemsData::GetLabelRef() const { - return m_pNode->JSObject()->GetCData(XFA_Attribute::LabelRef); -} - -WideString CXFA_BindItemsData::GetValueRef() const { - return m_pNode->JSObject()->GetCData(XFA_Attribute::ValueRef); -} - -WideString CXFA_BindItemsData::GetRef() const { - return m_pNode->JSObject()->GetCData(XFA_Attribute::Ref); -} diff --git a/xfa/fxfa/parser/cxfa_binditemsdata.h b/xfa/fxfa/parser/cxfa_binditemsdata.h deleted file mode 100644 index ab4cac1836..0000000000 --- a/xfa/fxfa/parser/cxfa_binditemsdata.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_PARSER_CXFA_BINDITEMSDATA_H_ -#define XFA_FXFA_PARSER_CXFA_BINDITEMSDATA_H_ - -#include "core/fxcrt/fx_string.h" -#include "xfa/fxfa/parser/cxfa_datadata.h" - -class CXFA_Node; - -class CXFA_BindItemsData : public CXFA_DataData { - public: - explicit CXFA_BindItemsData(CXFA_Node* pNode); - - WideString GetLabelRef() const; - WideString GetValueRef() const; - WideString GetRef() const; -}; - -#endif // XFA_FXFA_PARSER_CXFA_BINDITEMSDATA_H_ -- cgit v1.2.3