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 "../../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 | 9 |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 indirectObj = GetIndirectObject(m_pParser->GetInfoObjNum()); | 65 indirectObj = GetIndirectObject(m_pParser->GetInfoObjNum()); |
66 m_pInfoDict = indirectObj ? indirectObj->GetDict() : NULL; | 66 m_pInfoDict = indirectObj ? indirectObj->GetDict() : NULL; |
67 CPDF_Array* pIDArray = m_pParser->GetIDArray(); | 67 CPDF_Array* pIDArray = m_pParser->GetIDArray(); |
68 if (pIDArray) { | 68 if (pIDArray) { |
69 m_ID1 = pIDArray->GetString(0); | 69 m_ID1 = pIDArray->GetString(0); |
70 m_ID2 = pIDArray->GetString(1); | 70 m_ID2 = pIDArray->GetString(1); |
71 } | 71 } |
72 FX_DWORD dwPageCount = 0; | 72 FX_DWORD dwPageCount = 0; |
73 CPDF_Object* pCount = pLinearized->GetElement(FX_BSTRC("N")); | 73 CPDF_Object* pCount = pLinearized->GetElement(FX_BSTRC("N")); |
74 if (pCount && pCount->GetType() == PDFOBJ_NUMBER) { | 74 if (ToNumber(pCount)) |
75 dwPageCount = pCount->GetInteger(); | 75 dwPageCount = pCount->GetInteger(); |
76 } | 76 |
77 m_PageList.SetSize(dwPageCount); | 77 m_PageList.SetSize(dwPageCount); |
78 CPDF_Object* pNo = pLinearized->GetElement(FX_BSTRC("P")); | 78 CPDF_Object* pNo = pLinearized->GetElement(FX_BSTRC("P")); |
79 if (pNo && pNo->GetType() == PDFOBJ_NUMBER) { | 79 if (ToNumber(pNo)) |
80 m_dwFirstPageNo = pNo->GetInteger(); | 80 m_dwFirstPageNo = pNo->GetInteger(); |
81 } | 81 |
82 CPDF_Object* pObjNum = pLinearized->GetElement(FX_BSTRC("O")); | 82 CPDF_Object* pObjNum = pLinearized->GetElement(FX_BSTRC("O")); |
83 if (pObjNum && pObjNum->GetType() == PDFOBJ_NUMBER) { | 83 if (ToNumber(pObjNum)) |
84 m_dwFirstPageObjNum = pObjNum->GetInteger(); | 84 m_dwFirstPageObjNum = pObjNum->GetInteger(); |
85 } | |
86 } | 85 } |
87 void CPDF_Document::LoadPages() { | 86 void CPDF_Document::LoadPages() { |
88 m_PageList.SetSize(_GetPageCount()); | 87 m_PageList.SetSize(_GetPageCount()); |
89 } | 88 } |
90 CPDF_Document::~CPDF_Document() { | 89 CPDF_Document::~CPDF_Document() { |
91 if (m_pDocPage) { | 90 if (m_pDocPage) { |
92 CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this); | 91 CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this); |
93 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); | 92 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); |
94 } | 93 } |
95 if (m_pDocRender) { | 94 if (m_pDocRender) { |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 void CPDF_Document::ClearPageData() { | 353 void CPDF_Document::ClearPageData() { |
355 if (m_pDocPage) { | 354 if (m_pDocPage) { |
356 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); | 355 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); |
357 } | 356 } |
358 } | 357 } |
359 void CPDF_Document::ClearRenderData() { | 358 void CPDF_Document::ClearRenderData() { |
360 if (m_pDocRender) { | 359 if (m_pDocRender) { |
361 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); | 360 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); |
362 } | 361 } |
363 } | 362 } |
OLD | NEW |