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 "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 count++; | 477 count++; |
478 } | 478 } |
479 } | 479 } |
480 pPages->SetAtInteger("Count", count); | 480 pPages->SetAtInteger("Count", count); |
481 return count; | 481 return count; |
482 } | 482 } |
483 | 483 |
484 } // namespace | 484 } // namespace |
485 | 485 |
486 CPDF_Document::CPDF_Document(CPDF_Parser* pParser) | 486 CPDF_Document::CPDF_Document(CPDF_Parser* pParser) |
487 : CPDF_IndirectObjectHolder(pParser), | 487 : CPDF_IndirectObjectHolder(), |
| 488 m_pParser(pParser), |
488 m_pRootDict(nullptr), | 489 m_pRootDict(nullptr), |
489 m_pInfoDict(nullptr), | 490 m_pInfoDict(nullptr), |
490 m_bLinearized(false), | 491 m_bLinearized(false), |
491 m_iFirstPageNo(0), | 492 m_iFirstPageNo(0), |
492 m_dwFirstPageObjNum(0), | 493 m_dwFirstPageObjNum(0), |
493 m_pDocPage(new CPDF_DocPageData(this)), | 494 m_pDocPage(new CPDF_DocPageData(this)), |
494 m_pDocRender(new CPDF_DocRenderData(this)) {} | 495 m_pDocRender(new CPDF_DocRenderData(this)) { |
| 496 if (pParser) |
| 497 SetLastObjNum(m_pParser->GetLastObjNum()); |
| 498 } |
495 | 499 |
496 CPDF_Document::~CPDF_Document() { | 500 CPDF_Document::~CPDF_Document() { |
497 delete m_pDocPage; | 501 delete m_pDocPage; |
498 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); | 502 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); |
499 } | 503 } |
500 | 504 |
| 505 CPDF_Object* CPDF_Document::ParseIndirectObject(uint32_t objnum) { |
| 506 return m_pParser ? m_pParser->ParseIndirectObject(this, objnum) : nullptr; |
| 507 } |
| 508 |
501 void CPDF_Document::LoadDocInternal() { | 509 void CPDF_Document::LoadDocInternal() { |
502 SetLastObjNum(m_pParser->GetLastObjNum()); | 510 SetLastObjNum(m_pParser->GetLastObjNum()); |
503 | 511 |
504 CPDF_Object* pRootObj = GetOrParseIndirectObject(m_pParser->GetRootObjNum()); | 512 CPDF_Object* pRootObj = GetOrParseIndirectObject(m_pParser->GetRootObjNum()); |
505 if (!pRootObj) | 513 if (!pRootObj) |
506 return; | 514 return; |
507 | 515 |
508 m_pRootDict = pRootObj->GetDict(); | 516 m_pRootDict = pRootObj->GetDict(); |
509 if (!m_pRootDict) | 517 if (!m_pRootDict) |
510 return; | 518 return; |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 } | 1451 } |
1444 } | 1452 } |
1445 pFontDesc->SetAtInteger("StemV", fStemV); | 1453 pFontDesc->SetAtInteger("StemV", fStemV); |
1446 AddIndirectObject(pFontDesc); | 1454 AddIndirectObject(pFontDesc); |
1447 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc); | 1455 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc); |
1448 CFRelease(traits); | 1456 CFRelease(traits); |
1449 CFRelease(languages); | 1457 CFRelease(languages); |
1450 return LoadFont(pBaseDict); | 1458 return LoadFont(pBaseDict); |
1451 } | 1459 } |
1452 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 1460 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
OLD | NEW |