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/parser/cpdf_document.h" | 7 #include "core/fpdfapi/parser/cpdf_document.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 #include <utility> | |
12 #include <vector> | 11 #include <vector> |
13 | 12 |
14 #include "core/fpdfapi/cpdf_modulemgr.h" | 13 #include "core/fpdfapi/cpdf_modulemgr.h" |
15 #include "core/fpdfapi/font/cpdf_fontencoding.h" | 14 #include "core/fpdfapi/font/cpdf_fontencoding.h" |
16 #include "core/fpdfapi/page/cpdf_docpagedata.h" | 15 #include "core/fpdfapi/page/cpdf_docpagedata.h" |
17 #include "core/fpdfapi/page/cpdf_pagemodule.h" | 16 #include "core/fpdfapi/page/cpdf_pagemodule.h" |
18 #include "core/fpdfapi/page/pageint.h" | 17 #include "core/fpdfapi/page/pageint.h" |
19 #include "core/fpdfapi/parser/cpdf_array.h" | 18 #include "core/fpdfapi/parser/cpdf_array.h" |
20 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 19 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
21 #include "core/fpdfapi/parser/cpdf_number.h" | 20 #include "core/fpdfapi/parser/cpdf_number.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 int size = end - start + 1; | 233 int size = end - start + 1; |
235 int* widths = FX_Alloc(int, size); | 234 int* widths = FX_Alloc(int, size); |
236 int i; | 235 int i; |
237 for (i = 0; i < size; i++) { | 236 for (i = 0; i < size; i++) { |
238 int glyph_index = pEncoding->GlyphFromCharCode(start + i); | 237 int glyph_index = pEncoding->GlyphFromCharCode(start + i); |
239 widths[i] = pFont->GetGlyphWidth(glyph_index); | 238 widths[i] = pFont->GetGlyphWidth(glyph_index); |
240 } | 239 } |
241 InsertWidthArrayImpl(widths, size, pWidthArray); | 240 InsertWidthArrayImpl(widths, size, pWidthArray); |
242 } | 241 } |
243 | 242 |
| 243 int InsertDeletePDFPage(CPDF_Document* pDoc, |
| 244 CPDF_Dictionary* pPages, |
| 245 int nPagesToGo, |
| 246 CPDF_Dictionary* pPage, |
| 247 FX_BOOL bInsert, |
| 248 std::set<CPDF_Dictionary*>* pVisited) { |
| 249 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); |
| 250 if (!pKidList) |
| 251 return -1; |
| 252 |
| 253 for (size_t i = 0; i < pKidList->GetCount(); i++) { |
| 254 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); |
| 255 if (pKid->GetStringFor("Type") == "Page") { |
| 256 if (nPagesToGo == 0) { |
| 257 if (bInsert) { |
| 258 pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum())); |
| 259 pPage->SetReferenceFor("Parent", pDoc, pPages->GetObjNum()); |
| 260 } else { |
| 261 pKidList->RemoveAt(i); |
| 262 } |
| 263 pPages->SetIntegerFor( |
| 264 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); |
| 265 return 1; |
| 266 } |
| 267 nPagesToGo--; |
| 268 } else { |
| 269 int nPages = pKid->GetIntegerFor("Count"); |
| 270 if (nPagesToGo < nPages) { |
| 271 if (pdfium::ContainsKey(*pVisited, pKid)) |
| 272 return -1; |
| 273 |
| 274 pdfium::ScopedSetInsertion<CPDF_Dictionary*> insertion(pVisited, pKid); |
| 275 if (InsertDeletePDFPage(pDoc, pKid, nPagesToGo, pPage, bInsert, |
| 276 pVisited) < 0) { |
| 277 return -1; |
| 278 } |
| 279 pPages->SetIntegerFor( |
| 280 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); |
| 281 return 1; |
| 282 } |
| 283 nPagesToGo -= nPages; |
| 284 } |
| 285 } |
| 286 return 0; |
| 287 } |
| 288 |
| 289 int InsertNewPage(CPDF_Document* pDoc, |
| 290 int iPage, |
| 291 CPDF_Dictionary* pPageDict, |
| 292 CFX_ArrayTemplate<uint32_t>& pageList) { |
| 293 CPDF_Dictionary* pRoot = pDoc->GetRoot(); |
| 294 CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictFor("Pages") : nullptr; |
| 295 if (!pPages) |
| 296 return -1; |
| 297 |
| 298 int nPages = pDoc->GetPageCount(); |
| 299 if (iPage < 0 || iPage > nPages) |
| 300 return -1; |
| 301 |
| 302 if (iPage == nPages) { |
| 303 CPDF_Array* pPagesList = pPages->GetArrayFor("Kids"); |
| 304 if (!pPagesList) { |
| 305 pPagesList = new CPDF_Array; |
| 306 pPages->SetFor("Kids", pPagesList); |
| 307 } |
| 308 pPagesList->Add(new CPDF_Reference(pDoc, pPageDict->GetObjNum())); |
| 309 pPages->SetIntegerFor("Count", nPages + 1); |
| 310 pPageDict->SetReferenceFor("Parent", pDoc, pPages->GetObjNum()); |
| 311 } else { |
| 312 std::set<CPDF_Dictionary*> stack = {pPages}; |
| 313 if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, &stack) < 0) |
| 314 return -1; |
| 315 } |
| 316 pageList.InsertAt(iPage, pPageDict->GetObjNum()); |
| 317 return iPage; |
| 318 } |
| 319 |
244 int CountPages(CPDF_Dictionary* pPages, | 320 int CountPages(CPDF_Dictionary* pPages, |
245 std::set<CPDF_Dictionary*>* visited_pages) { | 321 std::set<CPDF_Dictionary*>* visited_pages) { |
246 int count = pPages->GetIntegerFor("Count"); | 322 int count = pPages->GetIntegerFor("Count"); |
247 if (count > 0 && count < FPDF_PAGE_MAX_NUM) | 323 if (count > 0 && count < FPDF_PAGE_MAX_NUM) |
248 return count; | 324 return count; |
249 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); | 325 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); |
250 if (!pKidList) | 326 if (!pKidList) |
251 return 0; | 327 return 0; |
252 count = 0; | 328 count = 0; |
253 for (size_t i = 0; i < pKidList->GetCount(); i++) { | 329 for (size_t i = 0; i < pKidList->GetCount(); i++) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 return pFontDesc; | 406 return pFontDesc; |
331 } | 407 } |
332 | 408 |
333 } // namespace | 409 } // namespace |
334 | 410 |
335 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser) | 411 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser) |
336 : CPDF_IndirectObjectHolder(), | 412 : CPDF_IndirectObjectHolder(), |
337 m_pParser(std::move(pParser)), | 413 m_pParser(std::move(pParser)), |
338 m_pRootDict(nullptr), | 414 m_pRootDict(nullptr), |
339 m_pInfoDict(nullptr), | 415 m_pInfoDict(nullptr), |
340 m_iLastPageTraversed(-1), | |
341 m_bLinearized(false), | 416 m_bLinearized(false), |
342 m_iFirstPageNo(0), | 417 m_iFirstPageNo(0), |
343 m_dwFirstPageObjNum(0), | 418 m_dwFirstPageObjNum(0), |
344 m_pDocPage(new CPDF_DocPageData(this)), | 419 m_pDocPage(new CPDF_DocPageData(this)), |
345 m_pDocRender(new CPDF_DocRenderData(this)), | 420 m_pDocRender(new CPDF_DocRenderData(this)), |
346 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) { | 421 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) { |
347 if (pParser) | 422 if (pParser) |
348 SetLastObjNum(m_pParser->GetLastObjNum()); | 423 SetLastObjNum(m_pParser->GetLastObjNum()); |
349 } | 424 } |
350 | 425 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 470 |
396 CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O"); | 471 CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O"); |
397 if (ToNumber(pObjNum)) | 472 if (ToNumber(pObjNum)) |
398 m_dwFirstPageObjNum = pObjNum->GetInteger(); | 473 m_dwFirstPageObjNum = pObjNum->GetInteger(); |
399 } | 474 } |
400 | 475 |
401 void CPDF_Document::LoadPages() { | 476 void CPDF_Document::LoadPages() { |
402 m_PageList.SetSize(RetrievePageCount()); | 477 m_PageList.SetSize(RetrievePageCount()); |
403 } | 478 } |
404 | 479 |
405 void CPDF_Document::PopAndPropagate() { | 480 CPDF_Dictionary* CPDF_Document::FindPDFPage(CPDF_Dictionary* pPages, |
406 m_pTreeTraversal.pop(); | 481 int iPage, |
407 if (m_pTreeTraversal.empty()) | 482 int nPagesToGo, |
408 return; | 483 int level) { |
409 std::pair<CPDF_Dictionary*, int>* top = &m_pTreeTraversal.top(); | 484 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); |
410 top->second++; | 485 if (!pKidList) |
411 if (top->second == | 486 return nPagesToGo == 0 ? pPages : nullptr; |
412 static_cast<int>(top->first->GetArrayFor("Kids")->GetCount() - 1)) { | |
413 PopAndPropagate(); | |
414 } | |
415 } | |
416 | 487 |
417 CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage, int nPagesToGo) { | 488 if (level >= FX_MAX_PAGE_LEVEL) |
418 std::pair<CPDF_Dictionary*, int>* lastProc = &m_pTreeTraversal.top(); | 489 return nullptr; |
419 CPDF_Dictionary* pPages = lastProc->first; | |
420 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); | |
421 if (!pKidList) { | |
422 PopAndPropagate(); | |
423 if (nPagesToGo != 1) | |
424 return nullptr; | |
425 m_PageList.SetAt(iPage, pPages->GetObjNum()); | |
426 return pPages; | |
427 } | |
428 | 490 |
429 if (m_pTreeTraversal.size() >= FX_MAX_PAGE_LEVEL) { | 491 for (size_t i = 0; i < pKidList->GetCount(); i++) { |
430 PopAndPropagate(); | |
431 return nullptr; | |
432 } | |
433 | |
434 CPDF_Dictionary* page = nullptr; | |
435 for (size_t i = lastProc->second + 1; i < pKidList->GetCount(); i++) { | |
436 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); | 492 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); |
437 if (!pKid) { | 493 if (!pKid) { |
438 nPagesToGo--; | 494 nPagesToGo--; |
439 lastProc->second++; | |
440 continue; | 495 continue; |
441 } | 496 } |
442 if (pKid == pPages) { | 497 if (pKid == pPages) |
443 lastProc->second++; | |
444 continue; | 498 continue; |
445 } | |
446 if (!pKid->KeyExist("Kids")) { | 499 if (!pKid->KeyExist("Kids")) { |
447 m_PageList.SetAt(iPage - nPagesToGo + 1, pKid->GetObjNum()); | 500 if (nPagesToGo == 0) |
| 501 return pKid; |
| 502 |
| 503 m_PageList.SetAt(iPage - nPagesToGo, pKid->GetObjNum()); |
448 nPagesToGo--; | 504 nPagesToGo--; |
449 lastProc->second++; | |
450 if (nPagesToGo == 0) { | |
451 page = pKid; | |
452 break; | |
453 } | |
454 } else { | 505 } else { |
455 int nPages = pKid->GetIntegerFor("Count"); | 506 int nPages = pKid->GetIntegerFor("Count"); |
456 m_pTreeTraversal.push(std::make_pair(pKid, -1)); | 507 if (nPagesToGo < nPages) |
457 CPDF_Dictionary* pageKid = TraversePDFPages(iPage, nPagesToGo); | 508 return FindPDFPage(pKid, iPage, nPagesToGo, level + 1); |
458 if (nPagesToGo <= nPages) { | 509 |
459 page = pageKid; | |
460 break; | |
461 } | |
462 nPagesToGo -= nPages; | 510 nPagesToGo -= nPages; |
463 } | 511 } |
464 } | 512 } |
465 if (!m_pTreeTraversal.empty() && lastProc == &m_pTreeTraversal.top() && | 513 return nullptr; |
466 lastProc->second == static_cast<int>(pKidList->GetCount() - 1)) { | |
467 PopAndPropagate(); | |
468 } | |
469 return page; | |
470 } | 514 } |
471 | 515 |
472 CPDF_Dictionary* CPDF_Document::GetPagesDict() const { | 516 CPDF_Dictionary* CPDF_Document::GetPagesDict() const { |
473 CPDF_Dictionary* pRoot = GetRoot(); | 517 CPDF_Dictionary* pRoot = GetRoot(); |
474 return pRoot ? pRoot->GetDictFor("Pages") : nullptr; | 518 return pRoot ? pRoot->GetDictFor("Pages") : nullptr; |
475 } | 519 } |
476 | 520 |
477 bool CPDF_Document::IsPageLoaded(int iPage) const { | 521 bool CPDF_Document::IsPageLoaded(int iPage) const { |
478 return !!m_PageList.GetAt(iPage); | 522 return !!m_PageList.GetAt(iPage); |
479 } | 523 } |
480 | 524 |
481 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { | 525 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { |
482 if (iPage < 0 || iPage >= m_PageList.GetSize()) | 526 if (iPage < 0 || iPage >= m_PageList.GetSize()) |
483 return nullptr; | 527 return nullptr; |
484 | 528 |
485 if (m_bLinearized && (iPage == m_iFirstPageNo)) { | 529 if (m_bLinearized && (iPage == m_iFirstPageNo)) { |
486 if (CPDF_Dictionary* pDict = | 530 if (CPDF_Dictionary* pDict = |
487 ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) { | 531 ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) { |
488 return pDict; | 532 return pDict; |
489 } | 533 } |
490 } | 534 } |
491 | 535 |
492 int objnum = m_PageList.GetAt(iPage); | 536 int objnum = m_PageList.GetAt(iPage); |
493 if (!objnum) { | 537 if (objnum) { |
494 CPDF_Dictionary* pPages = GetPagesDict(); | 538 if (CPDF_Dictionary* pDict = ToDictionary(GetOrParseIndirectObject(objnum))) |
495 if (!pPages) | 539 return pDict; |
496 return nullptr; | |
497 if (m_pTreeTraversal.empty()) | |
498 m_pTreeTraversal.push(std::make_pair(pPages, -1)); | |
499 CPDF_Dictionary* page = | |
500 TraversePDFPages(iPage, iPage - m_iLastPageTraversed); | |
501 m_iLastPageTraversed = iPage; | |
502 return page; | |
503 } | 540 } |
504 if (CPDF_Dictionary* pDict = ToDictionary(GetOrParseIndirectObject(objnum))) | 541 |
505 return pDict; | 542 CPDF_Dictionary* pPages = GetPagesDict(); |
506 return nullptr; | 543 if (!pPages) |
| 544 return nullptr; |
| 545 |
| 546 CPDF_Dictionary* pPage = FindPDFPage(pPages, iPage, iPage, 0); |
| 547 if (!pPage) |
| 548 return nullptr; |
| 549 |
| 550 m_PageList.SetAt(iPage, pPage->GetObjNum()); |
| 551 return pPage; |
507 } | 552 } |
508 | 553 |
509 void CPDF_Document::SetPageObjNum(int iPage, uint32_t objNum) { | 554 void CPDF_Document::SetPageObjNum(int iPage, uint32_t objNum) { |
510 m_PageList.SetAt(iPage, objNum); | 555 m_PageList.SetAt(iPage, objNum); |
511 } | 556 } |
512 | 557 |
513 int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode, | 558 int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode, |
514 uint32_t& skip_count, | 559 uint32_t& skip_count, |
515 uint32_t objnum, | 560 uint32_t objnum, |
516 int& index, | 561 int& index, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 pPages->SetFor("Kids", new CPDF_Array); | 703 pPages->SetFor("Kids", new CPDF_Array); |
659 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages)); | 704 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages)); |
660 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool); | 705 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool); |
661 AddIndirectObject(m_pInfoDict); | 706 AddIndirectObject(m_pInfoDict); |
662 } | 707 } |
663 | 708 |
664 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { | 709 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { |
665 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); | 710 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); |
666 pDict->SetNameFor("Type", "Page"); | 711 pDict->SetNameFor("Type", "Page"); |
667 uint32_t dwObjNum = AddIndirectObject(pDict); | 712 uint32_t dwObjNum = AddIndirectObject(pDict); |
668 if (InsertNewPage(iPage, pDict, m_PageList) < 0) { | 713 if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { |
669 ReleaseIndirectObject(dwObjNum); | 714 ReleaseIndirectObject(dwObjNum); |
670 return nullptr; | 715 return nullptr; |
671 } | 716 } |
672 return pDict; | 717 return pDict; |
673 } | 718 } |
674 | 719 |
675 int CPDF_Document::InsertDeletePDFPage(CPDF_Dictionary* pPages, | |
676 int nPagesToGo, | |
677 CPDF_Dictionary* pPage, | |
678 FX_BOOL bInsert, | |
679 std::set<CPDF_Dictionary*>* pVisited) { | |
680 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); | |
681 if (!pKidList) | |
682 return -1; | |
683 | |
684 for (size_t i = 0; i < pKidList->GetCount(); i++) { | |
685 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); | |
686 if (pKid->GetStringFor("Type") == "Page") { | |
687 if (nPagesToGo == 0) { | |
688 if (bInsert) { | |
689 pKidList->InsertAt(i, new CPDF_Reference(this, pPage->GetObjNum())); | |
690 pPage->SetReferenceFor("Parent", this, pPages->GetObjNum()); | |
691 } else { | |
692 pKidList->RemoveAt(i); | |
693 } | |
694 pPages->SetIntegerFor( | |
695 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); | |
696 // Tree will change, so reset tree transversal variables | |
697 m_iLastPageTraversed = -1; | |
698 m_pTreeTraversal = std::stack<std::pair<CPDF_Dictionary*, int>>(); | |
699 return 1; | |
700 } | |
701 nPagesToGo--; | |
702 } else { | |
703 int nPages = pKid->GetIntegerFor("Count"); | |
704 if (nPagesToGo < nPages) { | |
705 if (pdfium::ContainsKey(*pVisited, pKid)) | |
706 return -1; | |
707 | |
708 pdfium::ScopedSetInsertion<CPDF_Dictionary*> insertion(pVisited, pKid); | |
709 if (InsertDeletePDFPage(pKid, nPagesToGo, pPage, bInsert, pVisited) < | |
710 0) { | |
711 return -1; | |
712 } | |
713 pPages->SetIntegerFor( | |
714 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); | |
715 return 1; | |
716 } | |
717 nPagesToGo -= nPages; | |
718 } | |
719 } | |
720 return 0; | |
721 } | |
722 | |
723 int CPDF_Document::InsertNewPage(int iPage, | |
724 CPDF_Dictionary* pPageDict, | |
725 CFX_ArrayTemplate<uint32_t>& pageList) { | |
726 CPDF_Dictionary* pRoot = GetRoot(); | |
727 CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictFor("Pages") : nullptr; | |
728 if (!pPages) | |
729 return -1; | |
730 | |
731 int nPages = GetPageCount(); | |
732 if (iPage < 0 || iPage > nPages) | |
733 return -1; | |
734 | |
735 if (iPage == nPages) { | |
736 CPDF_Array* pPagesList = pPages->GetArrayFor("Kids"); | |
737 if (!pPagesList) { | |
738 pPagesList = new CPDF_Array; | |
739 pPages->SetFor("Kids", pPagesList); | |
740 } | |
741 pPagesList->Add(new CPDF_Reference(this, pPageDict->GetObjNum())); | |
742 pPages->SetIntegerFor("Count", nPages + 1); | |
743 pPageDict->SetReferenceFor("Parent", this, pPages->GetObjNum()); | |
744 // Reset tree transversal variables | |
745 m_iLastPageTraversed = -1; | |
746 m_pTreeTraversal = std::stack<std::pair<CPDF_Dictionary*, int>>(); | |
747 } else { | |
748 std::set<CPDF_Dictionary*> stack = {pPages}; | |
749 if (InsertDeletePDFPage(pPages, iPage, pPageDict, TRUE, &stack) < 0) | |
750 return -1; | |
751 } | |
752 pageList.InsertAt(iPage, pPageDict->GetObjNum()); | |
753 return iPage; | |
754 } | |
755 | |
756 void CPDF_Document::DeletePage(int iPage) { | 720 void CPDF_Document::DeletePage(int iPage) { |
757 CPDF_Dictionary* pPages = GetPagesDict(); | 721 CPDF_Dictionary* pPages = GetPagesDict(); |
758 if (!pPages) | 722 if (!pPages) |
759 return; | 723 return; |
760 | 724 |
761 int nPages = pPages->GetIntegerFor("Count"); | 725 int nPages = pPages->GetIntegerFor("Count"); |
762 if (iPage < 0 || iPage >= nPages) | 726 if (iPage < 0 || iPage >= nPages) |
763 return; | 727 return; |
764 | 728 |
765 std::set<CPDF_Dictionary*> stack = {pPages}; | 729 std::set<CPDF_Dictionary*> stack = {pPages}; |
766 if (InsertDeletePDFPage(pPages, iPage, nullptr, FALSE, &stack) < 0) | 730 if (InsertDeletePDFPage(this, pPages, iPage, nullptr, FALSE, &stack) < 0) |
767 return; | 731 return; |
768 | 732 |
769 m_PageList.RemoveAt(iPage); | 733 m_PageList.RemoveAt(iPage); |
770 } | 734 } |
771 | 735 |
772 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, | 736 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, |
773 CPDF_FontEncoding* pEncoding) { | 737 CPDF_FontEncoding* pEncoding) { |
774 CFX_ByteString name(font); | 738 CFX_ByteString name(font); |
775 if (PDF_GetStandardFontName(&name) < 0) | 739 if (PDF_GetStandardFontName(&name) < 0) |
776 return nullptr; | 740 return nullptr; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 pBBox, pLogFont->lfWeight / 5); | 1013 pBBox, pLogFont->lfWeight / 5); |
1050 pFontDesc->SetIntegerFor("CapHeight", capheight); | 1014 pFontDesc->SetIntegerFor("CapHeight", capheight); |
1051 pFontDict->SetReferenceFor("FontDescriptor", this, | 1015 pFontDict->SetReferenceFor("FontDescriptor", this, |
1052 AddIndirectObject(pFontDesc)); | 1016 AddIndirectObject(pFontDesc)); |
1053 hFont = SelectObject(hDC, hFont); | 1017 hFont = SelectObject(hDC, hFont); |
1054 DeleteObject(hFont); | 1018 DeleteObject(hFont); |
1055 DeleteDC(hDC); | 1019 DeleteDC(hDC); |
1056 return LoadFont(pBaseDict); | 1020 return LoadFont(pBaseDict); |
1057 } | 1021 } |
1058 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 1022 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
OLD | NEW |