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