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 _SV_SALINST_HXX
21 : #define _SV_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 "vcl/displayconnectiondispatch.hxx"
30 : #include "vcl/dllapi.h"
31 :
32 : #include "rtl/ref.hxx"
33 :
34 : #include <list>
35 :
36 : namespace rtl
37 : {
38 : class OUString;
39 : }
40 :
41 : struct SystemParentData;
42 : struct SalPrinterQueueInfo;
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 : // ---------------
64 : // - SalInstance -
65 : // ---------------
66 :
67 : class VCL_PLUGIN_PUBLIC SalInstance
68 : {
69 : private:
70 : rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
71 :
72 : public:
73 32 : SalInstance() {}
74 : virtual ~SalInstance();
75 :
76 : // Frame
77 : // DisplayName for Unix ???
78 : virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) = 0;
79 : virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ) = 0;
80 : virtual void DestroyFrame( SalFrame* pFrame ) = 0;
81 :
82 : // Object (System Child Window)
83 : virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ) = 0;
84 : virtual void DestroyObject( SalObject* pObject ) = 0;
85 :
86 : // VirtualDevice
87 : // nDX and nDY in Pixel
88 : // nBitCount: 0 == Default(=as window) / 1 == Mono
89 : // pData allows for using a system dependent graphics or device context
90 : virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics,
91 : long nDX, long nDY,
92 : sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) = 0;
93 : virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ) = 0;
94 :
95 : // Printer
96 : // pSetupData->mpDriverData can be 0
97 : // pSetupData must be updatet with the current
98 : // JobSetup
99 : virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
100 : ImplJobSetup* pSetupData ) = 0;
101 : virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0;
102 : virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0;
103 : virtual void DestroyPrinter( SalPrinter* pPrinter ) = 0;
104 :
105 : virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0;
106 : virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0;
107 : virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0;
108 : virtual rtl::OUString GetDefaultPrinter() = 0;
109 :
110 : // SalTimer
111 : virtual SalTimer* CreateSalTimer() = 0;
112 : // SalI18NImeStatus
113 : virtual SalI18NImeStatus* CreateI18NImeStatus() = 0;
114 : // SalSystem
115 : virtual SalSystem* CreateSalSystem() = 0;
116 : // SalBitmap
117 : virtual SalBitmap* CreateSalBitmap() = 0;
118 :
119 : // YieldMutex
120 : virtual osl::SolarMutex* GetYieldMutex() = 0;
121 : virtual sal_uLong ReleaseYieldMutex() = 0;
122 : virtual void AcquireYieldMutex( sal_uLong nCount ) = 0;
123 : // return true, if yield mutex is owned by this thread, else false
124 : virtual bool CheckYieldMutex() = 0;
125 :
126 : // wait next event and dispatch
127 : // must returned by UserEvent (SalFrame::PostEvent)
128 : // and timer
129 : virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) = 0;
130 : virtual bool AnyInput( sal_uInt16 nType ) = 0;
131 :
132 : // Menues
133 : virtual SalMenu* CreateMenu( sal_Bool bMenuBar, Menu* pMenu );
134 : virtual void DestroyMenu( SalMenu* pMenu);
135 : virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
136 : virtual void DestroyMenuItem( SalMenuItem* pItem );
137 :
138 : // may return NULL to disable session management
139 : virtual SalSession* CreateSalSession() = 0;
140 :
141 : // methods for XDisplayConnection
142 :
143 9 : void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance )
144 9 : { m_pEventInst = pInstance; }
145 0 : bool CallEventCallback( void* pEvent, int nBytes )
146 0 : { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); }
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< rtl::OString >& o_rFontPaths );
157 :
158 : // dtrans implementation
159 : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
160 : CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments );
161 : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource();
162 : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget();
163 : virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0;
164 :
165 0 : virtual bool hasNativeFileSelection() const { return false; }
166 :
167 : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
168 0 : createFilePicker( const com::sun::star::uno::Reference<
169 : com::sun::star::uno::XComponentContext >& )
170 0 : { return com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >(); }
171 : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker2 >
172 0 : createFolderPicker( const com::sun::star::uno::Reference<
173 : com::sun::star::uno::XComponentContext >& )
174 0 : { return com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker2 >(); }
175 :
176 : // callbacks for printer updates
177 0 : virtual void updatePrinterUpdate() {}
178 0 : virtual void jobStartedPrinterUpdate() {}
179 0 : virtual void jobEndedPrinterUpdate() {}
180 : };
181 :
182 : // called from SVMain
183 : SalInstance* CreateSalInstance();
184 : void DestroySalInstance( SalInstance* pInst );
185 :
186 : // -------------------------
187 : // - SalInstance-Functions -
188 : // -------------------------
189 :
190 : void SalAbort( const rtl::OUString& rErrorText, bool bDumpCore );
191 :
192 : VCL_PLUGIN_PUBLIC const ::rtl::OUString& SalGetDesktopEnvironment();
193 :
194 : // -----------
195 : // - SalData -
196 : // -----------
197 :
198 : void InitSalData(); // called from Application-Ctor
199 : void DeInitSalData(); // called from Application-Dtor
200 :
201 : void InitSalMain();
202 : void DeInitSalMain();
203 :
204 : // ----------
205 : // - SVMain -
206 : // ----------
207 :
208 : // Callbacks (indepen in \sv\source\app\svmain.cxx)
209 : VCL_DLLPUBLIC int SVMain();
210 :
211 : #endif // _SV_SALINST_HXX
212 :
213 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|