| 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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "xfa/fgas/font/cfgas_fontmgr.h" | 14 #include "xfa/fgas/font/cfgas_fontmgr.h" |
| 15 #include "xfa/fwl/core/cfwl_notedriver.h" | 15 #include "xfa/fwl/core/cfwl_notedriver.h" |
| 16 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 16 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
| 17 #include "xfa/fxfa/app/xfa_fwladapter.h" | 17 #include "xfa/fxfa/app/xfa_fwladapter.h" |
| 18 #include "xfa/fxfa/app/xfa_fwltheme.h" | 18 #include "xfa/fxfa/app/xfa_fwltheme.h" |
| 19 #include "xfa/fxfa/xfa_ffdoc.h" | 19 #include "xfa/fxfa/xfa_ffdoc.h" |
| 20 #include "xfa/fxfa/xfa_ffdochandler.h" | 20 #include "xfa/fxfa/xfa_ffdochandler.h" |
| 21 #include "xfa/fxfa/xfa_ffwidgethandler.h" | 21 #include "xfa/fxfa/xfa_ffwidgethandler.h" |
| 22 #include "xfa/fxfa/xfa_fontmgr.h" | 22 #include "xfa/fxfa/xfa_fontmgr.h" |
| 23 | 23 |
| 24 namespace { |
| 25 |
| 26 class CXFA_FileRead : public IFX_SeekableReadStream { |
| 27 public: |
| 28 explicit CXFA_FileRead(const std::vector<CPDF_Stream*>& streams); |
| 29 ~CXFA_FileRead() override; |
| 30 |
| 31 // IFX_SeekableReadStream |
| 32 FX_FILESIZE GetSize() override; |
| 33 bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; |
| 34 void Release() override; |
| 35 |
| 36 private: |
| 37 CFX_ObjectArray<CPDF_StreamAcc> m_Data; |
| 38 }; |
| 39 |
| 24 CXFA_FileRead::CXFA_FileRead(const std::vector<CPDF_Stream*>& streams) { | 40 CXFA_FileRead::CXFA_FileRead(const std::vector<CPDF_Stream*>& streams) { |
| 25 for (CPDF_Stream* pStream : streams) { | 41 for (CPDF_Stream* pStream : streams) { |
| 26 CPDF_StreamAcc& acc = m_Data.Add(); | 42 CPDF_StreamAcc& acc = m_Data.Add(); |
| 27 acc.LoadAllData(pStream); | 43 acc.LoadAllData(pStream); |
| 28 } | 44 } |
| 29 } | 45 } |
| 30 | 46 |
| 31 CXFA_FileRead::~CXFA_FileRead() {} | 47 CXFA_FileRead::~CXFA_FileRead() {} |
| 32 | 48 |
| 33 FX_FILESIZE CXFA_FileRead::GetSize() { | 49 FX_FILESIZE CXFA_FileRead::GetSize() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 offset = 0; | 81 offset = 0; |
| 66 index++; | 82 index++; |
| 67 } | 83 } |
| 68 return false; | 84 return false; |
| 69 } | 85 } |
| 70 | 86 |
| 71 void CXFA_FileRead::Release() { | 87 void CXFA_FileRead::Release() { |
| 72 delete this; | 88 delete this; |
| 73 } | 89 } |
| 74 | 90 |
| 91 } // namespace |
| 92 |
| 93 IFX_SeekableReadStream* MakeSeekableReadStream( |
| 94 const std::vector<CPDF_Stream*>& streams) { |
| 95 return new CXFA_FileRead(streams); |
| 96 } |
| 97 |
| 75 CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) | 98 CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) |
| 76 : m_pProvider(pProvider), | 99 : m_pProvider(pProvider), |
| 77 m_pWidgetMgrDelegate(nullptr), | 100 m_pWidgetMgrDelegate(nullptr), |
| 78 m_pFWLApp(new CFWL_App(this)) {} | 101 m_pFWLApp(new CFWL_App(this)) {} |
| 79 | 102 |
| 80 CXFA_FFApp::~CXFA_FFApp() {} | 103 CXFA_FFApp::~CXFA_FFApp() {} |
| 81 | 104 |
| 82 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { | 105 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { |
| 83 if (!m_pDocHandler) | 106 if (!m_pDocHandler) |
| 84 m_pDocHandler.reset(new CXFA_FFDocHandler); | 107 m_pDocHandler.reset(new CXFA_FFDocHandler); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 return m_pAdapterWidgetMgr.get(); | 164 return m_pAdapterWidgetMgr.get(); |
| 142 } | 165 } |
| 143 | 166 |
| 144 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const { | 167 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const { |
| 145 return m_pProvider->GetTimerMgr(); | 168 return m_pProvider->GetTimerMgr(); |
| 146 } | 169 } |
| 147 | 170 |
| 148 void CXFA_FFApp::ClearEventTargets() { | 171 void CXFA_FFApp::ClearEventTargets() { |
| 149 m_pFWLApp->GetNoteDriver()->ClearEventTargets(false); | 172 m_pFWLApp->GetNoteDriver()->ClearEventTargets(false); |
| 150 } | 173 } |
| OLD | NEW |