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

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

Issue 1862123003: Rename both As{Byte,Wide}StringC() helpers to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, fix new usage. 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_document_serialize.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.AsWideStringC(), 135 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
136 wsFormatedValue);
137 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 136 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
138 pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); 137 pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
139 if (!wsHref.IsEmpty()) { 138 if (!wsHref.IsEmpty()) {
140 pXMLDataElement->SetString(FX_WSTRC(L"href"), wsHref); 139 pXMLDataElement->SetString(FX_WSTRC(L"href"), wsHref);
141 } 140 }
142 } break; 141 } break;
143 case XFA_ELEMENT_ChoiceList: 142 case XFA_ELEMENT_ChoiceList:
144 defValue.GetChildValueContent(wsValue); 143 defValue.GetChildValueContent(wsValue);
145 if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { 144 if (pWidgetData->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
146 CFX_WideStringArray wsSelTextArray; 145 CFX_WideStringArray wsSelTextArray;
147 pWidgetData->GetSelectedItemsValue(wsSelTextArray); 146 pWidgetData->GetSelectedItemsValue(wsSelTextArray);
148 int32_t iSize = wsSelTextArray.GetSize(); 147 int32_t iSize = wsSelTextArray.GetSize();
149 if (iSize >= 1) { 148 if (iSize >= 1) {
150 CXFA_Node* pValue = NULL; 149 CXFA_Node* pValue = NULL;
151 for (int32_t i = 0; i < iSize; i++) { 150 for (int32_t i = 0; i < iSize; i++) {
152 pValue = pDataNode->CreateSamePacketNode(XFA_ELEMENT_DataValue); 151 pValue = pDataNode->CreateSamePacketNode(XFA_ELEMENT_DataValue);
153 pValue->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"value")); 152 pValue->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"value"));
154 pValue->CreateXMLMappingNode(); 153 pValue->CreateXMLMappingNode();
155 pDataNode->InsertChild(pValue); 154 pDataNode->InsertChild(pValue);
156 pValue->SetCData(XFA_ATTRIBUTE_Value, wsSelTextArray[i]); 155 pValue->SetCData(XFA_ATTRIBUTE_Value, wsSelTextArray[i]);
157 } 156 }
158 } else { 157 } else {
159 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); 158 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
160 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); 159 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element);
161 static_cast<CFDE_XMLElement*>(pXMLNode) 160 static_cast<CFDE_XMLElement*>(pXMLNode)
162 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); 161 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup"));
163 } 162 }
164 } else if (!wsValue.IsEmpty()) { 163 } else if (!wsValue.IsEmpty()) {
165 pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), 164 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
166 wsFormatedValue);
167 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 165 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
168 } 166 }
169 break; 167 break;
170 case XFA_ELEMENT_CheckButton: 168 case XFA_ELEMENT_CheckButton:
171 defValue.GetChildValueContent(wsValue); 169 defValue.GetChildValueContent(wsValue);
172 if (wsValue.IsEmpty()) { 170 if (wsValue.IsEmpty()) {
173 break; 171 break;
174 } 172 }
175 pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), 173 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
176 wsFormatedValue);
177 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 174 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
178 break; 175 break;
179 case XFA_ELEMENT_ExclGroup: { 176 case XFA_ELEMENT_ExclGroup: {
180 CXFA_Node* pChecked = NULL; 177 CXFA_Node* pChecked = NULL;
181 CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); 178 CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
182 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 179 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
183 if (pChild->GetClassID() != XFA_ELEMENT_Field) { 180 if (pChild->GetClassID() != XFA_ELEMENT_Field) {
184 continue; 181 continue;
185 } 182 }
186 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
236 } 233 }
237 } break; 234 } break;
238 case XFA_ELEMENT_NumericEdit: { 235 case XFA_ELEMENT_NumericEdit: {
239 defValue.GetChildValueContent(wsValue); 236 defValue.GetChildValueContent(wsValue);
240 if (wsValue.IsEmpty()) { 237 if (wsValue.IsEmpty()) {
241 break; 238 break;
242 } 239 }
243 CFX_WideString wsOutput; 240 CFX_WideString wsOutput;
244 pWidgetData->NormalizeNumStr(wsValue, wsOutput); 241 pWidgetData->NormalizeNumStr(wsValue, wsOutput);
245 wsValue = wsOutput; 242 wsValue = wsOutput;
246 pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), 243 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
247 wsFormatedValue);
248 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 244 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
249 CXFA_Node* pValue = pFormNode->GetProperty(0, XFA_ELEMENT_Value); 245 CXFA_Node* pValue = pFormNode->GetProperty(0, XFA_ELEMENT_Value);
250 XFA_DataMerge_FormValueNode_SetChildContent(pValue, wsValue, 246 XFA_DataMerge_FormValueNode_SetChildContent(pValue, wsValue,
251 XFA_ELEMENT_Float); 247 XFA_ELEMENT_Float);
252 } break; 248 } break;
253 default: 249 default:
254 defValue.GetChildValueContent(wsValue); 250 defValue.GetChildValueContent(wsValue);
255 if (wsValue.IsEmpty()) { 251 if (wsValue.IsEmpty()) {
256 break; 252 break;
257 } 253 }
258 pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), 254 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatedValue);
259 wsFormatedValue);
260 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); 255 pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
261 break; 256 break;
262 } 257 }
263 } else { 258 } else {
264 CFX_WideString wsXMLValue; 259 CFX_WideString wsXMLValue;
265 pDataNode->TryContent(wsXMLValue); 260 pDataNode->TryContent(wsXMLValue);
266 CFX_WideString wsNormailizeValue; 261 CFX_WideString wsNormailizeValue;
267 pWidgetData->GetNormalizeDataValue(wsXMLValue.AsWideStringC(), 262 pWidgetData->GetNormalizeDataValue(wsXMLValue.AsStringC(),
268 wsNormailizeValue); 263 wsNormailizeValue);
269 pDataNode->SetAttributeValue(wsNormailizeValue, wsXMLValue); 264 pDataNode->SetAttributeValue(wsNormailizeValue, wsXMLValue);
270 switch (eUIType) { 265 switch (eUIType) {
271 case XFA_ELEMENT_ImageEdit: { 266 case XFA_ELEMENT_ImageEdit: {
272 XFA_DataMerge_FormValueNode_SetChildContent( 267 XFA_DataMerge_FormValueNode_SetChildContent(
273 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Image); 268 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Image);
274 CXFA_Image image = defValue.GetImage(); 269 CXFA_Image image = defValue.GetImage();
275 if (image) { 270 if (image) {
276 CFDE_XMLElement* pXMLDataElement = 271 CFDE_XMLElement* pXMLDataElement =
277 static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode()); 272 static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } else { 307 } else {
313 XFA_DataMerge_FormValueNode_SetChildContent( 308 XFA_DataMerge_FormValueNode_SetChildContent(
314 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Text); 309 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Text);
315 } 310 }
316 break; 311 break;
317 case XFA_ELEMENT_CheckButton: 312 case XFA_ELEMENT_CheckButton:
318 XFA_DataMerge_FormValueNode_SetChildContent( 313 XFA_DataMerge_FormValueNode_SetChildContent(
319 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Text); 314 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Text);
320 break; 315 break;
321 case XFA_ELEMENT_ExclGroup: { 316 case XFA_ELEMENT_ExclGroup: {
322 pWidgetData->SetSelectedMemberByValue(wsNormailizeValue.AsWideStringC(), 317 pWidgetData->SetSelectedMemberByValue(wsNormailizeValue.AsStringC(),
323 bNotify, FALSE, FALSE); 318 bNotify, FALSE, FALSE);
324 } break; 319 } break;
325 case XFA_ELEMENT_DateTimeEdit: 320 case XFA_ELEMENT_DateTimeEdit:
326 XFA_DataMerge_FormValueNode_SetChildContent( 321 XFA_DataMerge_FormValueNode_SetChildContent(
327 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_DateTime); 322 defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_DateTime);
328 break; 323 break;
329 case XFA_ELEMENT_NumericEdit: { 324 case XFA_ELEMENT_NumericEdit: {
330 CFX_WideString wsPicture; 325 CFX_WideString wsPicture;
331 pWidgetData->GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); 326 pWidgetData->GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind);
332 if (wsPicture.IsEmpty()) { 327 if (wsPicture.IsEmpty()) {
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 } 1425 }
1431 pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); 1426 pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, NULL);
1432 } 1427 }
1433 XFA_DataMerge_ClearGlobalBinding(this); 1428 XFA_DataMerge_ClearGlobalBinding(this);
1434 if (bDoDataMerge) { 1429 if (bDoDataMerge) {
1435 DoDataMerge(); 1430 DoDataMerge();
1436 } 1431 }
1437 CXFA_LayoutProcessor* pLayoutProcessor = GetLayoutProcessor(); 1432 CXFA_LayoutProcessor* pLayoutProcessor = GetLayoutProcessor();
1438 pLayoutProcessor->SetForceReLayout(TRUE); 1433 pLayoutProcessor->SetForceReLayout(TRUE);
1439 } 1434 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_widgetdata.cpp ('k') | xfa/fxfa/parser/xfa_document_serialize.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698