1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FFAPP_H_
8 #define XFA_FFAPP_H_
9 
10 class CXFA_FileRead : public IFX_FileRead {
11  public:
12   explicit CXFA_FileRead(const CFX_ArrayTemplate<CPDF_Stream*>& streams);
13 
14   virtual FX_FILESIZE GetSize();
15   virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
16 
Release()17   virtual void Release() { delete this; }
18 
19  protected:
20   CFX_ObjectArray<CPDF_StreamAcc> m_Data;
21 };
22 class CXFA_FWLAdapterWidgetMgr;
23 class CXFA_FWLTheme;
24 class CXFA_FFDocHandler;
25 class CXFA_FFMenuHandler;
26 class CXFA_FontMgr;
27 class CXFA_FFApp : public IXFA_App, public IFWL_AdapterNative {
28  public:
29   CXFA_FFApp(IXFA_AppProvider* pProvider);
30   ~CXFA_FFApp() override;
31 
32   // IFXFA_App:
33   IXFA_DocHandler* GetDocHandler() override;
34   IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider,
35                       IFX_FileRead* pStream,
36                       FX_BOOL bTakeOverFile) override;
37   IXFA_Doc* CreateDoc(IXFA_DocProvider* pProvider,
38                       CPDF_Document* pPDFDoc) override;
GetAppProvider()39   IXFA_AppProvider* GetAppProvider() override { return m_pProvider; }
40   void SetDefaultFontMgr(IXFA_FontMgr* pFontMgr) override;
41   IXFA_MenuHandler* GetMenuHandler() override;
42 
43   // IFWL_AdapterNative:
44   IFWL_AdapterWidgetMgr* GetWidgetMgr(
45       IFWL_WidgetMgrDelegate* pDelegate) override;
46   IFWL_AdapterThreadMgr* GetThreadMgr() override;
47   IFWL_AdapterTimerMgr* GetTimerMgr() override;
48   IFWL_AdapterCursorMgr* GetCursorMgr() override;
49   IFWL_AdapterMonitorMgr* GetMonitorMgr() override;
50   IFWL_AdapterClipboardMgr* GetClipboardMgr() override;
51 
52   CXFA_FontMgr* GetXFAFontMgr();
53   IFX_FontMgr* GetFDEFontMgr();
54   CXFA_FWLTheme* GetFWLTheme();
GetWidgetMgrDelegate()55   IFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() {
56     return m_pWidgetMgrDelegate;
57   }
58 
59  protected:
60   CXFA_FFDocHandler* m_pDocHandler;
61   IFWL_App* m_pFWLApp;
62   CXFA_FWLTheme* m_pFWLTheme;
63   IXFA_AppProvider* m_pProvider;
64   CXFA_FontMgr* m_pFontMgr;
65 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
66   IFX_FontSourceEnum* m_pFontSource;
67 #endif
68   CXFA_FWLAdapterWidgetMgr* m_pAdapterWidgetMgr;
69   IFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate;
70   IFX_FontMgr* m_pFDEFontMgr;
71   CXFA_FFMenuHandler* m_pMenuHandler;
72   CFWL_SDAdapterThreadMgr* m_pAdapterThreadMgr;
73 };
74 
75 #endif  // XFA_FFAPP_H_
76