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

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

Issue 2323523002: Remove unused code in CPDFXFA_Document (Closed)
Patch Set: Review feedback Created 4 years, 3 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 | « fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h ('k') | xfa/fxfa/app/xfa_ffsignature.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
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } else { 228 } else {
229 CXFA_Node* pNextSibling = 229 CXFA_Node* pNextSibling =
230 pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); 230 pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
231 pNewRoot->RemoveChild(pChildNode); 231 pNewRoot->RemoveChild(pChildNode);
232 pOriginRoot->InsertChild(pChildNode); 232 pOriginRoot->InsertChild(pChildNode);
233 pChildNode = pNextSibling; 233 pChildNode = pNextSibling;
234 pNextSibling = nullptr; 234 pNextSibling = nullptr;
235 } 235 }
236 } 236 }
237 } 237 }
238
238 int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) { 239 int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) {
239 int32_t iStatus = m_pDocumentParser->DoParse(pPause); 240 int32_t iStatus = m_pDocumentParser->DoParse(pPause);
240 if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc) { 241 if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc)
241 CXFA_Node* pPDFNode = ToNode( 242 return XFA_PARSESTATUS_SyntaxErr;
242 m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Pdf));
243 if (!pPDFNode) {
244 return XFA_PARSESTATUS_SyntaxErr;
245 }
246 CFDE_XMLNode* pPDFXML = pPDFNode->GetXMLMappingNode();
247 if (pPDFXML->GetType() != FDE_XMLNODE_Element) {
248 return XFA_PARSESTATUS_SyntaxErr;
249 }
250 int32_t iBufferSize = 0;
251 uint8_t* pByteBuffer = nullptr;
252 IFX_FileRead* pXFAReader = nullptr;
253 if (XFA_GetPDFContentsFromPDFXML(pPDFXML, pByteBuffer, iBufferSize)) {
254 pXFAReader = FX_CreateMemoryStream(pByteBuffer, iBufferSize, TRUE);
255 } else {
256 CFX_WideString wsHref;
257 static_cast<CFDE_XMLElement*>(pPDFXML)->GetString(L"href", wsHref);
258 if (!wsHref.IsEmpty()) {
259 pXFAReader = GetDocProvider()->OpenLinkedFile(this, wsHref);
260 }
261 }
262 if (!pXFAReader)
263 return XFA_PARSESTATUS_SyntaxErr;
264
265 CPDF_Document* pPDFDocument =
266 GetDocProvider()->OpenPDF(this, pXFAReader, TRUE);
267 ASSERT(!m_pPDFDoc);
268 if (!OpenDoc(pPDFDocument))
269 return XFA_PARSESTATUS_SyntaxErr;
270
271 CXFA_Document* doc = m_pDocumentParser->GetDocument();
272 std::unique_ptr<CXFA_SimpleParser> pParser(
273 new CXFA_SimpleParser(doc, true));
274 if (!pParser)
275 return XFA_PARSESTATUS_SyntaxErr;
276
277 CXFA_Node* pRootNode = nullptr;
278 if (pParser->StartParse(m_pStream, XFA_XDPPACKET_XDP) ==
279 XFA_PARSESTATUS_Ready &&
280 pParser->DoParse(nullptr) == XFA_PARSESTATUS_Done) {
281 pRootNode = pParser->GetRootNode();
282 }
283 if (pRootNode && doc->GetRoot()) {
284 XFA_XPDPacket_MergeRootNode(doc->GetRoot(), pRootNode);
285 iStatus = XFA_PARSESTATUS_Done;
286 } else {
287 iStatus = XFA_PARSESTATUS_StatusErr;
288 }
289 }
290 return iStatus; 243 return iStatus;
291 } 244 }
245
292 void CXFA_FFDoc::StopLoad() { 246 void CXFA_FFDoc::StopLoad() {
293 m_pApp->GetXFAFontMgr()->LoadDocFonts(this); 247 m_pApp->GetXFAFontMgr()->LoadDocFonts(this);
294 m_dwDocType = XFA_DOCTYPE_Static; 248 m_dwDocType = XFA_DOCTYPE_Static;
295 CXFA_Node* pConfig = ToNode( 249 CXFA_Node* pConfig = ToNode(
296 m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config)); 250 m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
297 if (!pConfig) { 251 if (!pConfig) {
298 return; 252 return;
299 } 253 }
300 CXFA_Node* pAcrobat = pConfig->GetFirstChildByClass(XFA_Element::Acrobat); 254 CXFA_Node* pAcrobat = pConfig->GetFirstChildByClass(XFA_Element::Acrobat);
301 if (!pAcrobat) { 255 if (!pAcrobat) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 443
490 return !!pExport->Export( 444 return !!pExport->Export(
491 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr); 445 pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
492 } 446 }
493 447
494 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { 448 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) {
495 std::unique_ptr<CXFA_DataImporter> importer( 449 std::unique_ptr<CXFA_DataImporter> importer(
496 new CXFA_DataImporter(m_pDocumentParser->GetDocument())); 450 new CXFA_DataImporter(m_pDocumentParser->GetDocument()));
497 return importer->ImportData(pStream); 451 return importer->ImportData(pStream);
498 } 452 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h ('k') | xfa/fxfa/app/xfa_ffsignature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698