From 58629a0e49e4ebfb0a0171a4203d2fab4af63165 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 7 Nov 2017 21:44:00 +0000 Subject: Rename CXFA_Value to CXFA_ValueData This CL renames CXFA_Value to CXFA_ValueData to show it's part of the data hierarchy. Change-Id: I4693234f503903a2c11d76a56dbbb6de5f0c3718 Reviewed-on: https://pdfium-review.googlesource.com/18018 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/parser/cxfa_captiondata.cpp | 6 +-- xfa/fxfa/parser/cxfa_captiondata.h | 4 +- xfa/fxfa/parser/cxfa_value.cpp | 56 ------------------------- xfa/fxfa/parser/cxfa_value.h | 35 ---------------- xfa/fxfa/parser/cxfa_valuedata.cpp | 56 +++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_valuedata.h | 35 ++++++++++++++++ xfa/fxfa/parser/cxfa_widgetdata.cpp | 16 +++---- xfa/fxfa/parser/cxfa_widgetdata.h | 4 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 33 +++++++-------- 9 files changed, 122 insertions(+), 123 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_value.cpp delete mode 100644 xfa/fxfa/parser/cxfa_value.h create mode 100644 xfa/fxfa/parser/cxfa_valuedata.cpp create mode 100644 xfa/fxfa/parser/cxfa_valuedata.h (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_captiondata.cpp b/xfa/fxfa/parser/cxfa_captiondata.cpp index dfaba57313..b82fb98754 100644 --- a/xfa/fxfa/parser/cxfa_captiondata.cpp +++ b/xfa/fxfa/parser/cxfa_captiondata.cpp @@ -39,7 +39,7 @@ CXFA_FontData CXFA_CaptionData::GetFontData() { : nullptr); } -CXFA_Value CXFA_CaptionData::GetValue() { - return CXFA_Value(m_pNode ? m_pNode->GetChild(0, XFA_Element::Value, false) - : nullptr); +CXFA_ValueData CXFA_CaptionData::GetValueData() { + return CXFA_ValueData( + m_pNode ? m_pNode->GetChild(0, XFA_Element::Value, false) : nullptr); } diff --git a/xfa/fxfa/parser/cxfa_captiondata.h b/xfa/fxfa/parser/cxfa_captiondata.h index 6c4837fbd1..d7fe0ba53b 100644 --- a/xfa/fxfa/parser/cxfa_captiondata.h +++ b/xfa/fxfa/parser/cxfa_captiondata.h @@ -10,7 +10,7 @@ #include "xfa/fxfa/parser/cxfa_data.h" #include "xfa/fxfa/parser/cxfa_fontdata.h" #include "xfa/fxfa/parser/cxfa_margindata.h" -#include "xfa/fxfa/parser/cxfa_value.h" +#include "xfa/fxfa/parser/cxfa_valuedata.h" class CXFA_Node; @@ -23,7 +23,7 @@ class CXFA_CaptionData : public CXFA_Data { float GetReserve(); CXFA_MarginData GetMarginData(); CXFA_FontData GetFontData(); - CXFA_Value GetValue(); + CXFA_ValueData GetValueData(); }; #endif // XFA_FXFA_PARSER_CXFA_CAPTIONDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp deleted file mode 100644 index ca3f4fd680..0000000000 --- a/xfa/fxfa/parser/cxfa_value.cpp +++ /dev/null @@ -1,56 +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_value.h" - -#include "xfa/fxfa/parser/cxfa_node.h" - -XFA_Element CXFA_Value::GetChildValueClassID() { - if (!m_pNode) - return XFA_Element::Unknown; - if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) - return pNode->GetElementType(); - return XFA_Element::Unknown; -} - -bool CXFA_Value::GetChildValueContent(WideString& wsContent) { - if (!m_pNode) - return false; - if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) - return pNode->JSNode()->TryContent(wsContent, false, true); - return false; -} - -CXFA_ArcData CXFA_Value::GetArcData() { - return CXFA_ArcData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) - : nullptr); -} - -CXFA_LineData CXFA_Value::GetLineData() { - return CXFA_LineData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) - : nullptr); -} - -CXFA_RectangleData CXFA_Value::GetRectangleData() { - return CXFA_RectangleData( - m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr); -} - -CXFA_TextData CXFA_Value::GetTextData() { - return CXFA_TextData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) - : nullptr); -} - -CXFA_ExData CXFA_Value::GetExData() { - return CXFA_ExData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) - : nullptr); -} - -CXFA_ImageData CXFA_Value::GetImageData() { - return CXFA_ImageData( - m_pNode ? (m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) : nullptr, - true); -} diff --git a/xfa/fxfa/parser/cxfa_value.h b/xfa/fxfa/parser/cxfa_value.h deleted file mode 100644 index 193cc09cb7..0000000000 --- a/xfa/fxfa/parser/cxfa_value.h +++ /dev/null @@ -1,35 +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_VALUE_H_ -#define XFA_FXFA_PARSER_CXFA_VALUE_H_ - -#include "core/fxcrt/fx_string.h" -#include "xfa/fxfa/parser/cxfa_arcdata.h" -#include "xfa/fxfa/parser/cxfa_data.h" -#include "xfa/fxfa/parser/cxfa_exdata.h" -#include "xfa/fxfa/parser/cxfa_imagedata.h" -#include "xfa/fxfa/parser/cxfa_linedata.h" -#include "xfa/fxfa/parser/cxfa_rectangledata.h" -#include "xfa/fxfa/parser/cxfa_textdata.h" - -class CXFA_Node; - -class CXFA_Value : public CXFA_Data { - public: - explicit CXFA_Value(CXFA_Node* pNode) : CXFA_Data(pNode) {} - - XFA_Element GetChildValueClassID(); - bool GetChildValueContent(WideString& wsContent); - CXFA_ArcData GetArcData(); - CXFA_LineData GetLineData(); - CXFA_RectangleData GetRectangleData(); - CXFA_TextData GetTextData(); - CXFA_ExData GetExData(); - CXFA_ImageData GetImageData(); -}; - -#endif // XFA_FXFA_PARSER_CXFA_VALUE_H_ diff --git a/xfa/fxfa/parser/cxfa_valuedata.cpp b/xfa/fxfa/parser/cxfa_valuedata.cpp new file mode 100644 index 0000000000..f99689728c --- /dev/null +++ b/xfa/fxfa/parser/cxfa_valuedata.cpp @@ -0,0 +1,56 @@ +// 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_valuedata.h" + +#include "xfa/fxfa/parser/cxfa_node.h" + +XFA_Element CXFA_ValueData::GetChildValueClassID() { + if (!m_pNode) + return XFA_Element::Unknown; + if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) + return pNode->GetElementType(); + return XFA_Element::Unknown; +} + +bool CXFA_ValueData::GetChildValueContent(WideString& wsContent) { + if (!m_pNode) + return false; + if (CXFA_Node* pNode = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) + return pNode->JSNode()->TryContent(wsContent, false, true); + return false; +} + +CXFA_ArcData CXFA_ValueData::GetArcData() { + return CXFA_ArcData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) + : nullptr); +} + +CXFA_LineData CXFA_ValueData::GetLineData() { + return CXFA_LineData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) + : nullptr); +} + +CXFA_RectangleData CXFA_ValueData::GetRectangleData() { + return CXFA_RectangleData( + m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr); +} + +CXFA_TextData CXFA_ValueData::GetTextData() { + return CXFA_TextData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) + : nullptr); +} + +CXFA_ExData CXFA_ValueData::GetExData() { + return CXFA_ExData(m_pNode ? m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild) + : nullptr); +} + +CXFA_ImageData CXFA_ValueData::GetImageData() { + return CXFA_ImageData( + m_pNode ? (m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) : nullptr, + true); +} diff --git a/xfa/fxfa/parser/cxfa_valuedata.h b/xfa/fxfa/parser/cxfa_valuedata.h new file mode 100644 index 0000000000..a1f1e410c0 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_valuedata.h @@ -0,0 +1,35 @@ +// 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_VALUEDATA_H_ +#define XFA_FXFA_PARSER_CXFA_VALUEDATA_H_ + +#include "core/fxcrt/fx_string.h" +#include "xfa/fxfa/parser/cxfa_arcdata.h" +#include "xfa/fxfa/parser/cxfa_data.h" +#include "xfa/fxfa/parser/cxfa_exdata.h" +#include "xfa/fxfa/parser/cxfa_imagedata.h" +#include "xfa/fxfa/parser/cxfa_linedata.h" +#include "xfa/fxfa/parser/cxfa_rectangledata.h" +#include "xfa/fxfa/parser/cxfa_textdata.h" + +class CXFA_Node; + +class CXFA_ValueData : public CXFA_Data { + public: + explicit CXFA_ValueData(CXFA_Node* pNode) : CXFA_Data(pNode) {} + + XFA_Element GetChildValueClassID(); + bool GetChildValueContent(WideString& wsContent); + CXFA_ArcData GetArcData(); + CXFA_LineData GetLineData(); + CXFA_RectangleData GetRectangleData(); + CXFA_TextData GetTextData(); + CXFA_ExData GetExData(); + CXFA_ImageData GetImageData(); +}; + +#endif // XFA_FXFA_PARSER_CXFA_VALUEDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index d5b1609aea..56335305ef 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -69,9 +69,9 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { eWidgetType = XFA_Element::Unknown; XFA_Element eUIType = XFA_Element::Unknown; - CXFA_Value defValue( + CXFA_ValueData defValueData( pNode->JSNode()->GetProperty(0, XFA_Element::Value, true)); - XFA_Element eValueType = defValue.GetChildValueClassID(); + XFA_Element eValueType = defValueData.GetChildValueClassID(); switch (eValueType) { case XFA_Element::Boolean: eUIType = XFA_Element::CheckButton; @@ -151,7 +151,7 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { if (!pUIChild) { if (eUIType == XFA_Element::Unknown) { eUIType = XFA_Element::TextEdit; - defValue.GetNode()->JSNode()->GetProperty(0, XFA_Element::Text, true); + defValueData.GetNode()->JSNode()->GetProperty(0, XFA_Element::Text, true); } return pUI->JSNode()->GetProperty(0, eUIType, true); } @@ -193,7 +193,7 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { eValueType = XFA_Element::Text; break; } - defValue.GetNode()->JSNode()->GetProperty(0, eValueType, true); + defValueData.GetNode()->JSNode()->GetProperty(0, eValueType, true); return pUIChild; } @@ -332,15 +332,15 @@ std::vector CXFA_WidgetData::GetEventByActivity(int32_t iActivity, return events; } -CXFA_Value CXFA_WidgetData::GetDefaultValue() { +CXFA_ValueData CXFA_WidgetData::GetDefaultValueData() { CXFA_Node* pTemNode = m_pNode->GetTemplateNode(); - return CXFA_Value( + return CXFA_ValueData( pTemNode ? pTemNode->JSNode()->GetProperty(0, XFA_Element::Value, false) : nullptr); } -CXFA_Value CXFA_WidgetData::GetFormValue() { - return CXFA_Value( +CXFA_ValueData CXFA_WidgetData::GetFormValueData() { + return CXFA_ValueData( m_pNode->JSNode()->GetProperty(0, XFA_Element::Value, false)); } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 40ee92d299..6de00edea1 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -58,8 +58,8 @@ class CXFA_WidgetData : public CXFA_Data { std::vector GetEventList(); std::vector GetEventByActivity(int32_t iActivity, bool bIsFormReady); - CXFA_Value GetDefaultValue(); - CXFA_Value GetFormValue(); + CXFA_ValueData GetDefaultValueData(); + CXFA_ValueData GetFormValueData(); CXFA_CalculateData GetCalculateData(); CXFA_ValidateData GetValidateData(bool bModified); diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 64d38bf0da..58ce5301cb 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -128,14 +128,14 @@ void CreateDataBinding(CXFA_Node* pFormNode, CXFA_WidgetData* pWidgetData = pFormNode->GetWidgetData(); ASSERT(pWidgetData); XFA_Element eUIType = pWidgetData->GetUIType(); - CXFA_Value defValue( + CXFA_ValueData defValueData( pFormNode->JSNode()->GetProperty(0, XFA_Element::Value, true)); if (!bDataToForm) { WideString wsValue; WideString wsFormattedValue; switch (eUIType) { case XFA_Element::ImageEdit: { - CXFA_ImageData imageData = defValue.GetImageData(); + CXFA_ImageData imageData = defValueData.GetImageData(); WideString wsContentType; WideString wsHref; if (imageData) { @@ -157,7 +157,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, break; } case XFA_Element::ChoiceList: - defValue.GetChildValueContent(wsValue); + defValueData.GetChildValueContent(wsValue); if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { std::vector wsSelTextArray = pWidgetData->GetSelectedItemsValue(); @@ -185,7 +185,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, } break; case XFA_Element::CheckButton: - defValue.GetChildValueContent(wsValue); + defValueData.GetChildValueContent(wsValue); if (wsValue.IsEmpty()) break; @@ -204,8 +204,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (!pValue) continue; - CXFA_Value valueChild(pValue); - valueChild.GetChildValueContent(wsValue); + CXFA_ValueData(pValue).GetChildValueContent(wsValue); if (wsValue.IsEmpty()) continue; @@ -256,7 +255,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, break; } case XFA_Element::NumericEdit: { - defValue.GetChildValueContent(wsValue); + defValueData.GetChildValueContent(wsValue); if (wsValue.IsEmpty()) break; @@ -272,7 +271,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, break; } default: - defValue.GetChildValueContent(wsValue); + defValueData.GetChildValueContent(wsValue); if (wsValue.IsEmpty()) break; @@ -292,9 +291,9 @@ void CreateDataBinding(CXFA_Node* pFormNode, false); switch (eUIType) { case XFA_Element::ImageEdit: { - FormValueNode_SetChildContent(defValue.GetNode(), wsNormalizeValue, + FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, XFA_Element::Image); - CXFA_ImageData imageData = defValue.GetImageData(); + CXFA_ImageData imageData = defValueData.GetImageData(); if (imageData) { CFX_XMLElement* pXMLDataElement = static_cast(pDataNode->GetXMLMappingNode()); @@ -328,19 +327,19 @@ void CreateDataBinding(CXFA_Node* pFormNode, wsItem = single ? wsItem : wsItem + L"\n"; wsNormalizeValue += wsItem; } - CXFA_ExData exData = defValue.GetExData(); + CXFA_ExData exData = defValueData.GetExData(); ASSERT(exData); exData.SetContentType(single ? L"text/plain" : L"text/xml"); } - FormValueNode_SetChildContent(defValue.GetNode(), wsNormalizeValue, + FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, XFA_Element::ExData); } else { - FormValueNode_SetChildContent(defValue.GetNode(), wsNormalizeValue, + FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, XFA_Element::Text); } break; case XFA_Element::CheckButton: - FormValueNode_SetChildContent(defValue.GetNode(), wsNormalizeValue, + FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, XFA_Element::Text); break; case XFA_Element::ExclGroup: { @@ -349,7 +348,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, break; } case XFA_Element::DateTimeEdit: - FormValueNode_SetChildContent(defValue.GetNode(), wsNormalizeValue, + FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, XFA_Element::DateTime); break; case XFA_Element::NumericEdit: { @@ -360,7 +359,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, pWidgetData->NormalizeNumStr(wsNormalizeValue, wsOutput); wsNormalizeValue = wsOutput; } - FormValueNode_SetChildContent(defValue.GetNode(), wsNormalizeValue, + FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, XFA_Element::Float); break; } @@ -370,7 +369,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, case XFA_Element::Signature: case XFA_Element::TextEdit: default: - FormValueNode_SetChildContent(defValue.GetNode(), wsNormalizeValue, + FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, XFA_Element::Text); break; } -- cgit v1.2.3