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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 break; | 253 break; |
254 } | 254 } |
255 IFX_MemoryStream* pMemStream = FX_CreateMemoryStream(TRUE); | 255 IFX_MemoryStream* pMemStream = FX_CreateMemoryStream(TRUE); |
256 IFX_Stream* pTempStream = IFX_Stream::CreateStream( | 256 IFX_Stream* pTempStream = IFX_Stream::CreateStream( |
257 (IFX_FileWrite*)pMemStream, FX_STREAMACCESS_Text | | 257 (IFX_FileWrite*)pMemStream, FX_STREAMACCESS_Text | |
258 FX_STREAMACCESS_Write | | 258 FX_STREAMACCESS_Write | |
259 FX_STREAMACCESS_Append); | 259 FX_STREAMACCESS_Append); |
260 pTempStream->SetCodePage(FX_CODEPAGE_UTF8); | 260 pTempStream->SetCodePage(FX_CODEPAGE_UTF8); |
261 pRichTextXML->SaveXMLNode(pTempStream); | 261 pRichTextXML->SaveXMLNode(pTempStream); |
262 wsChildren += CFX_WideString::FromUTF8( | 262 wsChildren += CFX_WideString::FromUTF8( |
263 (const FX_CHAR*)pMemStream->GetBuffer(), pMemStream->GetSize()); | 263 CFX_ByteStringC(pMemStream->GetBuffer(), pMemStream->GetSize())); |
264 pTempStream->Release(); | 264 pTempStream->Release(); |
265 pMemStream->Release(); | 265 pMemStream->Release(); |
266 } else if (pRawValueNode->GetClassID() == XFA_ELEMENT_Sharpxml && | 266 } else if (pRawValueNode->GetClassID() == XFA_ELEMENT_Sharpxml && |
267 wsContentType == FX_WSTRC(L"text/xml")) { | 267 wsContentType == FX_WSTRC(L"text/xml")) { |
268 CFX_WideString wsRawValue; | 268 CFX_WideString wsRawValue; |
269 pRawValueNode->GetAttribute(XFA_ATTRIBUTE_Value, wsRawValue, FALSE); | 269 pRawValueNode->GetAttribute(XFA_ATTRIBUTE_Value, wsRawValue, FALSE); |
270 if (wsRawValue.IsEmpty()) { | 270 if (wsRawValue.IsEmpty()) { |
271 break; | 271 break; |
272 } | 272 } |
273 CFX_WideStringArray wsSelTextArray; | 273 CFX_WideStringArray wsSelTextArray; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { |
432 static const FX_WCHAR* s_pwsTagName = L"<form"; | 432 static const FX_WCHAR* s_pwsTagName = L"<form"; |
433 static const FX_WCHAR* s_pwsClose = L"</form\n>"; | 433 static const FX_WCHAR* s_pwsClose = L"</form\n>"; |
434 pStream->WriteString(s_pwsTagName, FXSYS_wcslen(s_pwsTagName)); | 434 pStream->WriteString(s_pwsTagName, FXSYS_wcslen(s_pwsTagName)); |
435 if (pChecksum) { | 435 if (pChecksum) { |
436 static const FX_WCHAR* s_pwChecksum = L" checksum=\""; | 436 static const FX_WCHAR* s_pwChecksum = L" checksum=\""; |
437 CFX_WideString wsChecksum = | 437 CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum); |
438 CFX_WideString::FromUTF8(pChecksum, FXSYS_strlen(pChecksum)); | |
439 pStream->WriteString(s_pwChecksum, FXSYS_wcslen(s_pwChecksum)); | 438 pStream->WriteString(s_pwChecksum, FXSYS_wcslen(s_pwChecksum)); |
440 pStream->WriteString((const FX_WCHAR*)wsChecksum, wsChecksum.GetLength()); | 439 pStream->WriteString((const FX_WCHAR*)wsChecksum, wsChecksum.GetLength()); |
441 pStream->WriteString(L"\"", 1); | 440 pStream->WriteString(L"\"", 1); |
442 } | 441 } |
443 pStream->WriteString(L" xmlns=\"", FXSYS_wcslen(L" xmlns=\"")); | 442 pStream->WriteString(L" xmlns=\"", FXSYS_wcslen(L" xmlns=\"")); |
444 const FX_WCHAR* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI; | 443 const FX_WCHAR* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI; |
445 pStream->WriteString(pURI, FXSYS_wcslen(pURI)); | 444 pStream->WriteString(pURI, FXSYS_wcslen(pURI)); |
446 CFX_WideString wsVersionNumber; | 445 CFX_WideString wsVersionNumber; |
447 XFA_DataExporter_RecognizeXFAVersionNumber( | 446 XFA_DataExporter_RecognizeXFAVersionNumber( |
448 ToNode(pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template)), | 447 ToNode(pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template)), |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 pXMLElement->RemoveAttribute(L"xfa:dataNode"); | 576 pXMLElement->RemoveAttribute(L"xfa:dataNode"); |
578 } | 577 } |
579 } else { | 578 } else { |
580 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); | 579 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); |
581 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); | 580 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); |
582 static_cast<CFDE_XMLElement*>(pXMLNode) | 581 static_cast<CFDE_XMLElement*>(pXMLNode) |
583 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); | 582 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); |
584 } | 583 } |
585 } | 584 } |
586 } | 585 } |
OLD | NEW |