Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: xfa/fxfa/app/xfa_ffdoc.cpp

Issue 2129963002: Break xfa_parser_imp apart (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@ixfa_parser
Patch Set: Rebase to master Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa.gyp ('k') | xfa/fxfa/app/xfa_ffwidgethandler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/include/xfa_ffdoc.h" 7 #include "xfa/fxfa/include/xfa_ffdoc.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
13 #include "core/fpdfdoc/include/fpdf_doc.h" 13 #include "core/fpdfdoc/include/fpdf_doc.h"
14 #include "core/fxcrt/include/fx_ext.h" 14 #include "core/fxcrt/include/fx_ext.h"
15 #include "core/fxcrt/include/fx_memory.h" 15 #include "core/fxcrt/include/fx_memory.h"
16 #include "xfa/fde/xml/fde_xml_imp.h" 16 #include "xfa/fde/xml/fde_xml_imp.h"
17 #include "xfa/fwl/core/fwl_noteimp.h" 17 #include "xfa/fwl/core/fwl_noteimp.h"
18 #include "xfa/fxfa/app/xfa_ffnotify.h" 18 #include "xfa/fxfa/app/xfa_ffnotify.h"
19 #include "xfa/fxfa/include/xfa_checksum.h" 19 #include "xfa/fxfa/include/xfa_checksum.h"
20 #include "xfa/fxfa/include/xfa_ffapp.h" 20 #include "xfa/fxfa/include/xfa_ffapp.h"
21 #include "xfa/fxfa/include/xfa_ffdocview.h" 21 #include "xfa/fxfa/include/xfa_ffdocview.h"
22 #include "xfa/fxfa/include/xfa_ffwidget.h" 22 #include "xfa/fxfa/include/xfa_ffwidget.h"
23 #include "xfa/fxfa/include/xfa_fontmgr.h" 23 #include "xfa/fxfa/include/xfa_fontmgr.h"
24 #include "xfa/fxfa/parser/xfa_document.h" 24 #include "xfa/fxfa/parser/xfa_document.h"
25 #include "xfa/fxfa/parser/xfa_document_serialize.h" 25 #include "xfa/fxfa/parser/xfa_document_serialize.h"
26 #include "xfa/fxfa/parser/xfa_parser_imp.h"
27 #include "xfa/fxfa/parser/xfa_parser_imp.h"
28 26
29 namespace { 27 namespace {
30 28
31 struct FX_BASE64DATA { 29 struct FX_BASE64DATA {
32 uint32_t data1 : 2; 30 uint32_t data1 : 2;
33 uint32_t data2 : 6; 31 uint32_t data2 : 6;
34 uint32_t data3 : 4; 32 uint32_t data3 : 4;
35 uint32_t data4 : 4; 33 uint32_t data4 : 4;
36 uint32_t data5 : 6; 34 uint32_t data5 : 6;
37 uint32_t data6 : 2; 35 uint32_t data6 : 2;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 CloseDoc(); 159 CloseDoc();
162 } 160 }
163 161
164 uint32_t CXFA_FFDoc::GetDocType() { 162 uint32_t CXFA_FFDoc::GetDocType() {
165 return m_dwDocType; 163 return m_dwDocType;
166 } 164 }
167 165
168 int32_t CXFA_FFDoc::StartLoad() { 166 int32_t CXFA_FFDoc::StartLoad() {
169 m_pNotify.reset(new CXFA_FFNotify(this)); 167 m_pNotify.reset(new CXFA_FFNotify(this));
170 m_pDocumentParser.reset(new CXFA_DocumentParser(m_pNotify.get())); 168 m_pDocumentParser.reset(new CXFA_DocumentParser(m_pNotify.get()));
171 int32_t iStatus = m_pDocumentParser->StartParse(m_pStream); 169 int32_t iStatus = m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP);
172 return iStatus; 170 return iStatus;
173 } 171 }
174 172
175 FX_BOOL XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement, 173 FX_BOOL XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement,
176 uint8_t*& pByteBuffer, 174 uint8_t*& pByteBuffer,
177 int32_t& iBufferSize) { 175 int32_t& iBufferSize) {
178 CFDE_XMLElement* pDocumentElement = nullptr; 176 CFDE_XMLElement* pDocumentElement = nullptr;
179 for (CFDE_XMLNode* pXMLNode = 177 for (CFDE_XMLNode* pXMLNode =
180 pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild); 178 pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild);
181 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { 179 pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 if (!OpenDoc(pPDFDocument)) 266 if (!OpenDoc(pPDFDocument))
269 return XFA_PARSESTATUS_SyntaxErr; 267 return XFA_PARSESTATUS_SyntaxErr;
270 268
271 CXFA_Document* doc = m_pDocumentParser->GetDocument(); 269 CXFA_Document* doc = m_pDocumentParser->GetDocument();
272 std::unique_ptr<CXFA_SimpleParser> pParser( 270 std::unique_ptr<CXFA_SimpleParser> pParser(
273 new CXFA_SimpleParser(doc, true)); 271 new CXFA_SimpleParser(doc, true));
274 if (!pParser) 272 if (!pParser)
275 return XFA_PARSESTATUS_SyntaxErr; 273 return XFA_PARSESTATUS_SyntaxErr;
276 274
277 CXFA_Node* pRootNode = nullptr; 275 CXFA_Node* pRootNode = nullptr;
278 if (pParser->StartParse(m_pStream) == XFA_PARSESTATUS_Ready && 276 if (pParser->StartParse(m_pStream, XFA_XDPPACKET_XDP) ==
277 XFA_PARSESTATUS_Ready &&
279 pParser->DoParse(nullptr) == XFA_PARSESTATUS_Done) { 278 pParser->DoParse(nullptr) == XFA_PARSESTATUS_Done) {
280 pRootNode = pParser->GetRootNode(); 279 pRootNode = pParser->GetRootNode();
281 } 280 }
282 if (pRootNode && doc->GetRoot()) { 281 if (pRootNode && doc->GetRoot()) {
283 XFA_XPDPacket_MergeRootNode(doc->GetRoot(), pRootNode); 282 XFA_XPDPacket_MergeRootNode(doc->GetRoot(), pRootNode);
284 iStatus = XFA_PARSESTATUS_Done; 283 iStatus = XFA_PARSESTATUS_Done;
285 } else { 284 } else {
286 iStatus = XFA_PARSESTATUS_StatusErr; 285 iStatus = XFA_PARSESTATUS_StatusErr;
287 } 286 }
288 } 287 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 487
489 return !!pExport->Export( 488 return !!pExport->Export(
490 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr); 489 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
491 } 490 }
492 491
493 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { 492 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) {
494 std::unique_ptr<CXFA_DataImporter> importer( 493 std::unique_ptr<CXFA_DataImporter> importer(
495 new CXFA_DataImporter(m_pDocumentParser->GetDocument())); 494 new CXFA_DataImporter(m_pDocumentParser->GetDocument()));
496 return importer->ImportData(pStream); 495 return importer->ImportData(pStream);
497 } 496 }
OLDNEW
« no previous file with comments | « xfa.gyp ('k') | xfa/fxfa/app/xfa_ffwidgethandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698