xref: /aoo42x/main/vcl/inc/salinst.hxx (revision dd7ece3a)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_SALINST_HXX
25 #define _SV_SALINST_HXX
26 
27 #include "com/sun/star/uno/Reference.hxx"
28 
29 #include "vcl/sv.h"
30 #include "vcl/displayconnectiondispatch.hxx"
31 #include "vcl/dllapi.h"
32 
33 #include "tools/string.hxx"
34 
35 #include "rtl/ref.hxx"
36 #include "rtl/string.hxx"
37 
38 #include <list>
39 
40 struct SystemParentData;
41 struct SalPrinterQueueInfo;
42 struct SalStatus;
43 struct ImplJobSetup;
44 class SalGraphics;
45 class SalFrame;
46 class SalObject;
47 class SalMenu;
48 class SalMenuItem;
49 class SalVirtualDevice;
50 class SalInfoPrinter;
51 class SalPrinter;
52 class SalTimer;
53 class ImplPrnQueueList;
54 class SalI18NImeStatus;
55 class SalSystem;
56 class SalBitmap;
57 struct SalItemParams;
58 class SalSession;
59 struct SystemGraphicsData;
60 struct SystemWindowData;
61 class Menu;
62 
63 namespace vos { class IMutex; }
64 
65 // ---------------
66 // - SalInstance -
67 // ---------------
68 
69 class VCL_PLUGIN_PUBLIC SalInstance
70 {
71 private:
72     rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
73 
74 public:
SalInstance()75     SalInstance() {}
76     virtual ~SalInstance();
77 
78     // Frame
79     // DisplayName for Unix ???
80     virtual SalFrame*      	CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) = 0;
81     virtual SalFrame*      	CreateFrame( SalFrame* pParent, sal_uLong nStyle ) = 0;
82     virtual void				DestroyFrame( SalFrame* pFrame ) = 0;
83 
84     // Object (System Child Window)
85     virtual SalObject*			CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ) = 0;
86     virtual void				DestroyObject( SalObject* pObject ) = 0;
87 
88     // VirtualDevice
89     // nDX and nDY in Pixel
90     // nBitCount: 0 == Default(=as window) / 1 == Mono
91     // pData allows for using a system dependent graphics or device context
92     virtual SalVirtualDevice*	CreateVirtualDevice( SalGraphics* pGraphics,
93                                                      long nDX, long nDY,
94                                                      sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) = 0;
95     virtual void				DestroyVirtualDevice( SalVirtualDevice* pDevice ) = 0;
96 
97     // Printer
98     // pSetupData->mpDriverData can be 0
99     // pSetupData must be updated with the current
100     // JobSetup
101     virtual SalInfoPrinter*	CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
102                                                ImplJobSetup* pSetupData ) = 0;
103     virtual void				DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0;
104     virtual SalPrinter*		CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0;
105     virtual void				DestroyPrinter( SalPrinter* pPrinter ) = 0;
106 
107     virtual void				GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0;
108     virtual void				GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0;
109     virtual void				DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0;
110     virtual String             GetDefaultPrinter() = 0;
111 
112     // SalTimer
113     virtual SalTimer*			CreateSalTimer() = 0;
114     // SalI18NImeStatus
115     virtual SalI18NImeStatus*	CreateI18NImeStatus() = 0;
116     // SalSystem
117     virtual SalSystem*			CreateSalSystem() = 0;
118     // SalBitmap
119     virtual SalBitmap*			CreateSalBitmap() = 0;
120 
121     // YieldMutex
122     virtual vos::IMutex*		GetYieldMutex() = 0;
123     virtual sal_uLong				ReleaseYieldMutex() = 0;
124     virtual void				AcquireYieldMutex( sal_uLong nCount ) = 0;
125     // return true, if yield mutex is owned by this thread, else false
126     virtual bool                CheckYieldMutex() = 0;
127 
128 	// wait next event and dispatch
129     // must returned by UserEvent (SalFrame::PostEvent)
130     // and timer
131     virtual void				Yield( bool bWait, bool bHandleAllCurrentEvents ) = 0;
132     virtual bool				AnyInput( sal_uInt16 nType ) = 0;
133 
134                             // Menus
135     virtual SalMenu*        CreateMenu( sal_Bool bMenuBar, Menu* pMenu );
136     virtual void            DestroyMenu( SalMenu* pMenu);
137     virtual SalMenuItem*    CreateMenuItem( const SalItemParams* pItemData );
138     virtual void            DestroyMenuItem( SalMenuItem* pItem );
139 
140     // may return NULL to disable session management
141     virtual SalSession*		CreateSalSession() = 0;
142 
143     // methods for XDisplayConnection
144 
SetEventCallback(rtl::Reference<vcl::DisplayConnectionDispatch> const & pInstance)145     void				SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance )
146     { m_pEventInst = pInstance; }
CallEventCallback(void * pEvent,int nBytes)147     bool				CallEventCallback( void* pEvent, int nBytes )
148     { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); }
CallErrorCallback(void * pEvent,int nBytes)149     bool				CallErrorCallback( void* pEvent, int nBytes )
150     { return m_pEventInst.is() && m_pEventInst->dispatchErrorEvent( pEvent, nBytes ); }
151 
152     enum ConnectionIdentifierType { AsciiCString, Blob };
153     virtual void*				GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0;
154 
155     // this is a vehicle for PrintFontManager to bridge the gap between vcl and libvclplug_*
156     // this is only necessary because PrintFontManager is an exported vcl API and therefore
157     // needs to be in libvcl while libvclplug_* do not contain exported C++ API
158     virtual void        FillFontPathList( std::list< rtl::OString >& o_rFontPaths );
159 
160     // dtrans implementation
161     virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
162         CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments );
163     virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource();
164     virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget();
165     virtual void        AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0;
166 };
167 
168 // called from SVMain
169 SalInstance* CreateSalInstance();
170 void DestroySalInstance( SalInstance* pInst );
171 
172 // -------------------------
173 // - SalInstance-Functions -
174 // -------------------------
175 
176 void SalAbort( const XubString& rErrorText );
177 
178 VCL_PLUGIN_PUBLIC const ::rtl::OUString& SalGetDesktopEnvironment();
179 
180 // -----------
181 // - SalData -
182 // -----------
183 
184 void InitSalData();                         // called from Application-Ctor
185 void DeInitSalData();                       // called from Application-Dtor
186 
187 void InitSalMain();
188 void DeInitSalMain();
189 
190 // ----------
191 // - SVMain -
192 // ----------
193 
194 // Callbacks (indepen in \sv\source\app\svmain.cxx)
195 VCL_DLLPUBLIC sal_Bool SVMain();
196 
197 #endif // _SV_SALINST_HXX
198