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/include/xfa_ffapp.h" | 7 #include "xfa/fxfa/include/xfa_ffapp.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "xfa/fgas/font/fgas_stdfontmgr.h" | 12 #include "xfa/fgas/font/fgas_stdfontmgr.h" |
13 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 13 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
14 #include "xfa/fxfa/app/xfa_fwladapter.h" | 14 #include "xfa/fxfa/app/xfa_fwladapter.h" |
15 #include "xfa/fxfa/app/xfa_fwltheme.h" | 15 #include "xfa/fxfa/app/xfa_fwltheme.h" |
16 #include "xfa/fxfa/include/xfa_ffdoc.h" | 16 #include "xfa/fxfa/include/xfa_ffdoc.h" |
17 #include "xfa/fxfa/include/xfa_ffdochandler.h" | 17 #include "xfa/fxfa/include/xfa_ffdochandler.h" |
18 #include "xfa/fxfa/include/xfa_ffwidgethandler.h" | 18 #include "xfa/fxfa/include/xfa_ffwidgethandler.h" |
19 #include "xfa/fxfa/include/xfa_fontmgr.h" | 19 #include "xfa/fxfa/include/xfa_fontmgr.h" |
20 | 20 |
21 CXFA_FileRead::CXFA_FileRead(const CFX_ArrayTemplate<CPDF_Stream*>& streams) { | 21 CXFA_FileRead::CXFA_FileRead(const CFX_ArrayTemplate<CPDF_Stream*>& streams) { |
22 int32_t iCount = streams.GetSize(); | 22 int32_t iCount = streams.GetSize(); |
23 for (int32_t i = 0; i < iCount; i++) { | 23 for (int32_t i = 0; i < iCount; i++) { |
24 CPDF_StreamAcc& acc = m_Data.Add(); | 24 CPDF_StreamAcc& acc = m_Data.Add(); |
25 acc.LoadAllData(streams[i]); | 25 acc.LoadAllData(streams[i]); |
26 } | 26 } |
27 } | 27 } |
| 28 |
| 29 CXFA_FileRead::~CXFA_FileRead() {} |
| 30 |
28 FX_FILESIZE CXFA_FileRead::GetSize() { | 31 FX_FILESIZE CXFA_FileRead::GetSize() { |
29 uint32_t dwSize = 0; | 32 uint32_t dwSize = 0; |
30 int32_t iCount = m_Data.GetSize(); | 33 int32_t iCount = m_Data.GetSize(); |
31 for (int32_t i = 0; i < iCount; i++) { | 34 for (int32_t i = 0; i < iCount; i++) { |
32 CPDF_StreamAcc& acc = m_Data[i]; | 35 CPDF_StreamAcc& acc = m_Data[i]; |
33 dwSize += acc.GetSize(); | 36 dwSize += acc.GetSize(); |
34 } | 37 } |
35 return dwSize; | 38 return dwSize; |
36 } | 39 } |
37 FX_BOOL CXFA_FileRead::ReadBlock(void* buffer, | 40 FX_BOOL CXFA_FileRead::ReadBlock(void* buffer, |
(...skipping 19 matching lines...) Expand all Loading... |
57 if (size == 0) { | 60 if (size == 0) { |
58 return TRUE; | 61 return TRUE; |
59 } | 62 } |
60 buffer = (uint8_t*)buffer + dwRead; | 63 buffer = (uint8_t*)buffer + dwRead; |
61 offset = 0; | 64 offset = 0; |
62 index++; | 65 index++; |
63 } | 66 } |
64 return FALSE; | 67 return FALSE; |
65 } | 68 } |
66 | 69 |
| 70 void CXFA_FileRead::Release() { |
| 71 delete this; |
| 72 } |
| 73 |
67 CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) | 74 CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) |
68 : m_pDocHandler(nullptr), | 75 : m_pDocHandler(nullptr), |
69 m_pFWLTheme(nullptr), | 76 m_pFWLTheme(nullptr), |
70 m_pProvider(pProvider), | 77 m_pProvider(pProvider), |
71 m_pFontMgr(nullptr), | 78 m_pFontMgr(nullptr), |
72 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 79 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
73 m_pFontSource(nullptr), | 80 m_pFontSource(nullptr), |
74 #endif | 81 #endif |
75 m_pAdapterWidgetMgr(nullptr), | 82 m_pAdapterWidgetMgr(nullptr), |
76 m_pWidgetMgrDelegate(nullptr), | 83 m_pWidgetMgrDelegate(nullptr), |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 m_pAdapterWidgetMgr = new CXFA_FWLAdapterWidgetMgr; | 172 m_pAdapterWidgetMgr = new CXFA_FWLAdapterWidgetMgr; |
166 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread | | 173 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread | |
167 FWL_WGTMGR_DisableForm); | 174 FWL_WGTMGR_DisableForm); |
168 m_pWidgetMgrDelegate = pDelegate; | 175 m_pWidgetMgrDelegate = pDelegate; |
169 } | 176 } |
170 return m_pAdapterWidgetMgr; | 177 return m_pAdapterWidgetMgr; |
171 } | 178 } |
172 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() { | 179 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() { |
173 return m_pProvider->GetTimerMgr(); | 180 return m_pProvider->GetTimerMgr(); |
174 } | 181 } |
OLD | NEW |