| 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 CPDF_Document::CPDF_Document(CPDF_Parser* pParser) : CPDF_IndirectObjects(pParse
r) | 10 CPDF_Document::CPDF_Document(CPDF_Parser* pParser) : CPDF_IndirectObjects(pParse
r) |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); | 291 CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); |
| 292 if (pPages == NULL) { | 292 if (pPages == NULL) { |
| 293 return 0; | 293 return 0; |
| 294 } | 294 } |
| 295 if (!pPages->KeyExist(FX_BSTRC("Kids"))) { | 295 if (!pPages->KeyExist(FX_BSTRC("Kids"))) { |
| 296 return 1; | 296 return 1; |
| 297 } | 297 } |
| 298 return _CountPages(pPages, 0); | 298 return _CountPages(pPages, 0); |
| 299 } | 299 } |
| 300 static FX_BOOL _EnumPages(CPDF_Dictionary* pPages, IPDF_EnumPageHandler* pHandle
r) | |
| 301 { | |
| 302 CPDF_Array* pKidList = pPages->GetArray(FX_BSTRC("Kids")); | |
| 303 if (pKidList == NULL) { | |
| 304 return pHandler->EnumPage(pPages); | |
| 305 } | |
| 306 for (FX_DWORD i = 0; i < pKidList->GetCount(); i ++) { | |
| 307 CPDF_Dictionary* pKid = pKidList->GetDict(i); | |
| 308 if (pKid == NULL) { | |
| 309 continue; | |
| 310 } | |
| 311 if (!pKid->KeyExist(FX_BSTRC("Kids"))) { | |
| 312 if (!pHandler->EnumPage(pKid)) { | |
| 313 return FALSE; | |
| 314 } | |
| 315 } else { | |
| 316 return _EnumPages(pKid, pHandler); | |
| 317 } | |
| 318 } | |
| 319 return TRUE; | |
| 320 } | |
| 321 void CPDF_Document::EnumPages(IPDF_EnumPageHandler* pHandler) | |
| 322 { | |
| 323 CPDF_Dictionary* pRoot = GetRoot(); | |
| 324 if (pRoot == NULL) { | |
| 325 return; | |
| 326 } | |
| 327 CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); | |
| 328 if (pPages == NULL) { | |
| 329 return; | |
| 330 } | |
| 331 _EnumPages(pPages, pHandler); | |
| 332 } | |
| 333 FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary*
pThisPageDict) | 300 FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary*
pThisPageDict) |
| 334 { | 301 { |
| 335 for (int i = 0; i < m_PageList.GetSize(); i ++) { | 302 for (int i = 0; i < m_PageList.GetSize(); i ++) { |
| 336 CPDF_Dictionary* pPageDict = GetPage(i); | 303 CPDF_Dictionary* pPageDict = GetPage(i); |
| 337 if (pPageDict == pThisPageDict) { | 304 if (pPageDict == pThisPageDict) { |
| 338 continue; | 305 continue; |
| 339 } | 306 } |
| 340 CPDF_Object* pContents = pPageDict ? pPageDict->GetElement(FX_BSTRC("Con
tents")) : NULL; | 307 CPDF_Object* pContents = pPageDict ? pPageDict->GetElement(FX_BSTRC("Con
tents")) : NULL; |
| 341 if (pContents == NULL) { | 308 if (pContents == NULL) { |
| 342 continue; | 309 continue; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 if (m_pDocPage) { | 360 if (m_pDocPage) { |
| 394 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); | 361 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); |
| 395 } | 362 } |
| 396 } | 363 } |
| 397 void CPDF_Document::ClearRenderData() | 364 void CPDF_Document::ClearRenderData() |
| 398 { | 365 { |
| 399 if (m_pDocRender) { | 366 if (m_pDocRender) { |
| 400 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); | 367 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); |
| 401 } | 368 } |
| 402 } | 369 } |
| OLD | NEW |