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 --- BUILD.gn | 4 +- fxjs/cjx_node.cpp | 4 +- xfa/fxfa/cxfa_ffarc.cpp | 6 +-- xfa/fxfa/cxfa_ffdatetimeedit.cpp | 4 +- xfa/fxfa/cxfa_ffimage.cpp | 3 +- xfa/fxfa/cxfa_ffimageedit.cpp | 4 +- xfa/fxfa/cxfa_ffline.cpp | 6 +-- xfa/fxfa/cxfa_ffrectangle.cpp | 6 +-- xfa/fxfa/cxfa_widgetacc.cpp | 30 ++++++------- xfa/fxfa/cxfa_widgetacc.h | 2 +- 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 +++++++-------- 19 files changed, 156 insertions(+), 158 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 diff --git a/BUILD.gn b/BUILD.gn index 7f7ea5b324..c4919cc2ec 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1886,10 +1886,10 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h", "xfa/fxfa/parser/cxfa_validatedata.cpp", "xfa/fxfa/parser/cxfa_validatedata.h", - "xfa/fxfa/parser/cxfa_value.cpp", - "xfa/fxfa/parser/cxfa_value.h", "xfa/fxfa/parser/cxfa_valuearray.cpp", "xfa/fxfa/parser/cxfa_valuearray.h", + "xfa/fxfa/parser/cxfa_valuedata.cpp", + "xfa/fxfa/parser/cxfa_valuedata.h", "xfa/fxfa/parser/cxfa_widgetdata.cpp", "xfa/fxfa/parser/cxfa_widgetdata.h", "xfa/fxfa/parser/cxfa_xmllocale.cpp", diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index 1e76790f54..8bc54a7705 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -1691,8 +1691,8 @@ void CJX_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, pValue->SetNull(); } else { CXFA_Node* pUIChild = pWidgetData->GetUIChild(); - CXFA_Value defVal = pWidgetData->GetFormValue(); - CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); + CXFA_Node* pNode = pWidgetData->GetFormValueData().GetNode()->GetNodeItem( + XFA_NODEITEM_FirstChild); if (pNode && pNode->GetElementType() == XFA_Element::Decimal) { if (pUIChild->GetElementType() == XFA_Element::NumericEdit && (pNode->JSNode()->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { diff --git a/xfa/fxfa/cxfa_ffarc.cpp b/xfa/fxfa/cxfa_ffarc.cpp index 8802febc93..e1174008ec 100644 --- a/xfa/fxfa/cxfa_ffarc.cpp +++ b/xfa/fxfa/cxfa_ffarc.cpp @@ -16,8 +16,8 @@ void CXFA_FFArc::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Value value = m_pDataAcc->GetFormValue(); - if (!value) + CXFA_ValueData valueData = m_pDataAcc->GetFormValueData(); + if (!valueData) return; CFX_RectF rtArc = GetRectWithoutRotate(); @@ -27,5 +27,5 @@ void CXFA_FFArc::RenderWidget(CXFA_Graphics* pGS, CFX_Matrix mtRotate = GetRotateMatrix(); mtRotate.Concat(matrix); - DrawBorder(pGS, value.GetArcData(), rtArc, mtRotate); + DrawBorder(pGS, valueData.GetArcData(), rtArc, mtRotate); } diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp index c2ebb91bc9..65c32d517b 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp +++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp @@ -49,8 +49,8 @@ bool CXFA_FFDateTimeEdit::LoadWidget() { WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pWidget->SetEditText(wsText); - if (CXFA_Value value = m_pDataAcc->GetFormValue()) { - switch (value.GetChildValueClassID()) { + if (CXFA_ValueData valueData = m_pDataAcc->GetFormValueData()) { + switch (valueData.GetChildValueClassID()) { case XFA_Element::Date: { if (!wsText.IsEmpty()) { CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get()); diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index f148ea12b4..61f50be9ba 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -59,8 +59,7 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, iVertAlign = paraData.GetVerticalAlign(); } - CXFA_Value value = m_pDataAcc->GetFormValue(); - int32_t iAspect = value.GetImageData().GetAspect(); + int32_t iAspect = m_pDataAcc->GetFormValueData().GetImageData().GetAspect(); int32_t iImageXDpi = 0; int32_t iImageYDpi = 0; m_pDataAcc->GetImageDpi(iImageXDpi, iImageYDpi); diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp index 5140393b6e..41f659e8f3 100644 --- a/xfa/fxfa/cxfa_ffimageedit.cpp +++ b/xfa/fxfa/cxfa_ffimageedit.cpp @@ -76,8 +76,8 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS, } int32_t iAspect = XFA_ATTRIBUTEENUM_Fit; - if (CXFA_Value value = m_pDataAcc->GetFormValue()) { - if (CXFA_ImageData imageData = value.GetImageData()) + if (CXFA_ValueData valueData = m_pDataAcc->GetFormValueData()) { + if (CXFA_ImageData imageData = valueData.GetImageData()) iAspect = imageData.GetAspect(); } diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp index 97afaea462..de37e50bf9 100644 --- a/xfa/fxfa/cxfa_ffline.cpp +++ b/xfa/fxfa/cxfa_ffline.cpp @@ -53,11 +53,11 @@ void CXFA_FFLine::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Value value = m_pDataAcc->GetFormValue(); - if (!value) + CXFA_ValueData valueData = m_pDataAcc->GetFormValueData(); + if (!valueData) return; - CXFA_LineData lineData = value.GetLineData(); + CXFA_LineData lineData = valueData.GetLineData(); FX_ARGB lineColor = 0xFF000000; int32_t iStrokeType = 0; float fLineWidth = 1.0f; diff --git a/xfa/fxfa/cxfa_ffrectangle.cpp b/xfa/fxfa/cxfa_ffrectangle.cpp index 5305d17950..855520e31d 100644 --- a/xfa/fxfa/cxfa_ffrectangle.cpp +++ b/xfa/fxfa/cxfa_ffrectangle.cpp @@ -17,8 +17,8 @@ void CXFA_FFRectangle::RenderWidget(CXFA_Graphics* pGS, if (!IsMatchVisibleStatus(dwStatus)) return; - CXFA_Value value = m_pDataAcc->GetFormValue(); - if (!value) + CXFA_ValueData valueData = m_pDataAcc->GetFormValueData(); + if (!valueData) return; CFX_RectF rect = GetRectWithoutRotate(); @@ -28,5 +28,5 @@ void CXFA_FFRectangle::RenderWidget(CXFA_Graphics* pGS, CFX_Matrix mtRotate = GetRotateMatrix(); mtRotate.Concat(matrix); - DrawBorder(pGS, value.GetRectangleData(), rect, mtRotate); + DrawBorder(pGS, valueData.GetRectangleData(), rect, mtRotate); } diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 1e005791a2..07745eabe6 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -77,11 +77,11 @@ class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData { if (m_pDIBitmap) return true; - CXFA_Value value = pAcc->GetFormValue(); - if (!value) + CXFA_ValueData valueData = pAcc->GetFormValueData(); + if (!valueData) return false; - CXFA_ImageData imageData = value.GetImageData(); + CXFA_ImageData imageData = valueData.GetImageData(); if (!imageData) return false; @@ -137,11 +137,11 @@ class CXFA_ImageEditData : public CXFA_FieldLayoutData { if (m_pDIBitmap) return true; - CXFA_Value value = pAcc->GetFormValue(); - if (!value) + CXFA_ValueData valueData = pAcc->GetFormValueData(); + if (!valueData) return false; - CXFA_ImageData imageData = value.GetImageData(); + CXFA_ImageData imageData = valueData.GetImageData(); CXFA_FFDoc* pFFDoc = pAcc->GetDoc(); pAcc->SetImageEditImage(XFA_LoadImageData(pFFDoc, &imageData, m_bNamedImage, m_iImageXDpi, m_iImageYDpi)); @@ -178,8 +178,8 @@ void CXFA_WidgetAcc::ResetData() { XFA_Element eUIType = GetUIType(); switch (eUIType) { case XFA_Element::ImageEdit: { - CXFA_Value imageValue = GetDefaultValue(); - CXFA_ImageData imageData = imageValue.GetImageData(); + CXFA_ValueData imageValueData = GetDefaultValueData(); + CXFA_ImageData imageData = imageValueData.GetImageData(); WideString wsContentType, wsHref; if (imageData) { imageData.GetContent(wsValue); @@ -199,9 +199,9 @@ void CXFA_WidgetAcc::ResetData() { if (!pAcc) continue; - CXFA_Value defValue(nullptr); - if (wsValue.IsEmpty() && (defValue = pAcc->GetDefaultValue())) { - defValue.GetChildValueContent(wsValue); + CXFA_ValueData defValueData(nullptr); + if (wsValue.IsEmpty() && (defValueData = pAcc->GetDefaultValueData())) { + defValueData.GetChildValueContent(wsValue); SetValue(wsValue, XFA_VALUEPICTURE_Raw); pAcc->SetValue(wsValue, XFA_VALUEPICTURE_Raw); } else { @@ -226,8 +226,8 @@ void CXFA_WidgetAcc::ResetData() { case XFA_Element::ChoiceList: ClearAllSelections(); default: - if (CXFA_Value defValue = GetDefaultValue()) - defValue.GetChildValueContent(wsValue); + if (CXFA_ValueData defValueData = GetDefaultValueData()) + defValueData.GetChildValueContent(wsValue); SetValue(wsValue, XFA_VALUEPICTURE_Raw); break; @@ -237,7 +237,7 @@ void CXFA_WidgetAcc::ResetData() { void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType, const WideString& wsHref, const WideString& wsData) { - CXFA_ImageData imageData = GetFormValue().GetImageData(); + CXFA_ImageData imageData = GetFormValueData().GetImageData(); if (imageData) { imageData.SetContentType(WideString(wsContentType)); imageData.SetHref(wsHref); @@ -505,7 +505,7 @@ WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) { if (!bVersionFlag) { if (CXFA_CaptionData captionData = GetCaptionData()) { - if (CXFA_Value capValue = captionData.GetValue()) { + if (CXFA_ValueData capValue = captionData.GetValueData()) { if (CXFA_TextData captionTextData = capValue.GetTextData()) captionTextData.GetContent(wsCaptionName); } diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h index 036a6734b2..7c54f3d1d5 100644 --- a/xfa/fxfa/cxfa_widgetacc.h +++ b/xfa/fxfa/cxfa_widgetacc.h @@ -19,7 +19,7 @@ #include "xfa/fxfa/parser/cxfa_imagedata.h" #include "xfa/fxfa/parser/cxfa_margindata.h" #include "xfa/fxfa/parser/cxfa_scriptdata.h" -#include "xfa/fxfa/parser/cxfa_value.h" +#include "xfa/fxfa/parser/cxfa_valuedata.h" #include "xfa/fxfa/parser/cxfa_widgetdata.h" class CFGAS_GEFont; 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