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 comphelper { class SolarMutex; }
37 : struct SystemParentData;
38 : struct SalPrinterQueueInfo;
39 : struct ImplJobSetup;
40 : class SalGraphics;
41 : class SalFrame;
42 : class SalObject;
43 : class SalMenu;
44 : class SalMenuItem;
45 : class SalVirtualDevice;
46 : class SalInfoPrinter;
47 : class SalPrinter;
48 : class SalTimer;
49 : class ImplPrnQueueList;
50 : class SalI18NImeStatus;
51 : class SalSystem;
52 : class SalBitmap;
53 : struct SalItemParams;
54 : class SalSession;
55 : struct SystemGraphicsData;
56 : struct SystemWindowData;
57 : class Menu;
58 :
59 : class VCL_PLUGIN_PUBLIC SalInstance
60 : {
61 : private:
62 : rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
63 :
64 : public:
65 151 : SalInstance() {}
66 : virtual ~SalInstance();
67 :
68 : // Frame
69 : // DisplayName for Unix ???
70 : virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) = 0;
71 : virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ) = 0;
72 : virtual void DestroyFrame( SalFrame* pFrame ) = 0;
73 :
74 : // Object (System Child Window)
75 : virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ) = 0;
76 : virtual void DestroyObject( SalObject* pObject ) = 0;
77 :
78 : // VirtualDevice
79 : // nDX and nDY in pixels
80 : // nBitCount: 0 == default(=as window) / 1 == mono
81 : // pData allows for using a system dependent graphics or device context
82 : virtual SalVirtualDevice*
83 : CreateVirtualDevice( SalGraphics* pGraphics,
84 : long nDX, long nDY,
85 : sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) = 0;
86 : virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ) = 0;
87 :
88 : // Printer
89 : // pSetupData->mpDriverData can be 0
90 : // pSetupData must be updatet with the current
91 : // JobSetup
92 : virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
93 : ImplJobSetup* pSetupData ) = 0;
94 : virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0;
95 : virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0;
96 : virtual void DestroyPrinter( SalPrinter* pPrinter ) = 0;
97 :
98 : virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0;
99 : virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0;
100 : virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0;
101 : virtual OUString GetDefaultPrinter() = 0;
102 :
103 : // SalTimer
104 : virtual SalTimer* CreateSalTimer() = 0;
105 : // SalI18NImeStatus
106 : virtual SalI18NImeStatus*
107 : CreateI18NImeStatus() = 0;
108 : // SalSystem
109 : virtual SalSystem* CreateSalSystem() = 0;
110 : // SalBitmap
111 : virtual SalBitmap* CreateSalBitmap() = 0;
112 :
113 : // YieldMutex
114 : virtual comphelper::SolarMutex*
115 : GetYieldMutex() = 0;
116 : virtual sal_uLong ReleaseYieldMutex() = 0;
117 : virtual void AcquireYieldMutex( sal_uLong nCount ) = 0;
118 : // return true, if yield mutex is owned by this thread, else false
119 : virtual bool CheckYieldMutex() = 0;
120 :
121 : // wait next event and dispatch
122 : // must returned by UserEvent (SalFrame::PostEvent)
123 : // and timer
124 : virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) = 0;
125 : virtual bool AnyInput( sal_uInt16 nType ) = 0;
126 :
127 : // menus
128 : virtual SalMenu* CreateMenu( sal_Bool bMenuBar, Menu* pMenu );
129 : virtual void DestroyMenu( SalMenu* pMenu);
130 : virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
131 : virtual void DestroyMenuItem( SalMenuItem* pItem );
132 :
133 : // may return NULL to disable session management
134 : virtual SalSession* CreateSalSession() = 0;
135 :
136 : // methods for XDisplayConnection
137 :
138 93 : void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance )
139 93 : { m_pEventInst = pInstance; }
140 :
141 0 : bool CallEventCallback( void* pEvent, int nBytes )
142 0 : { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); }
143 :
144 : bool CallErrorCallback( void* pEvent, int nBytes )
145 : { return m_pEventInst.is() && m_pEventInst->dispatchErrorEvent( pEvent, nBytes ); }
146 :
147 : enum ConnectionIdentifierType { AsciiCString, Blob };
148 : virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0;
149 :
150 : // this is a vehicle for PrintFontManager to bridge the gap between vcl and libvclplug_*
151 : // this is only necessary because PrintFontManager is an exported vcl API and therefore
152 : // needs to be in libvcl while libvclplug_* do not contain exported C++ API
153 : virtual void FillFontPathList( std::list< OString >& o_rFontPaths );
154 :
155 : // dtrans implementation
156 : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
157 : CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments );
158 : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
159 : CreateDragSource();
160 : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
161 : CreateDropTarget();
162 : virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType) = 0;
163 :
164 0 : virtual bool hasNativeFileSelection() const { return false; }
165 :
166 : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
167 0 : createFilePicker( const com::sun::star::uno::Reference<
168 : com::sun::star::uno::XComponentContext >& )
169 0 : { return com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >(); }
170 :
171 : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker2 >
172 0 : createFolderPicker( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& )
173 0 : { return com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker2 >(); }
174 :
175 : // callbacks for printer updates
176 0 : virtual void updatePrinterUpdate() {}
177 0 : virtual void jobStartedPrinterUpdate() {}
178 0 : virtual void jobEndedPrinterUpdate() {}
179 : };
180 :
181 : // called from SVMain
182 : SalInstance* CreateSalInstance();
183 : void DestroySalInstance( SalInstance* pInst );
184 :
185 : void SalAbort( const OUString& rErrorText, bool bDumpCore );
186 :
187 : VCL_PLUGIN_PUBLIC const OUString& SalGetDesktopEnvironment();
188 :
189 : void InitSalData(); // called from Application-Ctor
190 : void DeInitSalData(); // called from Application-Dtor
191 :
192 : void InitSalMain();
193 :
194 : VCL_DLLPUBLIC int SVMain();
195 :
196 : #endif // _SV_SALINST_HXX
197 :
198 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|