Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: xfa/fxfa/parser/xfa_document_datamerger_imp.cpp

Issue 1889983002: Change string argument type to GetFormatDataValue. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_widgetdata.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" 7 #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fde/xml/fde_xml_imp.h" 10 #include "xfa/fde/xml/fde_xml_imp.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 CFX_WideString wsContentType; 125 CFX_WideString wsContentType;
126 CFX_WideString wsHref; 126 CFX_WideString wsHref;
127 if (image) { 127 if (image) {
128 image.GetContent(wsValue); 128 image.GetContent(wsValue);
129 image.GetContentType(wsContentType); 129 image.GetContentType(wsContentType);
130 image.GetHref(wsHref); 130 image.GetHref(wsHref);
131 } 131 }
132 CFDE_XMLElement* pXMLDataElement = 132 CFDE_XMLElement* pXMLDataElement =
133 static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode()); 133 static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode());
134 FXSYS_assert(pXMLDataElement); 134 FXSYS_assert(pXMLDataElement);
135 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue); 135 pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
136 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 136 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
137 pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); 137 pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
138 if (!wsHref.IsEmpty()) { 138 if (!wsHref.IsEmpty()) {
139 pXMLDataElement->SetString(FX_WSTRC(L"href"), wsHref); 139 pXMLDataElement->SetString(FX_WSTRC(L"href"), wsHref);
140 } 140 }
141 } break; 141 } break;
142 case XFA_ELEMENT_ChoiceList: 142 case XFA_ELEMENT_ChoiceList:
143 defValue.GetChildValueContent(wsValue); 143 defValue.GetChildValueContent(wsValue);
144 if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { 144 if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
145 CFX_WideStringArray wsSelTextArray; 145 CFX_WideStringArray wsSelTextArray;
146 pWidgetData->GetSelectedItemsValue(wsSelTextArray); 146 pWidgetData->GetSelectedItemsValue(wsSelTextArray);
147 int32_t iSize = wsSelTextArray.GetSize(); 147 int32_t iSize = wsSelTextArray.GetSize();
148 if (iSize >= 1) { 148 if (iSize >= 1) {
149 CXFA_Node* pValue = NULL; 149 CXFA_Node* pValue = NULL;
150 for (int32_t i = 0; i < iSize; i++) { 150 for (int32_t i = 0; i < iSize; i++) {
151 pValue = pDataNode->CreateSamePacketNode(XFA_ELEMENT_DataValue); 151 pValue = pDataNode->CreateSamePacketNode(XFA_ELEMENT_DataValue);
152 pValue->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"value")); 152 pValue->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"value"));
153 pValue->CreateXMLMappingNode(); 153 pValue->CreateXMLMappingNode();
154 pDataNode->InsertChild(pValue); 154 pDataNode->InsertChild(pValue);
155 pValue->SetCData(XFA_ATTRIBUTE_Value, wsSelTextArray[i]); 155 pValue->SetCData(XFA_ATTRIBUTE_Value, wsSelTextArray[i]);
156 } 156 }
157 } else { 157 } else {
158 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); 158 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
159 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); 159 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element);
160 static_cast<CFDE_XMLElement*>(pXMLNode) 160 static_cast<CFDE_XMLElement*>(pXMLNode)
161 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); 161 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup"));
162 } 162 }
163 } else if (!wsValue.IsEmpty()) { 163 } else if (!wsValue.IsEmpty()) {
164 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue); 164 pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
165 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 165 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
166 } 166 }
167 break; 167 break;
168 case XFA_ELEMENT_CheckButton: 168 case XFA_ELEMENT_CheckButton:
169 defValue.GetChildValueContent(wsValue); 169 defValue.GetChildValueContent(wsValue);
170 if (wsValue.IsEmpty()) { 170 if (wsValue.IsEmpty()) {
171 break; 171 break;
172 } 172 }
173 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue); 173 pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
174 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 174 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
175 break; 175 break;
176 case XFA_ELEMENT_ExclGroup: { 176 case XFA_ELEMENT_ExclGroup: {
177 CXFA_Node* pChecked = NULL; 177 CXFA_Node* pChecked = NULL;
178 CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); 178 CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
179 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 179 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
180 if (pChild->GetClassID() != XFA_ELEMENT_Field) { 180 if (pChild->GetClassID() != XFA_ELEMENT_Field) {
181 continue; 181 continue;
182 } 182 }
183 CXFA_Node* pValue = pChild->GetChild(0, XFA_ELEMENT_Value); 183 CXFA_Node* pValue = pChild->GetChild(0, XFA_ELEMENT_Value);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 } break; 234 } break;
235 case XFA_ELEMENT_NumericEdit: { 235 case XFA_ELEMENT_NumericEdit: {
236 defValue.GetChildValueContent(wsValue); 236 defValue.GetChildValueContent(wsValue);
237 if (wsValue.IsEmpty()) { 237 if (wsValue.IsEmpty()) {
238 break; 238 break;
239 } 239 }
240 CFX_WideString wsOutput; 240 CFX_WideString wsOutput;
241 pWidgetData->NormalizeNumStr(wsValue, wsOutput); 241 pWidgetData->NormalizeNumStr(wsValue, wsOutput);
242 wsValue = wsOutput; 242 wsValue = wsOutput;
243 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue); 243 pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
244 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 244 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
245 CXFA_Node* pValue = pFormNode->GetProperty(0, XFA_ELEMENT_Value); 245 CXFA_Node* pValue = pFormNode->GetProperty(0, XFA_ELEMENT_Value);
246 XFA_DataMerge_FormValueNode_SetChildContent(pValue, wsValue, 246 XFA_DataMerge_FormValueNode_SetChildContent(pValue, wsValue,
247 XFA_ELEMENT_Float); 247 XFA_ELEMENT_Float);
248 } break; 248 } break;
249 default: 249 default:
250 defValue.GetChildValueContent(wsValue); 250 defValue.GetChildValueContent(wsValue);
251 if (wsValue.IsEmpty()) { 251 if (wsValue.IsEmpty()) {
252 break; 252 break;
253 } 253 }
254 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue); 254 pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
255 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 255 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
256 break; 256 break;
257 } 257 }
258 } else { 258 } else {
259 CFX_WideString wsXMLValue; 259 CFX_WideString wsXMLValue;
260 pDataNode->TryContent(wsXMLValue); 260 pDataNode->TryContent(wsXMLValue);
261 CFX_WideString wsNormailizeValue; 261 CFX_WideString wsNormailizeValue;
262 pWidgetData->GetNormalizeDataValue(wsXMLValue.AsStringC(), 262 pWidgetData->GetNormalizeDataValue(wsXMLValue, wsNormailizeValue);
263 wsNormailizeValue);
264 pDataNode->SetAttributeValue(wsNormailizeValue, wsXMLValue); 263 pDataNode->SetAttributeValue(wsNormailizeValue, wsXMLValue);
265 switch (eUIType) { 264 switch (eUIType) {
266 case XFA_ELEMENT_ImageEdit: { 265 case XFA_ELEMENT_ImageEdit: {
267 XFA_DataMerge_FormValueNode_SetChildContent( 266 XFA_DataMerge_FormValueNode_SetChildContent(
268 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Image); 267 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Image);
269 CXFA_Image image = defValue.GetImage(); 268 CXFA_Image image = defValue.GetImage();
270 if (image) { 269 if (image) {
271 CFDE_XMLElement* pXMLDataElement = 270 CFDE_XMLElement* pXMLDataElement =
272 static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode()); 271 static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode());
273 FXSYS_assert(pXMLDataElement); 272 FXSYS_assert(pXMLDataElement);
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 } 1424 }
1426 pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); 1425 pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, NULL);
1427 } 1426 }
1428 XFA_DataMerge_ClearGlobalBinding(this); 1427 XFA_DataMerge_ClearGlobalBinding(this);
1429 if (bDoDataMerge) { 1428 if (bDoDataMerge) {
1430 DoDataMerge(); 1429 DoDataMerge();
1431 } 1430 }
1432 CXFA_LayoutProcessor* pLayoutProcessor = GetLayoutProcessor(); 1431 CXFA_LayoutProcessor* pLayoutProcessor = GetLayoutProcessor();
1433 pLayoutProcessor->SetForceReLayout(TRUE); 1432 pLayoutProcessor->SetForceReLayout(TRUE);
1434 } 1433 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_widgetdata.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698