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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { |
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 = CFX_WideString::FromUTF8(pChecksum); | 437 CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum); |
438 pStream->WriteString(s_pwChecksum, FXSYS_wcslen(s_pwChecksum)); | 438 pStream->WriteString(s_pwChecksum, FXSYS_wcslen(s_pwChecksum)); |
439 pStream->WriteString((const FX_WCHAR*)wsChecksum, wsChecksum.GetLength()); | 439 pStream->WriteString((const FX_WCHAR*)wsChecksum, wsChecksum.GetLength()); |
440 pStream->WriteString(L"\"", 1); | 440 pStream->WriteString(L"\"", 1); |
441 } | 441 } |
442 pStream->WriteString(L" xmlns=\"", FXSYS_wcslen(L" xmlns=\"")); | 442 pStream->WriteString(L" xmlns=\"", FXSYS_wcslen(L" xmlns=\"")); |
443 const FX_WCHAR* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI; | 443 const FX_WCHAR* pURI = XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI; |
444 pStream->WriteString(pURI, FXSYS_wcslen(pURI)); | 444 pStream->WriteString(pURI, FXSYS_wcslen(pURI)); |
445 CFX_WideString wsVersionNumber; | 445 CFX_WideString wsVersionNumber; |
446 XFA_DataExporter_RecognizeXFAVersionNumber( | 446 XFA_DataExporter_RecognizeXFAVersionNumber( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 return bRet; | 490 return bRet; |
491 } | 491 } |
492 FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, | 492 FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, |
493 CXFA_Node* pNode, | 493 CXFA_Node* pNode, |
494 uint32_t dwFlag, | 494 uint32_t dwFlag, |
495 const FX_CHAR* pChecksum) { | 495 const FX_CHAR* pChecksum) { |
496 CFDE_XMLDoc* pXMLDoc = m_pDocument->GetParser()->GetXMLDoc(); | 496 CFDE_XMLDoc* pXMLDoc = m_pDocument->GetParser()->GetXMLDoc(); |
497 if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { | 497 if (pNode->GetObjectType() == XFA_OBJECTTYPE_ModelNode) { |
498 switch (pNode->GetPacketID()) { | 498 switch (pNode->GetPacketID()) { |
499 case XFA_XDPPACKET_XDP: { | 499 case XFA_XDPPACKET_XDP: { |
500 static const FX_WCHAR* s_pwsPreamble = | 500 static const FX_WCHAR s_pwsPreamble[] = |
501 L"<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">"; | 501 L"<xdp:xdp xmlns:xdp=\"http://ns.adobe.com/xdp/\">"; |
502 pStream->WriteString(s_pwsPreamble, FXSYS_wcslen(s_pwsPreamble)); | 502 pStream->WriteString(s_pwsPreamble, FXSYS_wcslen(s_pwsPreamble)); |
503 for (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 503 for (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
504 pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 504 pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
505 Export(pStream, pChild, dwFlag, pChecksum); | 505 Export(pStream, pChild, dwFlag, pChecksum); |
506 } | 506 } |
507 static const FX_WCHAR* s_pwsPostamble = L"</xdp:xdp\n>"; | 507 static const FX_WCHAR s_pwsPostamble[] = L"</xdp:xdp\n>"; |
508 pStream->WriteString(s_pwsPostamble, FXSYS_wcslen(s_pwsPostamble)); | 508 pStream->WriteString(s_pwsPostamble, FXSYS_wcslen(s_pwsPostamble)); |
509 } break; | 509 } break; |
510 case XFA_XDPPACKET_Datasets: { | 510 case XFA_XDPPACKET_Datasets: { |
511 CFDE_XMLElement* pElement = | 511 CFDE_XMLElement* pElement = |
512 static_cast<CFDE_XMLElement*>(pNode->GetXMLMappingNode()); | 512 static_cast<CFDE_XMLElement*>(pNode->GetXMLMappingNode()); |
513 if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { | 513 if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { |
514 return FALSE; | 514 return FALSE; |
515 } | 515 } |
516 CXFA_Node* pDataNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 516 CXFA_Node* pDataNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
517 FXSYS_assert(pDataNode); | 517 FXSYS_assert(pDataNode); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 pXMLElement->RemoveAttribute(L"xfa:dataNode"); | 576 pXMLElement->RemoveAttribute(L"xfa:dataNode"); |
577 } | 577 } |
578 } else { | 578 } else { |
579 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); | 579 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); |
580 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); | 580 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); |
581 static_cast<CFDE_XMLElement*>(pXMLNode) | 581 static_cast<CFDE_XMLElement*>(pXMLNode) |
582 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); | 582 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); |
583 } | 583 } |
584 } | 584 } |
585 } | 585 } |
OLD | NEW |