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