summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-23 17:02:23 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-23 17:02:23 +0000
commit6aec70bc09cb65b169fe6ca1af65e8929aeea43a (patch)
tree34d55cf15cba0fe71e87a896184ecdc891d4752f /xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
parentd49254bc9323883deba14d27026ec2bb9af096fa (diff)
downloadpdfium-6aec70bc09cb65b169fe6ca1af65e8929aeea43a.tar.xz
Cleanup CXFA_WidgetDatachromium/3277
This CL cleans up return values, out-params and changes simple methods to boolean checks where possible in CXFA_WidgetData. Change-Id: I29daa67993730f3e9d61cb6fdf918a886cc9120e Reviewed-on: https://pdfium-review.googlesource.com/19230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/xfa_document_datamerger_imp.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp52
1 files changed, 20 insertions, 32 deletions
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 2a3494f276..b2df645ebc 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -127,7 +127,6 @@ void CreateDataBinding(CXFA_Node* pFormNode,
pFormNode->JSNode()->GetProperty(0, XFA_Element::Value, true));
if (!bDataToForm) {
WideString wsValue;
- WideString wsFormattedValue;
switch (eUIType) {
case XFA_Element::ImageEdit: {
CXFA_ImageData imageData = defValueData.GetImageData();
@@ -141,9 +140,9 @@ void CreateDataBinding(CXFA_Node* pFormNode,
CFX_XMLElement* pXMLDataElement =
static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode());
ASSERT(pXMLDataElement);
- pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue);
- pDataNode->JSNode()->SetAttributeValue(wsValue, wsFormattedValue, false,
- false);
+
+ pDataNode->JSNode()->SetAttributeValue(
+ wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false);
pDataNode->JSNode()->SetCData(XFA_Attribute::ContentType, wsContentType,
false, false);
if (!wsHref.IsEmpty())
@@ -153,7 +152,7 @@ void CreateDataBinding(CXFA_Node* pFormNode,
}
case XFA_Element::ChoiceList:
wsValue = defValueData.GetChildValueContent();
- if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
+ if (pWidgetData->IsChoiceListMultiSelect()) {
std::vector<WideString> wsSelTextArray =
pWidgetData->GetSelectedItemsValue();
if (!wsSelTextArray.empty()) {
@@ -174,9 +173,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
L"dataGroup");
}
} else if (!wsValue.IsEmpty()) {
- pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue);
- pDataNode->JSNode()->SetAttributeValue(wsValue, wsFormattedValue,
- false, false);
+ pDataNode->JSNode()->SetAttributeValue(
+ wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false);
}
break;
case XFA_Element::CheckButton:
@@ -184,9 +182,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
if (wsValue.IsEmpty())
break;
- pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue);
- pDataNode->JSNode()->SetAttributeValue(wsValue, wsFormattedValue, false,
- false);
+ pDataNode->JSNode()->SetAttributeValue(
+ wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false);
break;
case XFA_Element::ExclGroup: {
CXFA_Node* pChecked = nullptr;
@@ -214,9 +211,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
WideString wsContent = pText->JSNode()->GetContent(false);
if (wsContent == wsValue) {
pChecked = pChild;
- wsFormattedValue = wsValue;
- pDataNode->JSNode()->SetAttributeValue(wsValue, wsFormattedValue,
- false, false);
+ pDataNode->JSNode()->SetAttributeValue(wsValue, wsValue, false,
+ false);
pFormNode->JSNode()->SetCData(XFA_Attribute::Value, wsContent,
false, false);
break;
@@ -253,12 +249,9 @@ void CreateDataBinding(CXFA_Node* pFormNode,
if (wsValue.IsEmpty())
break;
- WideString wsOutput;
- pWidgetData->NormalizeNumStr(wsValue, wsOutput);
- wsValue = wsOutput;
- pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue);
- pDataNode->JSNode()->SetAttributeValue(wsValue, wsFormattedValue, false,
- false);
+ wsValue = pWidgetData->NormalizeNumStr(wsValue);
+ pDataNode->JSNode()->SetAttributeValue(
+ wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false);
CXFA_Node* pValue =
pFormNode->JSNode()->GetProperty(0, XFA_Element::Value, true);
FormValueNode_SetChildContent(pValue, wsValue, XFA_Element::Float);
@@ -269,18 +262,15 @@ void CreateDataBinding(CXFA_Node* pFormNode,
if (wsValue.IsEmpty())
break;
- pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue);
- pDataNode->JSNode()->SetAttributeValue(wsValue, wsFormattedValue, false,
- false);
+ pDataNode->JSNode()->SetAttributeValue(
+ wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false);
break;
}
return;
}
WideString wsXMLValue = pDataNode->JSNode()->GetContent(false);
-
- WideString wsNormalizeValue;
- pWidgetData->GetNormalizeDataValue(wsXMLValue, wsNormalizeValue);
+ WideString wsNormalizeValue = pWidgetData->GetNormalizeDataValue(wsXMLValue);
pDataNode->JSNode()->SetAttributeValue(wsNormalizeValue, wsXMLValue, false,
false);
@@ -309,7 +299,7 @@ void CreateDataBinding(CXFA_Node* pFormNode,
break;
}
case XFA_Element::ChoiceList:
- if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
+ if (pWidgetData->IsChoiceListMultiSelect()) {
std::vector<CXFA_Node*> items = pDataNode->GetNodeList(
XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties,
XFA_Element::Unknown);
@@ -352,11 +342,9 @@ void CreateDataBinding(CXFA_Node* pFormNode,
case XFA_Element::NumericEdit: {
WideString wsPicture =
pWidgetData->GetPictureContent(XFA_VALUEPICTURE_DataBind);
- if (wsPicture.IsEmpty()) {
- WideString wsOutput;
- pWidgetData->NormalizeNumStr(wsNormalizeValue, wsOutput);
- wsNormalizeValue = wsOutput;
- }
+ if (wsPicture.IsEmpty())
+ wsNormalizeValue = pWidgetData->NormalizeNumStr(wsNormalizeValue);
+
FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue,
XFA_Element::Float);
break;