1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "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"
28 #include "tools/solar.h"
29 #include "displayconnectiondispatch.hxx"
30 #include "vcl/dllapi.h"
31 #include <sal/types.h>
33 #include "rtl/ref.hxx"
37 namespace comphelper
{ class SolarMutex
; }
38 struct SystemParentData
;
39 struct SalPrinterQueueInfo
;
46 class SalVirtualDevice
;
50 class ImplPrnQueueList
;
51 class SalI18NImeStatus
;
56 struct SystemGraphicsData
;
57 struct SystemWindowData
;
59 enum class VclInputFlags
;
61 class VCL_PLUGIN_PUBLIC SalInstance
64 rtl::Reference
< vcl::DisplayConnectionDispatch
> m_pEventInst
;
68 virtual ~SalInstance();
70 //called directly after Application::Init
71 virtual void AfterAppInit() {}
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;
79 // Object (System Child Window)
80 virtual SalObject
* CreateObject( SalFrame
* pParent
, SystemWindowData
* pWindowData
, bool bShow
= true ) = 0;
81 virtual void DestroyObject( SalObject
* pObject
) = 0;
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
,
92 sal_uInt16 nBitCount
, const SystemGraphicsData
*pData
= NULL
) = 0;
95 // pSetupData->mpDriverData can be 0
96 // pSetupData must be updatet with the current
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;
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;
110 virtual SalTimer
* CreateSalTimer() = 0;
112 virtual SalI18NImeStatus
*
113 CreateI18NImeStatus() = 0;
115 virtual SalSystem
* CreateSalSystem() = 0;
117 virtual SalBitmap
* CreateSalBitmap() = 0;
120 virtual comphelper::SolarMutex
*
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;
127 // wait next event and dispatch
128 // must returned by UserEvent (SalFrame::PostEvent)
130 virtual void Yield( bool bWait
, bool bHandleAllCurrentEvents
) = 0;
131 virtual bool AnyInput( VclInputFlags nType
) = 0;
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
);
139 // may return NULL to disable session management
140 virtual SalSession
* CreateSalSession() = 0;
142 // methods for XDisplayConnection
144 void SetEventCallback( rtl::Reference
< vcl::DisplayConnectionDispatch
> const & pInstance
)
145 { m_pEventInst
= pInstance
; }
147 bool CallEventCallback( void* pEvent
, int nBytes
)
148 { return m_pEventInst
.is() && m_pEventInst
->dispatchEvent( pEvent
, nBytes
); }
150 bool CallErrorCallback( void* pEvent
, int nBytes
)
151 { return m_pEventInst
.is() && m_pEventInst
->dispatchErrorEvent( pEvent
, nBytes
); }
153 enum ConnectionIdentifierType
{ AsciiCString
, Blob
};
154 virtual void* GetConnectionIdentifier( ConnectionIdentifierType
& rReturnedType
, int& rReturnedBytes
) = 0;
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
);
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;
167 virtual bool hasNativeFileSelection() const { return false; }
169 virtual css::uno::Reference
< css::ui::dialogs::XFilePicker2
> createFilePicker( const css::uno::Reference
< css::uno::XComponentContext
>& )
170 { return css::uno::Reference
< css::ui::dialogs::XFilePicker2
>(); }
172 virtual css::uno::Reference
< css::ui::dialogs::XFolderPicker2
> createFolderPicker( const css::uno::Reference
< css::uno::XComponentContext
>& )
173 { return css::uno::Reference
< css::ui::dialogs::XFolderPicker2
>(); }
175 // callbacks for printer updates
176 virtual void updatePrinterUpdate() {}
177 virtual void jobStartedPrinterUpdate() {}
178 virtual void jobEndedPrinterUpdate() {}
181 // called from SVMain
182 SalInstance
* CreateSalInstance();
183 void DestroySalInstance( SalInstance
* pInst
);
185 void SalAbort( const OUString
& rErrorText
, bool bDumpCore
);
187 VCL_PLUGIN_PUBLIC
const OUString
& SalGetDesktopEnvironment();
189 void InitSalData(); // called from Application-Ctor
190 void DeInitSalData(); // called from Application-Dtor
194 #endif // INCLUDED_VCL_INC_SALINST_HXX
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */