1*161f4cd1SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*161f4cd1SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*161f4cd1SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*161f4cd1SAndrew Rist * distributed with this work for additional information 6*161f4cd1SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*161f4cd1SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*161f4cd1SAndrew Rist * "License"); you may not use this file except in compliance 9*161f4cd1SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*161f4cd1SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*161f4cd1SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*161f4cd1SAndrew Rist * software distributed under the License is distributed on an 15*161f4cd1SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*161f4cd1SAndrew Rist * KIND, either express or implied. See the License for the 17*161f4cd1SAndrew Rist * specific language governing permissions and limitations 18*161f4cd1SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*161f4cd1SAndrew Rist *************************************************************/ 21*161f4cd1SAndrew Rist 22*161f4cd1SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SV_SALINST_HXX 25cdf0e10cSrcweir #define _SV_SALINST_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "vcl/sv.h" 30cdf0e10cSrcweir #include "vcl/displayconnectiondispatch.hxx" 31cdf0e10cSrcweir #include "vcl/dllapi.h" 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include "tools/string.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include "rtl/ref.hxx" 36cdf0e10cSrcweir #include "rtl/string.hxx" 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <list> 39cdf0e10cSrcweir 40cdf0e10cSrcweir struct SystemParentData; 41cdf0e10cSrcweir struct SalPrinterQueueInfo; 42cdf0e10cSrcweir struct SalStatus; 43cdf0e10cSrcweir struct ImplJobSetup; 44cdf0e10cSrcweir class SalGraphics; 45cdf0e10cSrcweir class SalFrame; 46cdf0e10cSrcweir class SalObject; 47cdf0e10cSrcweir class SalMenu; 48cdf0e10cSrcweir class SalMenuItem; 49cdf0e10cSrcweir class SalVirtualDevice; 50cdf0e10cSrcweir class SalInfoPrinter; 51cdf0e10cSrcweir class SalPrinter; 52cdf0e10cSrcweir class SalTimer; 53cdf0e10cSrcweir class ImplPrnQueueList; 54cdf0e10cSrcweir class SalI18NImeStatus; 55cdf0e10cSrcweir class SalSystem; 56cdf0e10cSrcweir class SalBitmap; 57cdf0e10cSrcweir struct SalItemParams; 58cdf0e10cSrcweir class SalSession; 59cdf0e10cSrcweir struct SystemGraphicsData; 60cdf0e10cSrcweir struct SystemWindowData; 61cdf0e10cSrcweir class Menu; 62cdf0e10cSrcweir 63cdf0e10cSrcweir namespace vos { class IMutex; } 64cdf0e10cSrcweir 65cdf0e10cSrcweir // --------------- 66cdf0e10cSrcweir // - SalInstance - 67cdf0e10cSrcweir // --------------- 68cdf0e10cSrcweir 69cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC SalInstance 70cdf0e10cSrcweir { 71cdf0e10cSrcweir private: 72cdf0e10cSrcweir rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst; 73cdf0e10cSrcweir 74cdf0e10cSrcweir public: SalInstance()75cdf0e10cSrcweir SalInstance() {} 76cdf0e10cSrcweir virtual ~SalInstance(); 77cdf0e10cSrcweir 78cdf0e10cSrcweir // Frame 79cdf0e10cSrcweir // DisplayName for Unix ??? 80cdf0e10cSrcweir virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) = 0; 81cdf0e10cSrcweir virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ) = 0; 82cdf0e10cSrcweir virtual void DestroyFrame( SalFrame* pFrame ) = 0; 83cdf0e10cSrcweir 84cdf0e10cSrcweir // Object (System Child Window) 85cdf0e10cSrcweir virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True ) = 0; 86cdf0e10cSrcweir virtual void DestroyObject( SalObject* pObject ) = 0; 87cdf0e10cSrcweir 88cdf0e10cSrcweir // VirtualDevice 89cdf0e10cSrcweir // nDX and nDY in Pixel 90cdf0e10cSrcweir // nBitCount: 0 == Default(=as window) / 1 == Mono 91cdf0e10cSrcweir // pData allows for using a system dependent graphics or device context 92cdf0e10cSrcweir virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, 93cdf0e10cSrcweir long nDX, long nDY, 94cdf0e10cSrcweir sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) = 0; 95cdf0e10cSrcweir virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice ) = 0; 96cdf0e10cSrcweir 97cdf0e10cSrcweir // Printer 98cdf0e10cSrcweir // pSetupData->mpDriverData can be 0 99cdf0e10cSrcweir // pSetupData must be updatet with the current 100cdf0e10cSrcweir // JobSetup 101cdf0e10cSrcweir virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, 102cdf0e10cSrcweir ImplJobSetup* pSetupData ) = 0; 103cdf0e10cSrcweir virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) = 0; 104cdf0e10cSrcweir virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) = 0; 105cdf0e10cSrcweir virtual void DestroyPrinter( SalPrinter* pPrinter ) = 0; 106cdf0e10cSrcweir 107cdf0e10cSrcweir virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) = 0; 108cdf0e10cSrcweir virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) = 0; 109cdf0e10cSrcweir virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) = 0; 110cdf0e10cSrcweir virtual String GetDefaultPrinter() = 0; 111cdf0e10cSrcweir 112cdf0e10cSrcweir // SalTimer 113cdf0e10cSrcweir virtual SalTimer* CreateSalTimer() = 0; 114cdf0e10cSrcweir // SalI18NImeStatus 115cdf0e10cSrcweir virtual SalI18NImeStatus* CreateI18NImeStatus() = 0; 116cdf0e10cSrcweir // SalSystem 117cdf0e10cSrcweir virtual SalSystem* CreateSalSystem() = 0; 118cdf0e10cSrcweir // SalBitmap 119cdf0e10cSrcweir virtual SalBitmap* CreateSalBitmap() = 0; 120cdf0e10cSrcweir 121cdf0e10cSrcweir // YieldMutex 122cdf0e10cSrcweir virtual vos::IMutex* GetYieldMutex() = 0; 123cdf0e10cSrcweir virtual sal_uLong ReleaseYieldMutex() = 0; 124cdf0e10cSrcweir virtual void AcquireYieldMutex( sal_uLong nCount ) = 0; 125cdf0e10cSrcweir // return true, if yield mutex is owned by this thread, else false 126cdf0e10cSrcweir virtual bool CheckYieldMutex() = 0; 127cdf0e10cSrcweir 128cdf0e10cSrcweir // wait next event and dispatch 129cdf0e10cSrcweir // must returned by UserEvent (SalFrame::PostEvent) 130cdf0e10cSrcweir // and timer 131cdf0e10cSrcweir virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) = 0; 132cdf0e10cSrcweir virtual bool AnyInput( sal_uInt16 nType ) = 0; 133cdf0e10cSrcweir 134cdf0e10cSrcweir // Menues 135cdf0e10cSrcweir virtual SalMenu* CreateMenu( sal_Bool bMenuBar, Menu* pMenu ); 136cdf0e10cSrcweir virtual void DestroyMenu( SalMenu* pMenu); 137cdf0e10cSrcweir virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); 138cdf0e10cSrcweir virtual void DestroyMenuItem( SalMenuItem* pItem ); 139cdf0e10cSrcweir 140cdf0e10cSrcweir // may return NULL to disable session management 141cdf0e10cSrcweir virtual SalSession* CreateSalSession() = 0; 142cdf0e10cSrcweir 143cdf0e10cSrcweir // methods for XDisplayConnection 144cdf0e10cSrcweir SetEventCallback(rtl::Reference<vcl::DisplayConnectionDispatch> const & pInstance)145cdf0e10cSrcweir void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance ) 146cdf0e10cSrcweir { m_pEventInst = pInstance; } CallEventCallback(void * pEvent,int nBytes)147cdf0e10cSrcweir bool CallEventCallback( void* pEvent, int nBytes ) 148cdf0e10cSrcweir { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); } CallErrorCallback(void * pEvent,int nBytes)149cdf0e10cSrcweir bool CallErrorCallback( void* pEvent, int nBytes ) 150cdf0e10cSrcweir { return m_pEventInst.is() && m_pEventInst->dispatchErrorEvent( pEvent, nBytes ); } 151cdf0e10cSrcweir 152cdf0e10cSrcweir enum ConnectionIdentifierType { AsciiCString, Blob }; 153cdf0e10cSrcweir virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0; 154cdf0e10cSrcweir 155cdf0e10cSrcweir // this is a vehicle for PrintFontManager to bridge the gap between vcl and libvclplug_* 156cdf0e10cSrcweir // this is only necessary because PrintFontManager is an exported vcl API and therefore 157cdf0e10cSrcweir // needs to be in libvcl while libvclplug_* do not contain exported C++ API 158cdf0e10cSrcweir virtual void FillFontPathList( std::list< rtl::OString >& o_rFontPaths ); 159cdf0e10cSrcweir 160cdf0e10cSrcweir // dtrans implementation 161cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 162cdf0e10cSrcweir CreateClipboard( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& i_rArguments ); 163cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource(); 164cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget(); 165cdf0e10cSrcweir virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0; 166cdf0e10cSrcweir }; 167cdf0e10cSrcweir 168cdf0e10cSrcweir // called from SVMain 169cdf0e10cSrcweir SalInstance* CreateSalInstance(); 170cdf0e10cSrcweir void DestroySalInstance( SalInstance* pInst ); 171cdf0e10cSrcweir 172cdf0e10cSrcweir // ------------------------- 173cdf0e10cSrcweir // - SalInstance-Functions - 174cdf0e10cSrcweir // ------------------------- 175cdf0e10cSrcweir 176cdf0e10cSrcweir void SalAbort( const XubString& rErrorText ); 177cdf0e10cSrcweir 178cdf0e10cSrcweir VCL_PLUGIN_PUBLIC const ::rtl::OUString& SalGetDesktopEnvironment(); 179cdf0e10cSrcweir 180cdf0e10cSrcweir // ----------- 181cdf0e10cSrcweir // - SalData - 182cdf0e10cSrcweir // ----------- 183cdf0e10cSrcweir 184cdf0e10cSrcweir void InitSalData(); // called from Application-Ctor 185cdf0e10cSrcweir void DeInitSalData(); // called from Application-Dtor 186cdf0e10cSrcweir 187cdf0e10cSrcweir void InitSalMain(); 188cdf0e10cSrcweir void DeInitSalMain(); 189cdf0e10cSrcweir 190cdf0e10cSrcweir // ---------- 191cdf0e10cSrcweir // - SVMain - 192cdf0e10cSrcweir // ---------- 193cdf0e10cSrcweir 194cdf0e10cSrcweir // Callbacks (indepen in \sv\source\app\svmain.cxx) 195cdf0e10cSrcweir VCL_DLLPUBLIC sal_Bool SVMain(); 196cdf0e10cSrcweir 197cdf0e10cSrcweir #endif // _SV_SALINST_HXX 198