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 "xfa/fxfa/xfa_ffapp.h" | 7 #include "xfa/fxfa/xfa_ffapp.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 m_pFWLApp(new CFWL_App(this)) {} | 95 m_pFWLApp(new CFWL_App(this)) {} |
96 | 96 |
97 CXFA_FFApp::~CXFA_FFApp() {} | 97 CXFA_FFApp::~CXFA_FFApp() {} |
98 | 98 |
99 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { | 99 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { |
100 if (!m_pDocHandler) | 100 if (!m_pDocHandler) |
101 m_pDocHandler = pdfium::MakeUnique<CXFA_FFDocHandler>(); | 101 m_pDocHandler = pdfium::MakeUnique<CXFA_FFDocHandler>(); |
102 return m_pDocHandler.get(); | 102 return m_pDocHandler.get(); |
103 } | 103 } |
104 | 104 |
105 CXFA_FFDoc* CXFA_FFApp::CreateDoc( | 105 std::unique_ptr<CXFA_FFDoc> CXFA_FFApp::CreateDoc( |
106 IXFA_DocEnvironment* pDocEnvironment, | 106 IXFA_DocEnvironment* pDocEnvironment, |
107 const CFX_RetainPtr<IFX_SeekableReadStream>& pStream) { | 107 CPDF_Document* pPDFDoc) { |
108 auto pDoc = pdfium::MakeUnique<CXFA_FFDoc>(this, pDocEnvironment); | |
109 return pDoc->OpenDoc(pStream) ? pDoc.release() : nullptr; | |
110 } | |
111 | |
112 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocEnvironment* pDocEnvironment, | |
113 CPDF_Document* pPDFDoc) { | |
114 if (!pPDFDoc) | 108 if (!pPDFDoc) |
115 return nullptr; | 109 return nullptr; |
116 | 110 |
117 std::unique_ptr<CXFA_FFDoc> pDoc(new CXFA_FFDoc(this, pDocEnvironment)); | 111 auto pDoc = pdfium::MakeUnique<CXFA_FFDoc>(this, pDocEnvironment); |
118 bool bSuccess = pDoc->OpenDoc(pPDFDoc); | 112 if (!pDoc->OpenDoc(pPDFDoc)) |
119 return bSuccess ? pDoc.release() : nullptr; | 113 return nullptr; |
| 114 |
| 115 return pDoc; |
120 } | 116 } |
121 | 117 |
122 void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { | 118 void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { |
123 if (!m_pFontMgr) | 119 if (!m_pFontMgr) |
124 m_pFontMgr = pdfium::MakeUnique<CXFA_FontMgr>(); | 120 m_pFontMgr = pdfium::MakeUnique<CXFA_FontMgr>(); |
125 m_pFontMgr->SetDefFontMgr(std::move(pFontMgr)); | 121 m_pFontMgr->SetDefFontMgr(std::move(pFontMgr)); |
126 } | 122 } |
127 | 123 |
128 CXFA_FontMgr* CXFA_FFApp::GetXFAFontMgr() const { | 124 CXFA_FontMgr* CXFA_FFApp::GetXFAFontMgr() const { |
129 return m_pFontMgr.get(); | 125 return m_pFontMgr.get(); |
(...skipping 27 matching lines...) Expand all Loading... |
157 return m_pAdapterWidgetMgr.get(); | 153 return m_pAdapterWidgetMgr.get(); |
158 } | 154 } |
159 | 155 |
160 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const { | 156 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const { |
161 return m_pProvider->GetTimerMgr(); | 157 return m_pProvider->GetTimerMgr(); |
162 } | 158 } |
163 | 159 |
164 void CXFA_FFApp::ClearEventTargets() { | 160 void CXFA_FFApp::ClearEventTargets() { |
165 m_pFWLApp->GetNoteDriver()->ClearEventTargets(false); | 161 m_pFWLApp->GetNoteDriver()->ClearEventTargets(false); |
166 } | 162 } |
OLD | NEW |