OLD | NEW |
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_serialize.h" | 7 #include "xfa/fxfa/parser/xfa_document_serialize.h" |
8 | 8 |
9 #include "xfa/fde/xml/fde_xml_imp.h" | 9 #include "xfa/fde/xml/fde_xml_imp.h" |
10 #include "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 XFA_DataExporter_RegenerateFormFile_Changed(pChild, newBuf, bSaveXML); | 340 XFA_DataExporter_RegenerateFormFile_Changed(pChild, newBuf, bSaveXML); |
341 wsChildren += newBuf.AsStringC(); | 341 wsChildren += newBuf.AsStringC(); |
342 newBuf.Clear(); | 342 newBuf.Clear(); |
343 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 343 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); |
344 } | 344 } |
345 } | 345 } |
346 break; | 346 break; |
347 } | 347 } |
348 if (!wsChildren.IsEmpty() || !wsAttrs.IsEmpty() || | 348 if (!wsChildren.IsEmpty() || !wsAttrs.IsEmpty() || |
349 pNode->HasAttribute(XFA_ATTRIBUTE_Name)) { | 349 pNode->HasAttribute(XFA_ATTRIBUTE_Name)) { |
350 CFX_WideStringC wsElement; | 350 CFX_WideStringC wsElement = pNode->GetClassName(); |
351 pNode->GetClassName(wsElement); | |
352 CFX_WideString wsName; | 351 CFX_WideString wsName; |
353 XFA_SaveAttribute(pNode, XFA_ATTRIBUTE_Name, FX_WSTRC(L"name"), TRUE, | 352 XFA_SaveAttribute(pNode, XFA_ATTRIBUTE_Name, FX_WSTRC(L"name"), TRUE, |
354 wsName); | 353 wsName); |
355 buf << FX_WSTRC(L"<"); | 354 buf << FX_WSTRC(L"<"); |
356 buf << wsElement; | 355 buf << wsElement; |
357 buf << wsName; | 356 buf << wsName; |
358 buf << wsAttrs; | 357 buf << wsAttrs; |
359 if (wsChildren.IsEmpty()) { | 358 if (wsChildren.IsEmpty()) { |
360 buf << FX_WSTRC(L"\n/>"); | 359 buf << FX_WSTRC(L"\n/>"); |
361 } else { | 360 } else { |
(...skipping 13 matching lines...) Expand all Loading... |
375 if (eType == XFA_Element::Field || eType == XFA_Element::Draw || | 374 if (eType == XFA_Element::Field || eType == XFA_Element::Draw || |
376 !pNode->IsContainerNode()) { | 375 !pNode->IsContainerNode()) { |
377 CFX_WideTextBuf buf; | 376 CFX_WideTextBuf buf; |
378 XFA_DataExporter_RegenerateFormFile_Changed(pNode, buf, bSaveXML); | 377 XFA_DataExporter_RegenerateFormFile_Changed(pNode, buf, bSaveXML); |
379 FX_STRSIZE nLen = buf.GetLength(); | 378 FX_STRSIZE nLen = buf.GetLength(); |
380 if (nLen > 0) { | 379 if (nLen > 0) { |
381 pStream->WriteString((const FX_WCHAR*)buf.GetBuffer(), nLen); | 380 pStream->WriteString((const FX_WCHAR*)buf.GetBuffer(), nLen); |
382 } | 381 } |
383 return; | 382 return; |
384 } | 383 } |
385 CFX_WideStringC wsElement; | 384 CFX_WideStringC wsElement = pNode->GetClassName(); |
386 pNode->GetClassName(wsElement); | |
387 pStream->WriteString(L"<", 1); | 385 pStream->WriteString(L"<", 1); |
388 pStream->WriteString(wsElement.c_str(), wsElement.GetLength()); | 386 pStream->WriteString(wsElement.c_str(), wsElement.GetLength()); |
389 CFX_WideString wsOutput; | 387 CFX_WideString wsOutput; |
390 XFA_SaveAttribute(pNode, XFA_ATTRIBUTE_Name, FX_WSTRC(L"name"), TRUE, | 388 XFA_SaveAttribute(pNode, XFA_ATTRIBUTE_Name, FX_WSTRC(L"name"), TRUE, |
391 wsOutput); | 389 wsOutput); |
392 CFX_WideString wsAttrs; | 390 CFX_WideString wsAttrs; |
393 int32_t iAttrs = 0; | 391 int32_t iAttrs = 0; |
394 const uint8_t* pAttrs = | 392 const uint8_t* pAttrs = |
395 XFA_GetElementAttributes(pNode->GetElementType(), iAttrs); | 393 XFA_GetElementAttributes(pNode->GetElementType(), iAttrs); |
396 while (iAttrs--) { | 394 while (iAttrs--) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 pXMLElement->RemoveAttribute(L"xfa:dataNode"); | 570 pXMLElement->RemoveAttribute(L"xfa:dataNode"); |
573 } | 571 } |
574 } else { | 572 } else { |
575 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); | 573 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); |
576 ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); | 574 ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); |
577 static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode", | 575 static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode", |
578 L"dataGroup"); | 576 L"dataGroup"); |
579 } | 577 } |
580 } | 578 } |
581 } | 579 } |
OLD | NEW |