Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / vcl / inc / salinst.hxx
blob6fcb1e24573276e0561bec6333fc2a32c18b887b
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 _SV_SALINST_HXX
21 #define _SV_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 "vcl/displayconnectiondispatch.hxx"
30 #include "vcl/dllapi.h"
32 #include "rtl/ref.hxx"
34 #include <list>
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;
59 class VCL_PLUGIN_PUBLIC SalInstance
61 private:
62 rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst;
64 public:
65 SalInstance() {}
66 virtual ~SalInstance();
68 //called directly after Application::Init
69 virtual void AfterAppInit() {}
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;
77 // Object (System Child Window)
78 virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ) = 0;
79 virtual void DestroyObject( SalObject* pObject ) = 0;
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 virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ) = 0;
91 // Printer
92 // pSetupData->mpDriverData can be 0
93 // pSetupData must be updatet with the current
94 // JobSetup
95 virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
96 ImplJobSetup* pSetupData ) = 0;
97 virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0;
98 virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0;
99 virtual void DestroyPrinter( SalPrinter* pPrinter ) = 0;
101 virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0;
102 virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0;
103 virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0;
104 virtual OUString GetDefaultPrinter() = 0;
106 // SalTimer
107 virtual SalTimer* CreateSalTimer() = 0;
108 // SalI18NImeStatus
109 virtual SalI18NImeStatus*
110 CreateI18NImeStatus() = 0;
111 // SalSystem
112 virtual SalSystem* CreateSalSystem() = 0;
113 // SalBitmap
114 virtual SalBitmap* CreateSalBitmap() = 0;
116 // YieldMutex
117 virtual comphelper::SolarMutex*
118 GetYieldMutex() = 0;
119 virtual sal_uLong ReleaseYieldMutex() = 0;
120 virtual void AcquireYieldMutex( sal_uLong nCount ) = 0;
121 // return true, if yield mutex is owned by this thread, else false
122 virtual bool CheckYieldMutex() = 0;
124 // wait next event and dispatch
125 // must returned by UserEvent (SalFrame::PostEvent)
126 // and timer
127 virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) = 0;
128 virtual bool AnyInput( sal_uInt16 nType ) = 0;
130 // menus
131 virtual SalMenu* CreateMenu( sal_Bool bMenuBar, Menu* pMenu );
132 virtual void DestroyMenu( SalMenu* pMenu);
133 virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
134 virtual void DestroyMenuItem( SalMenuItem* pItem );
136 // may return NULL to disable session management
137 virtual SalSession* CreateSalSession() = 0;
139 // methods for XDisplayConnection
141 void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance )
142 { m_pEventInst = pInstance; }
144 bool CallEventCallback( void* pEvent, int nBytes )
145 { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); }
147 bool CallErrorCallback( void* pEvent, int nBytes )
148 { return m_pEventInst.is() && m_pEventInst->dispatchErrorEvent( pEvent, nBytes ); }
150 enum ConnectionIdentifierType { AsciiCString, Blob };
151 virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0;
153 // this is a vehicle for PrintFontManager to bridge the gap between vcl and libvclplug_*
154 // this is only necessary because PrintFontManager is an exported vcl API and therefore
155 // needs to be in libvcl while libvclplug_* do not contain exported C++ API
156 virtual void FillFontPathList( std::list< OString >& o_rFontPaths );
158 // dtrans implementation
159 virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
160 CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments );
161 virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
162 CreateDragSource();
163 virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
164 CreateDropTarget();
165 virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) = 0;
167 virtual bool hasNativeFileSelection() const { return false; }
169 virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
170 createFilePicker( const com::sun::star::uno::Reference<
171 com::sun::star::uno::XComponentContext >& )
172 { return com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >(); }
174 virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker2 >
175 createFolderPicker( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& )
176 { return com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker2 >(); }
178 // callbacks for printer updates
179 virtual void updatePrinterUpdate() {}
180 virtual void jobStartedPrinterUpdate() {}
181 virtual void jobEndedPrinterUpdate() {}
184 // called from SVMain
185 SalInstance* CreateSalInstance();
186 void DestroySalInstance( SalInstance* pInst );
188 void SalAbort( const OUString& rErrorText, bool bDumpCore );
190 VCL_PLUGIN_PUBLIC const OUString& SalGetDesktopEnvironment();
192 void InitSalData(); // called from Application-Ctor
193 void DeInitSalData(); // called from Application-Dtor
195 void InitSalMain();
197 VCL_DLLPUBLIC int SVMain();
199 #endif // _SV_SALINST_HXX
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */