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/include/fxfa/xfa_ffdoc.h" | 7 #include "xfa/include/fxfa/xfa_ffdoc.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 uint8_t*& pByteBuffer, | 52 uint8_t*& pByteBuffer, |
53 int32_t& iBufferSize) { | 53 int32_t& iBufferSize) { |
54 CFDE_XMLElement* pDocumentElement = NULL; | 54 CFDE_XMLElement* pDocumentElement = NULL; |
55 for (CFDE_XMLNode* pXMLNode = | 55 for (CFDE_XMLNode* pXMLNode = |
56 pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild); | 56 pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild); |
57 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { | 57 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { |
58 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { | 58 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { |
59 CFX_WideString wsTagName; | 59 CFX_WideString wsTagName; |
60 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 60 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
61 pXMLElement->GetTagName(wsTagName); | 61 pXMLElement->GetTagName(wsTagName); |
62 if (wsTagName.Equal(FX_WSTRC(L"document"))) { | 62 if (wsTagName == FX_WSTRC(L"document")) { |
63 pDocumentElement = pXMLElement; | 63 pDocumentElement = pXMLElement; |
64 break; | 64 break; |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 if (!pDocumentElement) { | 68 if (!pDocumentElement) { |
69 return FALSE; | 69 return FALSE; |
70 } | 70 } |
71 CFDE_XMLElement* pChunkElement = NULL; | 71 CFDE_XMLElement* pChunkElement = NULL; |
72 for (CFDE_XMLNode* pXMLNode = | 72 for (CFDE_XMLNode* pXMLNode = |
73 pDocumentElement->GetNodeItem(CFDE_XMLNode::FirstChild); | 73 pDocumentElement->GetNodeItem(CFDE_XMLNode::FirstChild); |
74 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { | 74 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { |
75 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { | 75 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { |
76 CFX_WideString wsTagName; | 76 CFX_WideString wsTagName; |
77 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 77 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
78 pXMLElement->GetTagName(wsTagName); | 78 pXMLElement->GetTagName(wsTagName); |
79 if (wsTagName.Equal(FX_WSTRC(L"chunk"))) { | 79 if (wsTagName == FX_WSTRC(L"chunk")) { |
80 pChunkElement = pXMLElement; | 80 pChunkElement = pXMLElement; |
81 break; | 81 break; |
82 } | 82 } |
83 } | 83 } |
84 } | 84 } |
85 if (!pChunkElement) { | 85 if (!pChunkElement) { |
86 return FALSE; | 86 return FALSE; |
87 } | 87 } |
88 CFX_WideString wsPDFContent; | 88 CFX_WideString wsPDFContent; |
89 pChunkElement->GetTextData(wsPDFContent); | 89 pChunkElement->GetTextData(wsPDFContent); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 } | 422 } |
423 pExport->Release(); | 423 pExport->Release(); |
424 return bFlags; | 424 return bFlags; |
425 } | 425 } |
426 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { | 426 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { |
427 std::unique_ptr<CXFA_DataImporter, ReleaseDeleter<CXFA_DataImporter>> | 427 std::unique_ptr<CXFA_DataImporter, ReleaseDeleter<CXFA_DataImporter>> |
428 importer(new CXFA_DataImporter(m_pDocument)); | 428 importer(new CXFA_DataImporter(m_pDocument)); |
429 | 429 |
430 return importer->ImportData(pStream); | 430 return importer->ImportData(pStream); |
431 } | 431 } |
OLD | NEW |