| 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/src/foxitlib.h" | 7 #include "xfa/src/foxitlib.h" |
| 8 #include "xfa/src/fxfa/src/common/xfa_utils.h" | 8 #include "xfa/src/fxfa/src/common/xfa_utils.h" |
| 9 #include "xfa/src/fxfa/src/common/xfa_object.h" | 9 #include "xfa/src/fxfa/src/common/xfa_object.h" |
| 10 #include "xfa/src/fxfa/src/common/xfa_document.h" | 10 #include "xfa/src/fxfa/src/common/xfa_document.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 if (pDataDocumentParser->DoParse(NULL) < XFA_PARSESTATUS_Done) { | 35 if (pDataDocumentParser->DoParse(NULL) < XFA_PARSESTATUS_Done) { |
| 36 pDataDocumentParser->Release(); | 36 pDataDocumentParser->Release(); |
| 37 return FALSE; | 37 return FALSE; |
| 38 } | 38 } |
| 39 CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode(); | 39 CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode(); |
| 40 if (!pImportDataRoot) { | 40 if (!pImportDataRoot) { |
| 41 pDataDocumentParser->Release(); | 41 pDataDocumentParser->Release(); |
| 42 return FALSE; | 42 return FALSE; |
| 43 } | 43 } |
| 44 CXFA_Node* pDataModel = | 44 CXFA_Node* pDataModel = |
| 45 (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets); | 45 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets)); |
| 46 if (!pDataModel) { | 46 if (!pDataModel) { |
| 47 pDataDocumentParser->Release(); | 47 pDataDocumentParser->Release(); |
| 48 return FALSE; | 48 return FALSE; |
| 49 } | 49 } |
| 50 CXFA_Node* pDataNode = | 50 CXFA_Node* pDataNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Data)); |
| 51 (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Data); | |
| 52 if (pDataNode) { | 51 if (pDataNode) { |
| 53 pDataModel->RemoveChild(pDataNode); | 52 pDataModel->RemoveChild(pDataNode); |
| 54 } | 53 } |
| 55 if (pImportDataRoot->GetClassID() == XFA_ELEMENT_DataModel) { | 54 if (pImportDataRoot->GetClassID() == XFA_ELEMENT_DataModel) { |
| 56 while (CXFA_Node* pChildNode = | 55 while (CXFA_Node* pChildNode = |
| 57 pImportDataRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) { | 56 pImportDataRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) { |
| 58 pImportDataRoot->RemoveChild(pChildNode); | 57 pImportDataRoot->RemoveChild(pChildNode); |
| 59 pDataModel->InsertChild(pChildNode); | 58 pDataModel->InsertChild(pChildNode); |
| 60 } | 59 } |
| 61 } else { | 60 } else { |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 CFX_WideString::FromUTF8(pChecksum, FXSYS_strlen(pChecksum)); | 437 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 (CXFA_Node*)pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template), | 447 ToNode(pNode->GetDocument()->GetXFAObject(XFA_XDPPACKET_Template)), |
| 449 wsVersionNumber); | 448 wsVersionNumber); |
| 450 if (wsVersionNumber.IsEmpty()) { | 449 if (wsVersionNumber.IsEmpty()) { |
| 451 wsVersionNumber = FX_WSTRC(L"2.8"); | 450 wsVersionNumber = FX_WSTRC(L"2.8"); |
| 452 } | 451 } |
| 453 wsVersionNumber += FX_WSTRC(L"/\"\n>"); | 452 wsVersionNumber += FX_WSTRC(L"/\"\n>"); |
| 454 pStream->WriteString((const FX_WCHAR*)wsVersionNumber, | 453 pStream->WriteString((const FX_WCHAR*)wsVersionNumber, |
| 455 wsVersionNumber.GetLength()); | 454 wsVersionNumber.GetLength()); |
| 456 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 455 CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 457 while (pChildNode) { | 456 while (pChildNode) { |
| 458 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream); | 457 XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 pXMLElement->RemoveAttribute(L"xfa:dataNode"); | 579 pXMLElement->RemoveAttribute(L"xfa:dataNode"); |
| 581 } | 580 } |
| 582 } else { | 581 } else { |
| 583 IFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); | 582 IFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); |
| 584 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); | 583 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); |
| 585 ((IFDE_XMLElement*)pXMLNode) | 584 ((IFDE_XMLElement*)pXMLNode) |
| 586 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); | 585 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); |
| 587 } | 586 } |
| 588 } | 587 } |
| 589 } | 588 } |
| OLD | NEW |