Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / vcl / inc / salinst.hxx
blobca8017d94513b4120177904f0c48a5729d828d08
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_SALINST_HXX
21 #define INCLUDED_VCL_INC_SALINST_HXX
23 #include <sal/types.h>
24 #include <rtl/ref.hxx>
25 #include <tools/solar.h>
26 #include <vcl/dllapi.h>
27 #include <vcl/salgtype.hxx>
29 #include "displayconnectiondispatch.hxx"
31 #include <com/sun/star/uno/XComponentContext.hpp>
32 #include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
33 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
35 namespace comphelper { class SolarMutex; }
36 struct SystemParentData;
37 struct SalPrinterQueueInfo;
38 class ImplJobSetup;
39 class OpenGLContext;
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 enum class VclInputFlags;
59 enum class SalFrameStyleFlags;
61 enum SalYieldResult { EVENT, TIMEOUT };
63 typedef struct _cairo_font_options cairo_font_options_t;
65 class VCL_PLUGIN_PUBLIC SalInstance
67 private:
68 rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
70 public:
71 SalInstance() {}
72 virtual ~SalInstance();
74 //called directly after Application::Init
75 virtual void AfterAppInit() {}
77 // Frame
78 // DisplayName for Unix ???
79 virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) = 0;
80 virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) = 0;
81 virtual void DestroyFrame( SalFrame* pFrame ) = 0;
83 // Object (System Child Window)
84 virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) = 0;
85 virtual void DestroyObject( SalObject* pObject ) = 0;
87 // VirtualDevice
88 // nDX and nDY in pixels
89 // nBitCount: 0 == default(=as window) / 1 == mono
90 // pData allows for using a system dependent graphics or device context,
91 // if a system context is passed in nDX and nDY are updated to reflect
92 // its size; otherwise these remain unchanged.
93 virtual SalVirtualDevice*
94 CreateVirtualDevice( SalGraphics* pGraphics,
95 long &rDX, long &rDY,
96 DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) = 0;
98 // Printer
99 // pSetupData->mpDriverData can be 0
100 // pSetupData must be updated with the current
101 // JobSetup
102 virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
103 ImplJobSetup* pSetupData ) = 0;
104 virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0;
105 virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0;
106 virtual void DestroyPrinter( SalPrinter* pPrinter ) = 0;
108 virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0;
109 virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0;
110 virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0;
111 virtual OUString GetDefaultPrinter() = 0;
113 // SalTimer
114 virtual SalTimer* CreateSalTimer() = 0;
115 // SalI18NImeStatus
116 virtual SalI18NImeStatus*
117 CreateI18NImeStatus();
118 // SalSystem
119 virtual SalSystem* CreateSalSystem() = 0;
120 // SalBitmap
121 virtual SalBitmap* CreateSalBitmap() = 0;
123 // YieldMutex
124 virtual comphelper::SolarMutex*
125 GetYieldMutex() = 0;
126 virtual sal_uLong ReleaseYieldMutex() = 0;
127 virtual void AcquireYieldMutex( sal_uLong nCount ) = 0;
128 // return true, if yield mutex is owned by this thread, else false
129 virtual bool CheckYieldMutex() = 0;
132 * Wait for the next event (if bWait) and dispatch it,
133 * includes posted events, and timers.
134 * If bHandleAllCurrentEvents - dispatch multiple posted
135 * user events. Returns true if events needed processing.
137 virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) = 0;
138 virtual bool AnyInput( VclInputFlags nType ) = 0;
140 // menus
141 virtual SalMenu* CreateMenu( bool bMenuBar, Menu* pMenu );
142 virtual void DestroyMenu( SalMenu* pMenu);
143 virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
144 virtual void DestroyMenuItem( SalMenuItem* pItem );
146 // may return NULL to disable session management
147 virtual SalSession* CreateSalSession() = 0;
149 virtual OpenGLContext* CreateOpenGLContext() = 0;
151 // methods for XDisplayConnection
153 void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance )
154 { m_pEventInst = pInstance; }
156 bool CallEventCallback( void* pEvent, int nBytes );
158 virtual OUString GetConnectionIdentifier() = 0;
160 // dtrans implementation
161 virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments );
162 virtual css::uno::Reference< css::uno::XInterface > CreateDragSource();
163 virtual css::uno::Reference< css::uno::XInterface > CreateDropTarget();
164 virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) = 0;
166 virtual bool hasNativeFileSelection() const { return false; }
168 virtual css::uno::Reference< css::ui::dialogs::XFilePicker2 > createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& )
169 { return css::uno::Reference< css::ui::dialogs::XFilePicker2 >(); }
171 virtual css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker( const css::uno::Reference< css::uno::XComponentContext >& )
172 { return css::uno::Reference< css::ui::dialogs::XFolderPicker2 >(); }
174 // callbacks for printer updates
175 virtual void updatePrinterUpdate() {}
176 virtual void jobStartedPrinterUpdate() {}
177 virtual void jobEndedPrinterUpdate() {}
179 /// get information about underlying versions
180 virtual OUString getOSVersion() { return OUString("-"); }
182 virtual const cairo_font_options_t* GetCairoFontOptions() { return nullptr; }
185 // called from SVMain
186 SalInstance* CreateSalInstance();
187 void DestroySalInstance( SalInstance* pInst );
189 void SalAbort( const OUString& rErrorText, bool bDumpCore );
191 VCL_PLUGIN_PUBLIC const OUString& SalGetDesktopEnvironment();
193 void InitSalData(); // called from Application-Ctor
194 void DeInitSalData(); // called from Application-Dtor
196 void InitSalMain();
198 #endif // INCLUDED_VCL_INC_SALINST_HXX
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */