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

Side by Side Diff: fpdfsdk/pdfwindow/PWL_FontMap.cpp

Issue 2275773003: Flip document and parser ownership (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@private_parser
Patch Set: Rebase to master Created 4 years, 4 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
« no previous file with comments | « fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "fpdfsdk/pdfwindow/PWL_FontMap.h" 7 #include "fpdfsdk/pdfwindow/PWL_FontMap.h"
8 8
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h"
11 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h"
12 #include "core/fpdfapi/include/cpdf_modulemgr.h" 13 #include "core/fpdfapi/include/cpdf_modulemgr.h"
13 #include "core/fpdfdoc/include/ipvt_fontmap.h" 14 #include "core/fpdfdoc/include/ipvt_fontmap.h"
14 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" 15 #include "fpdfsdk/pdfwindow/PWL_Wnd.h"
15 16
16 namespace { 17 namespace {
17 18
18 const char kDefaultFontName[] = "Helvetica"; 19 const char kDefaultFontName[] = "Helvetica";
19 20
20 const char* const g_sDEStandardFontName[] = {"Courier", 21 const char* const g_sDEStandardFontName[] = {"Courier",
21 "Courier-Bold", 22 "Courier-Bold",
(...skipping 21 matching lines...) Expand all
43 Empty(); 44 Empty();
44 } 45 }
45 46
46 void CPWL_FontMap::SetSystemHandler(CFX_SystemHandler* pSystemHandler) { 47 void CPWL_FontMap::SetSystemHandler(CFX_SystemHandler* pSystemHandler) {
47 m_pSystemHandler = pSystemHandler; 48 m_pSystemHandler = pSystemHandler;
48 } 49 }
49 50
50 CPDF_Document* CPWL_FontMap::GetDocument() { 51 CPDF_Document* CPWL_FontMap::GetDocument() {
51 if (!m_pPDFDoc) { 52 if (!m_pPDFDoc) {
52 if (CPDF_ModuleMgr::Get()) { 53 if (CPDF_ModuleMgr::Get()) {
53 m_pPDFDoc.reset(new CPDF_Document(nullptr)); 54 m_pPDFDoc.reset(new CPDF_Document(std::unique_ptr<CPDF_Parser>()));
54 m_pPDFDoc->CreateNewDoc(); 55 m_pPDFDoc->CreateNewDoc();
55 } 56 }
56 } 57 }
57 58
58 return m_pPDFDoc.get(); 59 return m_pPDFDoc.get();
59 } 60 }
60 61
61 CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) { 62 CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) {
62 if (nFontIndex >= 0 && nFontIndex < m_aData.GetSize()) { 63 if (nFontIndex >= 0 && nFontIndex < m_aData.GetSize()) {
63 if (CPWL_FontMap_Data* pData = m_aData.GetAt(nFontIndex)) { 64 if (CPWL_FontMap_Data* pData = m_aData.GetAt(nFontIndex)) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 488
488 CPWL_DocFontMap::CPWL_DocFontMap(CFX_SystemHandler* pSystemHandler, 489 CPWL_DocFontMap::CPWL_DocFontMap(CFX_SystemHandler* pSystemHandler,
489 CPDF_Document* pAttachedDoc) 490 CPDF_Document* pAttachedDoc)
490 : CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) {} 491 : CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) {}
491 492
492 CPWL_DocFontMap::~CPWL_DocFontMap() {} 493 CPWL_DocFontMap::~CPWL_DocFontMap() {}
493 494
494 CPDF_Document* CPWL_DocFontMap::GetDocument() { 495 CPDF_Document* CPWL_DocFontMap::GetDocument() {
495 return m_pAttachedDoc; 496 return m_pAttachedDoc;
496 } 497 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698