From c8be4ce787252eaf3b03270bc99fe1e9e9044543 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 7 Nov 2017 20:08:31 +0000 Subject: Rename CXFA_Event to CXFA_EventData This CL renames CXFA_Event to CXFA_EventData to make it clear it's part of the Data hierarchy. Change-Id: I3659dfba66498d07ce75fd5e8322732f9898e688 Reviewed-on: https://pdfium-review.googlesource.com/17980 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_event.cpp | 50 ------------------------------------- xfa/fxfa/parser/cxfa_event.h | 31 ----------------------- xfa/fxfa/parser/cxfa_eventdata.cpp | 50 +++++++++++++++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_eventdata.h | 31 +++++++++++++++++++++++ xfa/fxfa/parser/cxfa_widgetdata.cpp | 8 +++--- 5 files changed, 85 insertions(+), 85 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_event.cpp delete mode 100644 xfa/fxfa/parser/cxfa_event.h create mode 100644 xfa/fxfa/parser/cxfa_eventdata.cpp create mode 100644 xfa/fxfa/parser/cxfa_eventdata.h (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp deleted file mode 100644 index 8ba68fb294..0000000000 --- a/xfa/fxfa/parser/cxfa_event.cpp +++ /dev/null @@ -1,50 +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_event.h" - -#include "xfa/fxfa/parser/cxfa_node.h" - -CXFA_Event::CXFA_Event(CXFA_Node* pNode) : CXFA_Data(pNode) {} - -int32_t CXFA_Event::GetActivity() { - return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_Activity); -} - -XFA_Element CXFA_Event::GetEventType() const { - CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); - while (pChild) { - XFA_Element eType = pChild->GetElementType(); - if (eType != XFA_Element::Extras) - return eType; - - pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); - } - return XFA_Element::Unknown; -} - -void CXFA_Event::GetRef(WideStringView& wsRef) { - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Ref, wsRef, true); -} - -CXFA_Script CXFA_Event::GetScript() const { - return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false)); -} - -CXFA_Submit CXFA_Event::GetSubmit() const { - return CXFA_Submit(m_pNode->GetChild(0, XFA_Element::Submit, false)); -} - -void CXFA_Event::GetSignDataTarget(WideString& wsTarget) { - CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::SignData, true); - if (!pNode) - return; - - WideStringView wsCData; - pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Target, wsCData, true); - wsTarget = wsCData; -} diff --git a/xfa/fxfa/parser/cxfa_event.h b/xfa/fxfa/parser/cxfa_event.h deleted file mode 100644 index 3835454c28..0000000000 --- a/xfa/fxfa/parser/cxfa_event.h +++ /dev/null @@ -1,31 +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_EVENT_H_ -#define XFA_FXFA_PARSER_CXFA_EVENT_H_ - -#include - -#include "core/fxcrt/fx_string.h" -#include "xfa/fxfa/parser/cxfa_data.h" -#include "xfa/fxfa/parser/cxfa_script.h" -#include "xfa/fxfa/parser/cxfa_submit.h" - -class CXFA_Node; - -class CXFA_Event : public CXFA_Data { - public: - explicit CXFA_Event(CXFA_Node* pNode); - - int32_t GetActivity(); - XFA_Element GetEventType() const; - CXFA_Script GetScript() const; - CXFA_Submit GetSubmit() const; - void GetRef(WideStringView& wsRef); - void GetSignDataTarget(WideString& wsTarget); -}; - -#endif // XFA_FXFA_PARSER_CXFA_EVENT_H_ diff --git a/xfa/fxfa/parser/cxfa_eventdata.cpp b/xfa/fxfa/parser/cxfa_eventdata.cpp new file mode 100644 index 0000000000..5b48df6d88 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_eventdata.cpp @@ -0,0 +1,50 @@ +// 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_eventdata.h" + +#include "xfa/fxfa/parser/cxfa_node.h" + +CXFA_EventData::CXFA_EventData(CXFA_Node* pNode) : CXFA_Data(pNode) {} + +int32_t CXFA_EventData::GetActivity() { + return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_Activity); +} + +XFA_Element CXFA_EventData::GetEventType() const { + CXFA_Node* pChild = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); + while (pChild) { + XFA_Element eType = pChild->GetElementType(); + if (eType != XFA_Element::Extras) + return eType; + + pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); + } + return XFA_Element::Unknown; +} + +void CXFA_EventData::GetRef(WideStringView& wsRef) { + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Ref, wsRef, true); +} + +CXFA_Script CXFA_EventData::GetScript() const { + return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false)); +} + +CXFA_Submit CXFA_EventData::GetSubmit() const { + return CXFA_Submit(m_pNode->GetChild(0, XFA_Element::Submit, false)); +} + +void CXFA_EventData::GetSignDataTarget(WideString& wsTarget) { + CXFA_Node* pNode = + m_pNode->JSNode()->GetProperty(0, XFA_Element::SignData, true); + if (!pNode) + return; + + WideStringView wsCData; + pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Target, wsCData, true); + wsTarget = wsCData; +} diff --git a/xfa/fxfa/parser/cxfa_eventdata.h b/xfa/fxfa/parser/cxfa_eventdata.h new file mode 100644 index 0000000000..b6fdc48e99 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_eventdata.h @@ -0,0 +1,31 @@ +// 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_EVENTDATA_H_ +#define XFA_FXFA_PARSER_CXFA_EVENTDATA_H_ + +#include + +#include "core/fxcrt/fx_string.h" +#include "xfa/fxfa/parser/cxfa_data.h" +#include "xfa/fxfa/parser/cxfa_script.h" +#include "xfa/fxfa/parser/cxfa_submit.h" + +class CXFA_Node; + +class CXFA_EventData : public CXFA_Data { + public: + explicit CXFA_EventData(CXFA_Node* pNode); + + int32_t GetActivity(); + XFA_Element GetEventType() const; + CXFA_Script GetScript() const; + CXFA_Submit GetSubmit() const; + void GetRef(WideStringView& wsRef); + void GetSignDataTarget(WideString& wsTarget); +}; + +#endif // XFA_FXFA_PARSER_CXFA_EVENTDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index ccce8cf501..362f0b5e54 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -12,7 +12,7 @@ #include "third_party/base/stl_util.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" -#include "xfa/fxfa/parser/cxfa_event.h" +#include "xfa/fxfa/parser/cxfa_eventdata.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -311,11 +311,11 @@ std::vector CXFA_WidgetData::GetEventByActivity(int32_t iActivity, bool bIsFormReady) { std::vector events; for (CXFA_Node* pNode : GetEventList()) { - CXFA_Event event(pNode); - if (event.GetActivity() == iActivity) { + CXFA_EventData eventData(pNode); + if (eventData.GetActivity() == iActivity) { if (iActivity == XFA_ATTRIBUTEENUM_Ready) { WideStringView wsRef; - event.GetRef(wsRef); + eventData.GetRef(wsRef); if (bIsFormReady) { if (wsRef == WideStringView(L"$form")) events.push_back(pNode); -- cgit v1.2.3