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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp

Issue 1194933003: Make CPDF_Object::GetString() a virtual method. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 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
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 "../../../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 CPDF_Document::CPDF_Document(CPDF_Parser* pParser) : CPDF_IndirectObjects(pParse r) 10 CPDF_Document::CPDF_Document(CPDF_Parser* pParser) : CPDF_IndirectObjects(pParse r)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 m_pRootDict = pRootObj->GetDict(); 44 m_pRootDict = pRootObj->GetDict();
45 if (m_pRootDict == NULL) { 45 if (m_pRootDict == NULL) {
46 return; 46 return;
47 } 47 }
48 CPDF_Object* pInfoObj = GetIndirectObject(m_pParser->GetInfoObjNum()); 48 CPDF_Object* pInfoObj = GetIndirectObject(m_pParser->GetInfoObjNum());
49 if (pInfoObj) { 49 if (pInfoObj) {
50 m_pInfoDict = pInfoObj->GetDict(); 50 m_pInfoDict = pInfoObj->GetDict();
51 } 51 }
52 CPDF_Array* pIDArray = m_pParser->GetIDArray(); 52 CPDF_Array* pIDArray = m_pParser->GetIDArray();
53 if (pIDArray) { 53 if (pIDArray) {
54 m_ID1 = pIDArray->GetString(0); 54 m_ID1 = pIDArray->GetStringAt(0);
55 m_ID2 = pIDArray->GetString(1); 55 m_ID2 = pIDArray->GetStringAt(1);
56 } 56 }
57 m_PageList.SetSize(_GetPageCount()); 57 m_PageList.SetSize(_GetPageCount());
58 } 58 }
59 void CPDF_Document::LoadAsynDoc(CPDF_Dictionary *pLinearized) 59 void CPDF_Document::LoadAsynDoc(CPDF_Dictionary *pLinearized)
60 { 60 {
61 m_bLinearized = TRUE; 61 m_bLinearized = TRUE;
62 m_LastObjNum = m_pParser->GetLastObjNum(); 62 m_LastObjNum = m_pParser->GetLastObjNum();
63 CPDF_Object* indirectObj = GetIndirectObject(m_pParser->GetRootObjNum()); 63 CPDF_Object* indirectObj = GetIndirectObject(m_pParser->GetRootObjNum());
64 m_pRootDict = indirectObj ? indirectObj->GetDict() : NULL; 64 m_pRootDict = indirectObj ? indirectObj->GetDict() : NULL;
65 if (m_pRootDict == NULL) { 65 if (m_pRootDict == NULL) {
66 return; 66 return;
67 } 67 }
68 indirectObj = GetIndirectObject(m_pParser->GetInfoObjNum()); 68 indirectObj = GetIndirectObject(m_pParser->GetInfoObjNum());
69 m_pInfoDict = indirectObj ? indirectObj->GetDict() : NULL; 69 m_pInfoDict = indirectObj ? indirectObj->GetDict() : NULL;
70 CPDF_Array* pIDArray = m_pParser->GetIDArray(); 70 CPDF_Array* pIDArray = m_pParser->GetIDArray();
71 if (pIDArray) { 71 if (pIDArray) {
72 m_ID1 = pIDArray->GetString(0); 72 m_ID1 = pIDArray->GetStringAt(0);
73 m_ID2 = pIDArray->GetString(1); 73 m_ID2 = pIDArray->GetStringAt(1);
74 } 74 }
75 FX_DWORD dwPageCount = 0; 75 FX_DWORD dwPageCount = 0;
76 CPDF_Object *pCount = pLinearized->GetElement(FX_BSTRC("N")); 76 CPDF_Object *pCount = pLinearized->GetElement(FX_BSTRC("N"));
77 if (pCount && pCount->GetType() == PDFOBJ_NUMBER) { 77 if (pCount && pCount->GetType() == PDFOBJ_NUMBER) {
78 dwPageCount = pCount->GetInteger(); 78 dwPageCount = pCount->GetInteger();
79 } 79 }
80 m_PageList.SetSize(dwPageCount); 80 m_PageList.SetSize(dwPageCount);
81 CPDF_Object *pNo = pLinearized->GetElement(FX_BSTRC("P")); 81 CPDF_Object *pNo = pLinearized->GetElement(FX_BSTRC("P"));
82 if (pNo && pNo->GetType() == PDFOBJ_NUMBER) { 82 if (pNo && pNo->GetType() == PDFOBJ_NUMBER) {
83 m_dwFirstPageNo = pNo->GetInteger(); 83 m_dwFirstPageNo = pNo->GetInteger();
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 FX_BOOL CPDF_Document::IsOwner() const 335 FX_BOOL CPDF_Document::IsOwner() const
336 { 336 {
337 if (m_pParser == NULL) { 337 if (m_pParser == NULL) {
338 return TRUE; 338 return TRUE;
339 } 339 }
340 return m_pParser->IsOwner(); 340 return m_pParser->IsOwner();
341 } 341 }
342 FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const 342 FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const
343 { 343 {
344 { 344 CPDF_Object* pObj;
345 CPDF_Object* pObj; 345 if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj)) {
346 if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj)) { 346 bForm =
347 bForm = pObj->GetType() == PDFOBJ_STREAM && 347 (pObj->GetType() == PDFOBJ_STREAM &&
348 ((CPDF_Stream*)pObj)->GetDict()->GetString(FX_BSTRC("Subtype ")) == FX_BSTRC("Form"); 348 ((CPDF_Stream*)pObj)->GetDict()->GetStringAt("Subtype") == "Form");
349 return TRUE; 349 return TRUE;
350 }
351 } 350 }
351
352 if (m_pParser == NULL) { 352 if (m_pParser == NULL) {
353 bForm = FALSE; 353 bForm = FALSE;
354 return TRUE; 354 return TRUE;
355 } 355 }
356 return m_pParser->IsFormStream(objnum, bForm); 356 return m_pParser->IsFormStream(objnum, bForm);
357 } 357 }
358 void CPDF_Document::ClearPageData() 358 void CPDF_Document::ClearPageData()
359 { 359 {
360 if (m_pDocPage) { 360 if (m_pDocPage) {
361 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); 361 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this);
362 } 362 }
363 } 363 }
364 void CPDF_Document::ClearRenderData() 364 void CPDF_Document::ClearRenderData()
365 { 365 {
366 if (m_pDocRender) { 366 if (m_pDocRender) {
367 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); 367 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender);
368 } 368 }
369 } 369 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698