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/fgas/crt/fgas_codepage.h" | 9 #include "xfa/fgas/crt/fgas_codepage.h" |
10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 470 } |
471 CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) | 471 CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) |
472 : m_pDocument(pDocument) { | 472 : m_pDocument(pDocument) { |
473 ASSERT(m_pDocument); | 473 ASSERT(m_pDocument); |
474 } | 474 } |
475 FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite) { | 475 FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite) { |
476 return Export(pWrite, m_pDocument->GetRoot()); | 476 return Export(pWrite, m_pDocument->GetRoot()); |
477 } | 477 } |
478 FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite, | 478 FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite, |
479 CXFA_Node* pNode, | 479 CXFA_Node* pNode, |
480 FX_DWORD dwFlag, | 480 uint32_t dwFlag, |
481 const FX_CHAR* pChecksum) { | 481 const FX_CHAR* pChecksum) { |
482 if (!pWrite) { | 482 if (!pWrite) { |
483 ASSERT(false); | 483 ASSERT(false); |
484 return FALSE; | 484 return FALSE; |
485 } | 485 } |
486 IFX_Stream* pStream = IFX_Stream::CreateStream( | 486 IFX_Stream* pStream = IFX_Stream::CreateStream( |
487 pWrite, | 487 pWrite, |
488 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); | 488 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); |
489 if (pStream == NULL) { | 489 if (pStream == NULL) { |
490 return FALSE; | 490 return FALSE; |
491 } | 491 } |
492 pStream->SetCodePage(FX_CODEPAGE_UTF8); | 492 pStream->SetCodePage(FX_CODEPAGE_UTF8); |
493 FX_BOOL bRet = Export(pStream, pNode, dwFlag, pChecksum); | 493 FX_BOOL bRet = Export(pStream, pNode, dwFlag, pChecksum); |
494 pStream->Release(); | 494 pStream->Release(); |
495 return bRet; | 495 return bRet; |
496 } | 496 } |
497 FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, | 497 FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, |
498 CXFA_Node* pNode, | 498 CXFA_Node* pNode, |
499 FX_DWORD dwFlag, | 499 uint32_t dwFlag, |
500 const FX_CHAR* pChecksum) { | 500 const FX_CHAR* pChecksum) { |
501 IFDE_XMLDoc* pXMLDoc = m_pDocument->GetParser()->GetXMLDoc(); | 501 IFDE_XMLDoc* pXMLDoc = m_pDocument->GetParser()->GetXMLDoc(); |
502 if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { | 502 if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { |
503 switch (pNode->GetPacketID()) { | 503 switch (pNode->GetPacketID()) { |
504 case XFA_XDPPACKET_XDP: { | 504 case XFA_XDPPACKET_XDP: { |
505 static const FX_WCHAR* s_pwsPreamble = | 505 static const FX_WCHAR* s_pwsPreamble = |
506 L"<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">"; | 506 L"<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">"; |
507 pStream->WriteString(s_pwsPreamble, FXSYS_wcslen(s_pwsPreamble)); | 507 pStream->WriteString(s_pwsPreamble, FXSYS_wcslen(s_pwsPreamble)); |
508 for (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 508 for (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
509 pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 509 pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 pXMLElement->RemoveAttribute(L"xfa:dataNode"); | 581 pXMLElement->RemoveAttribute(L"xfa:dataNode"); |
582 } | 582 } |
583 } else { | 583 } else { |
584 IFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); | 584 IFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); |
585 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); | 585 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); |
586 ((IFDE_XMLElement*)pXMLNode) | 586 ((IFDE_XMLElement*)pXMLNode) |
587 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); | 587 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); |
588 } | 588 } |
589 } | 589 } |
590 } | 590 } |
OLD | NEW |