Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_SALINST_HXX
30 : : #define _SV_SALINST_HXX
31 : :
32 : : #include "com/sun/star/uno/Reference.hxx"
33 : : #include "com/sun/star/uno/XComponentContext.hpp"
34 : : #include "com/sun/star/ui/dialogs/XFilePicker2.hpp"
35 : : #include "com/sun/star/ui/dialogs/XFolderPicker.hpp"
36 : :
37 : : #include "tools/solar.h"
38 : : #include "vcl/displayconnectiondispatch.hxx"
39 : : #include "vcl/dllapi.h"
40 : :
41 : : #include "rtl/ref.hxx"
42 : :
43 : : #include <list>
44 : :
45 : : namespace rtl
46 : : {
47 : : class OUString;
48 : : }
49 : :
50 : : struct SystemParentData;
51 : : struct SalPrinterQueueInfo;
52 : : struct ImplJobSetup;
53 : : class SalGraphics;
54 : : class SalFrame;
55 : : class SalObject;
56 : : class SalMenu;
57 : : class SalMenuItem;
58 : : class SalVirtualDevice;
59 : : class SalInfoPrinter;
60 : : class SalPrinter;
61 : : class SalTimer;
62 : : class ImplPrnQueueList;
63 : : class SalI18NImeStatus;
64 : : class SalSystem;
65 : : class SalBitmap;
66 : : struct SalItemParams;
67 : : class SalSession;
68 : : struct SystemGraphicsData;
69 : : struct SystemWindowData;
70 : : class Menu;
71 : :
72 : : // ---------------
73 : : // - SalInstance -
74 : : // ---------------
75 : :
76 : : class VCL_PLUGIN_PUBLIC SalInstance
77 : : {
78 : : private:
79 : : rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
80 : :
81 : : public:
82 : 266 : SalInstance() {}
83 : : virtual ~SalInstance();
84 : :
85 : : // Frame
86 : : // DisplayName for Unix ???
87 : : virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) = 0;
88 : : virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ) = 0;
89 : : virtual void DestroyFrame( SalFrame* pFrame ) = 0;
90 : :
91 : : // Object (System Child Window)
92 : : virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ) = 0;
93 : : virtual void DestroyObject( SalObject* pObject ) = 0;
94 : :
95 : : // VirtualDevice
96 : : // nDX and nDY in Pixel
97 : : // nBitCount: 0 == Default(=as window) / 1 == Mono
98 : : // pData allows for using a system dependent graphics or device context
99 : : virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics,
100 : : long nDX, long nDY,
101 : : sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) = 0;
102 : : virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ) = 0;
103 : :
104 : : // Printer
105 : : // pSetupData->mpDriverData can be 0
106 : : // pSetupData must be updatet with the current
107 : : // JobSetup
108 : : virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
109 : : ImplJobSetup* pSetupData ) = 0;
110 : : virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0;
111 : : virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0;
112 : : virtual void DestroyPrinter( SalPrinter* pPrinter ) = 0;
113 : :
114 : : virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0;
115 : : virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0;
116 : : virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0;
117 : : virtual rtl::OUString GetDefaultPrinter() = 0;
118 : :
119 : : // SalTimer
120 : : virtual SalTimer* CreateSalTimer() = 0;
121 : : // SalI18NImeStatus
122 : : virtual SalI18NImeStatus* CreateI18NImeStatus() = 0;
123 : : // SalSystem
124 : : virtual SalSystem* CreateSalSystem() = 0;
125 : : // SalBitmap
126 : : virtual SalBitmap* CreateSalBitmap() = 0;
127 : :
128 : : // YieldMutex
129 : : virtual osl::SolarMutex* GetYieldMutex() = 0;
130 : : virtual sal_uLong ReleaseYieldMutex() = 0;
131 : : virtual void AcquireYieldMutex( sal_uLong nCount ) = 0;
132 : : // return true, if yield mutex is owned by this thread, else false
133 : : virtual bool CheckYieldMutex() = 0;
134 : :
135 : : // wait next event and dispatch
136 : : // must returned by UserEvent (SalFrame::PostEvent)
137 : : // and timer
138 : : virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) = 0;
139 : : virtual bool AnyInput( sal_uInt16 nType ) = 0;
140 : :
141 : : // Menues
142 : : virtual SalMenu* CreateMenu( sal_Bool bMenuBar, Menu* pMenu );
143 : : virtual void DestroyMenu( SalMenu* pMenu);
144 : : virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
145 : : virtual void DestroyMenuItem( SalMenuItem* pItem );
146 : :
147 : : // may return NULL to disable session management
148 : : virtual SalSession* CreateSalSession() = 0;
149 : :
150 : : // methods for XDisplayConnection
151 : :
152 : 175 : void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance )
153 : 175 : { m_pEventInst = pInstance; }
154 : 0 : bool CallEventCallback( void* pEvent, int nBytes )
155 : 0 : { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); }
156 : : bool CallErrorCallback( void* pEvent, int nBytes )
157 : : { return m_pEventInst.is() && m_pEventInst->dispatchErrorEvent( pEvent, nBytes ); }
158 : :
159 : : enum ConnectionIdentifierType { AsciiCString, Blob };
160 : : virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0;
161 : :
162 : : // this is a vehicle for PrintFontManager to bridge the gap between vcl and libvclplug_*
163 : : // this is only necessary because PrintFontManager is an exported vcl API and therefore
164 : : // needs to be in libvcl while libvclplug_* do not contain exported C++ API
165 : : virtual void FillFontPathList( std::list< rtl::OString >& o_rFontPaths );
166 : :
167 : : // dtrans implementation
168 : : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
169 : : CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments );
170 : : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource();
171 : : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget();
172 : : virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0;
173 : :
174 : 0 : virtual bool hasNativeFileSelection() const { return false; }
175 : :
176 : : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
177 : 0 : createFilePicker( const com::sun::star::uno::Reference<
178 : : com::sun::star::uno::XComponentContext >& )
179 : 0 : { return com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >(); }
180 : : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker >
181 : 0 : createFolderPicker( const com::sun::star::uno::Reference<
182 : : com::sun::star::uno::XComponentContext >& )
183 : 0 : { return com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker >(); }
184 : :
185 : : // callbacks for printer updates
186 : 0 : virtual void updatePrinterUpdate() {}
187 : 0 : virtual void jobStartedPrinterUpdate() {}
188 : 0 : virtual void jobEndedPrinterUpdate() {}
189 : : };
190 : :
191 : : // called from SVMain
192 : : SalInstance* CreateSalInstance();
193 : : void DestroySalInstance( SalInstance* pInst );
194 : :
195 : : // -------------------------
196 : : // - SalInstance-Functions -
197 : : // -------------------------
198 : :
199 : : void SalAbort( const rtl::OUString& rErrorText, bool bDumpCore );
200 : :
201 : : VCL_PLUGIN_PUBLIC const ::rtl::OUString& SalGetDesktopEnvironment();
202 : :
203 : : // -----------
204 : : // - SalData -
205 : : // -----------
206 : :
207 : : void InitSalData(); // called from Application-Ctor
208 : : void DeInitSalData(); // called from Application-Dtor
209 : :
210 : : void InitSalMain();
211 : : void DeInitSalMain();
212 : :
213 : : // ----------
214 : : // - SVMain -
215 : : // ----------
216 : :
217 : : // Callbacks (indepen in \sv\source\app\svmain.cxx)
218 : : VCL_DLLPUBLIC int SVMain();
219 : :
220 : : #endif // _SV_SALINST_HXX
221 : :
222 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|