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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 XFA_DataExporter_RegenerateFormFile_Changed(pNode, buf, bSaveXML); | 382 XFA_DataExporter_RegenerateFormFile_Changed(pNode, buf, bSaveXML); |
383 FX_STRSIZE nLen = buf.GetLength(); | 383 FX_STRSIZE nLen = buf.GetLength(); |
384 if (nLen > 0) { | 384 if (nLen > 0) { |
385 pStream->WriteString((const FX_WCHAR*)buf.GetBuffer(), nLen); | 385 pStream->WriteString((const FX_WCHAR*)buf.GetBuffer(), nLen); |
386 } | 386 } |
387 return; | 387 return; |
388 } | 388 } |
389 CFX_WideStringC wsElement; | 389 CFX_WideStringC wsElement; |
390 pNode->GetClassName(wsElement); | 390 pNode->GetClassName(wsElement); |
391 pStream->WriteString(L"<", 1); | 391 pStream->WriteString(L"<", 1); |
392 pStream->WriteString(wsElement.GetPtr(), wsElement.GetLength()); | 392 pStream->WriteString(wsElement.raw_str(), wsElement.GetLength()); |
393 CFX_WideString wsOutput; | 393 CFX_WideString wsOutput; |
394 XFA_SaveAttribute(pNode, XFA_ATTRIBUTE_Name, FX_WSTRC(L"name"), TRUE, | 394 XFA_SaveAttribute(pNode, XFA_ATTRIBUTE_Name, FX_WSTRC(L"name"), TRUE, |
395 wsOutput); | 395 wsOutput); |
396 CFX_WideString wsAttrs; | 396 CFX_WideString wsAttrs; |
397 int32_t iAttrs = 0; | 397 int32_t iAttrs = 0; |
398 const uint8_t* pAttrs = XFA_GetElementAttributes(pNode->GetClassID(), iAttrs); | 398 const uint8_t* pAttrs = XFA_GetElementAttributes(pNode->GetClassID(), iAttrs); |
399 while (iAttrs--) { | 399 while (iAttrs--) { |
400 const XFA_ATTRIBUTEINFO* pAttr = | 400 const XFA_ATTRIBUTEINFO* pAttr = |
401 XFA_GetAttributeByID((XFA_ATTRIBUTE)pAttrs[iAttrs]); | 401 XFA_GetAttributeByID((XFA_ATTRIBUTE)pAttrs[iAttrs]); |
402 if (pAttr->eName == XFA_ATTRIBUTE_Name) { | 402 if (pAttr->eName == XFA_ATTRIBUTE_Name) { |
403 continue; | 403 continue; |
404 } | 404 } |
405 CFX_WideString wsAttr; | 405 CFX_WideString wsAttr; |
406 XFA_SaveAttribute(pNode, pAttr->eName, pAttr->pName, FALSE, wsAttr); | 406 XFA_SaveAttribute(pNode, pAttr->eName, pAttr->pName, FALSE, wsAttr); |
407 wsOutput += wsAttr; | 407 wsOutput += wsAttr; |
408 } | 408 } |
409 if (!wsOutput.IsEmpty()) { | 409 if (!wsOutput.IsEmpty()) { |
410 pStream->WriteString((const FX_WCHAR*)wsOutput, wsOutput.GetLength()); | 410 pStream->WriteString((const FX_WCHAR*)wsOutput, wsOutput.GetLength()); |
411 } | 411 } |
412 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 412 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
413 if (pChildNode) { | 413 if (pChildNode) { |
414 pStream->WriteString(L"\n>", 2); | 414 pStream->WriteString(L"\n>", 2); |
415 while (pChildNode) { | 415 while (pChildNode) { |
416 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream, | 416 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream, |
417 bSaveXML); | 417 bSaveXML); |
418 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 418 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
419 } | 419 } |
420 pStream->WriteString(L"</", 2); | 420 pStream->WriteString(L"</", 2); |
421 pStream->WriteString(wsElement.GetPtr(), wsElement.GetLength()); | 421 pStream->WriteString(wsElement.raw_str(), wsElement.GetLength()); |
422 pStream->WriteString(L"\n>", 2); | 422 pStream->WriteString(L"\n>", 2); |
423 } else { | 423 } else { |
424 pStream->WriteString(L"\n/>", 3); | 424 pStream->WriteString(L"\n/>", 3); |
425 } | 425 } |
426 } | 426 } |
427 void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, | 427 void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, |
428 IFX_Stream* pStream, | 428 IFX_Stream* pStream, |
429 const FX_CHAR* pChecksum, | 429 const FX_CHAR* pChecksum, |
430 FX_BOOL bSaveXML) { | 430 FX_BOOL bSaveXML) { |
431 if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { | 431 if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 pXMLElement->RemoveAttribute(L"xfa:dataNode"); | 577 pXMLElement->RemoveAttribute(L"xfa:dataNode"); |
578 } | 578 } |
579 } else { | 579 } else { |
580 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); | 580 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); |
581 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); | 581 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); |
582 static_cast<CFDE_XMLElement*>(pXMLNode) | 582 static_cast<CFDE_XMLElement*>(pXMLNode) |
583 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); | 583 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); |
584 } | 584 } |
585 } | 585 } |
586 } | 586 } |
OLD | NEW |