Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_INC_SALINST_HXX
21 : #define INCLUDED_VCL_INC_SALINST_HXX
22 :
23 : #include "com/sun/star/uno/Reference.hxx"
24 : #include "com/sun/star/uno/XComponentContext.hpp"
25 : #include "com/sun/star/ui/dialogs/XFilePicker2.hpp"
26 : #include "com/sun/star/ui/dialogs/XFolderPicker2.hpp"
27 :
28 : #include "tools/solar.h"
29 : #include "displayconnectiondispatch.hxx"
30 : #include "vcl/dllapi.h"
31 : #include <sal/types.h>
32 :
33 : #include "rtl/ref.hxx"
34 :
35 : #include <list>
36 :
37 : namespace comphelper { class SolarMutex; }
38 : struct SystemParentData;
39 : struct SalPrinterQueueInfo;
40 : struct ImplJobSetup;
41 : class SalGraphics;
42 : class SalFrame;
43 : class SalObject;
44 : class SalMenu;
45 : class SalMenuItem;
46 : class SalVirtualDevice;
47 : class SalInfoPrinter;
48 : class SalPrinter;
49 : class SalTimer;
50 : class ImplPrnQueueList;
51 : class SalI18NImeStatus;
52 : class SalSystem;
53 : class SalBitmap;
54 : struct SalItemParams;
55 : class SalSession;
56 : struct SystemGraphicsData;
57 : struct SystemWindowData;
58 : class Menu;
59 :
60 : class VCL_PLUGIN_PUBLIC SalInstance
61 : {
62 : private:
63 : rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
64 :
65 : public:
66 375 : SalInstance() {}
67 : virtual ~SalInstance();
68 :
69 : //called directly after Application::Init
70 375 : virtual void AfterAppInit() {}
71 :
72 : // Frame
73 : // DisplayName for Unix ???
74 : virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) = 0;
75 : virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ) = 0;
76 : virtual void DestroyFrame( SalFrame* pFrame ) = 0;
77 :
78 : // Object (System Child Window)
79 : virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) = 0;
80 : virtual void DestroyObject( SalObject* pObject ) = 0;
81 :
82 : // VirtualDevice
83 : // nDX and nDY in pixels
84 : // nBitCount: 0 == default(=as window) / 1 == mono
85 : // pData allows for using a system dependent graphics or device context
86 : virtual SalVirtualDevice*
87 : CreateVirtualDevice( SalGraphics* pGraphics,
88 : long nDX, long nDY,
89 : sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) = 0;
90 :
91 : // Printer
92 : // pSetupData->mpDriverData can be 0
93 : // pSetupData must be updatet with the current
94 : // JobSetup
95 : virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
96 : ImplJobSetup* pSetupData ) = 0;
97 : virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0;
98 : virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0;
99 : virtual void DestroyPrinter( SalPrinter* pPrinter ) = 0;
100 :
101 : virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0;
102 : virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0;
103 : virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0;
104 : virtual OUString GetDefaultPrinter() = 0;
105 :
106 : // SalTimer
107 : virtual SalTimer* CreateSalTimer() = 0;
108 : // SalI18NImeStatus
109 : virtual SalI18NImeStatus*
110 : CreateI18NImeStatus() = 0;
111 : // SalSystem
112 : virtual SalSystem* CreateSalSystem() = 0;
113 : // SalBitmap
114 : virtual SalBitmap* CreateSalBitmap() = 0;
115 :
116 : // YieldMutex
117 : virtual comphelper::SolarMutex*
118 : GetYieldMutex() = 0;
119 : virtual sal_uLong ReleaseYieldMutex() = 0;
120 : virtual void AcquireYieldMutex( sal_uLong nCount ) = 0;
121 : // return true, if yield mutex is owned by this thread, else false
122 : virtual bool CheckYieldMutex() = 0;
123 :
124 : // wait next event and dispatch
125 : // must returned by UserEvent (SalFrame::PostEvent)
126 : // and timer
127 : virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) = 0;
128 : virtual bool AnyInput( sal_uInt16 nType ) = 0;
129 :
130 : // menus
131 : virtual SalMenu* CreateMenu( bool bMenuBar, Menu* pMenu );
132 : virtual void DestroyMenu( SalMenu* pMenu);
133 : virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
134 : virtual void DestroyMenuItem( SalMenuItem* pItem );
135 :
136 : // may return NULL to disable session management
137 : virtual SalSession* CreateSalSession() = 0;
138 :
139 : // methods for XDisplayConnection
140 :
141 222 : void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance )
142 222 : { m_pEventInst = pInstance; }
143 :
144 0 : bool CallEventCallback( void* pEvent, int nBytes )
145 0 : { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); }
146 :
147 : bool CallErrorCallback( void* pEvent, int nBytes )
148 : { return m_pEventInst.is() && m_pEventInst->dispatchErrorEvent( pEvent, nBytes ); }
149 :
150 : enum ConnectionIdentifierType { AsciiCString, Blob };
151 : virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0;
152 :
153 : // this is a vehicle for PrintFontManager to bridge the gap between vcl and libvclplug_*
154 : // this is only necessary because PrintFontManager is an exported vcl API and therefore
155 : // needs to be in libvcl while libvclplug_* do not contain exported C++ API
156 : virtual void FillFontPathList( std::list< OString >& o_rFontPaths );
157 :
158 : // dtrans implementation
159 : virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments );
160 : virtual css::uno::Reference< css::uno::XInterface > CreateDragSource();
161 : virtual css::uno::Reference< css::uno::XInterface > CreateDropTarget();
162 : virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) = 0;
163 :
164 0 : virtual bool hasNativeFileSelection() const { return false; }
165 :
166 0 : virtual css::uno::Reference< css::ui::dialogs::XFilePicker2 > createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& )
167 0 : { return css::uno::Reference< css::ui::dialogs::XFilePicker2 >(); }
168 :
169 2 : virtual css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker( const css::uno::Reference< css::uno::XComponentContext >& )
170 2 : { return css::uno::Reference< css::ui::dialogs::XFolderPicker2 >(); }
171 :
172 : // callbacks for printer updates
173 0 : virtual void updatePrinterUpdate() {}
174 0 : virtual void jobStartedPrinterUpdate() {}
175 0 : virtual void jobEndedPrinterUpdate() {}
176 : };
177 :
178 : // called from SVMain
179 : SalInstance* CreateSalInstance();
180 : void DestroySalInstance( SalInstance* pInst );
181 :
182 : void SalAbort( const OUString& rErrorText, bool bDumpCore );
183 :
184 : VCL_PLUGIN_PUBLIC const OUString& SalGetDesktopEnvironment();
185 :
186 : void InitSalData(); // called from Application-Ctor
187 : void DeInitSalData(); // called from Application-Dtor
188 :
189 : void InitSalMain();
190 :
191 : #endif // INCLUDED_VCL_INC_SALINST_HXX
192 :
193 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|