| 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" |
| 11 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 11 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| 12 #include "xfa/fxfa/parser/xfa_docdata.h" | 12 #include "xfa/fxfa/parser/xfa_docdata.h" |
| 13 #include "xfa/fxfa/parser/xfa_doclayout.h" | 13 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| 14 #include "xfa/fxfa/parser/xfa_document.h" | 14 #include "xfa/fxfa/parser/xfa_document.h" |
| 15 #include "xfa/fxfa/parser/xfa_localemgr.h" | 15 #include "xfa/fxfa/parser/xfa_localemgr.h" |
| 16 #include "xfa/fxfa/parser/xfa_object.h" | 16 #include "xfa/fxfa/parser/xfa_object.h" |
| 17 #include "xfa/fxfa/parser/xfa_parser.h" | 17 #include "xfa/fxfa/parser/xfa_parser.h" |
| 18 #include "xfa/fxfa/parser/xfa_parser_imp.h" |
| 18 #include "xfa/fxfa/parser/xfa_script.h" | 19 #include "xfa/fxfa/parser/xfa_script.h" |
| 19 #include "xfa/fxfa/parser/xfa_utils.h" | 20 #include "xfa/fxfa/parser/xfa_utils.h" |
| 20 | 21 |
| 21 IXFA_PacketImport* IXFA_PacketImport::Create(CXFA_Document* pDocument) { | |
| 22 return new CXFA_DataImporter(pDocument); | |
| 23 } | |
| 24 CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) | 22 CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) |
| 25 : m_pDocument(pDocument) { | 23 : m_pDocument(pDocument) { |
| 26 ASSERT(m_pDocument); | 24 ASSERT(m_pDocument); |
| 27 } | 25 } |
| 28 FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { | 26 FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { |
| 29 IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument); | 27 IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument); |
| 30 if (!pDataDocumentParser) { | 28 if (!pDataDocumentParser) { |
| 31 return FALSE; | 29 return FALSE; |
| 32 } | 30 } |
| 33 if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != | 31 if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 456 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 459 while (pChildNode) { | 457 while (pChildNode) { |
| 460 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream); | 458 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream); |
| 461 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 459 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 462 } | 460 } |
| 463 pStream->WriteString(s_pwsClose, FXSYS_wcslen(s_pwsClose)); | 461 pStream->WriteString(s_pwsClose, FXSYS_wcslen(s_pwsClose)); |
| 464 } else { | 462 } else { |
| 465 XFA_DataExporter_RegenerateFormFile_Container(pNode, pStream, bSaveXML); | 463 XFA_DataExporter_RegenerateFormFile_Container(pNode, pStream, bSaveXML); |
| 466 } | 464 } |
| 467 } | 465 } |
| 468 IXFA_PacketExport* IXFA_PacketExport::Create(CXFA_Document* pDocument, | 466 |
| 469 XFA_DATAFORMAT eFormat) { | |
| 470 return new CXFA_DataExporter(pDocument); | |
| 471 } | |
| 472 CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) | 467 CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) |
| 473 : m_pDocument(pDocument) { | 468 : m_pDocument(pDocument) { |
| 474 ASSERT(m_pDocument); | 469 ASSERT(m_pDocument); |
| 475 } | 470 } |
| 476 FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite) { | 471 FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite) { |
| 477 return Export(pWrite, m_pDocument->GetRoot()); | 472 return Export(pWrite, m_pDocument->GetRoot()); |
| 478 } | 473 } |
| 479 FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite, | 474 FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite, |
| 480 CXFA_Node* pNode, | 475 CXFA_Node* pNode, |
| 481 uint32_t dwFlag, | 476 uint32_t dwFlag, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 pXMLElement->RemoveAttribute(L"xfa:dataNode"); | 577 pXMLElement->RemoveAttribute(L"xfa:dataNode"); |
| 583 } | 578 } |
| 584 } else { | 579 } else { |
| 585 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); | 580 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); |
| 586 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); | 581 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); |
| 587 static_cast<CFDE_XMLElement*>(pXMLNode) | 582 static_cast<CFDE_XMLElement*>(pXMLNode) |
| 588 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); | 583 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); |
| 589 } | 584 } |
| 590 } | 585 } |
| 591 } | 586 } |
| OLD | NEW |