1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svpinst.hxx,v $
10 * $Revision: 1.6.116.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVP_SALINST_HXX
32 #define _SVP_SALINST_HXX
34 #include <vcl/salinst.hxx>
35 #include <vcl/salwtype.hxx>
36 #include <vcl/saltimer.hxx>
37 #include <vos/mutex.hxx>
38 #include <vos/thread.hxx>
42 #include <time.h> // timeval
44 #define VIRTUAL_DESKTOP_WIDTH 1024
45 #define VIRTUAL_DESKTOP_HEIGHT 768
46 #define VIRTUAL_DESKTOP_DEPTH 24
48 // -------------------------------------------------------------------------
50 // -------------------------------------------------------------------------
52 class SvpSalYieldMutex
: public NAMESPACE_VOS(OMutex
)
56 NAMESPACE_VOS(OThread
)::TThreadIdentifier mnThreadId
;
61 virtual void acquire();
62 virtual void release();
63 virtual sal_Bool
tryToAcquire();
65 ULONG
GetAcquireCount() const { return mnCount
; }
66 NAMESPACE_VOS(OThread
)::TThreadIdentifier
GetThreadId() const { return mnThreadId
; }
73 class SvpSalTimer
: public SalTimer
75 SvpSalInstance
* m_pInstance
;
77 SvpSalTimer( SvpSalInstance
* pInstance
) : m_pInstance( pInstance
) {}
78 virtual ~SvpSalTimer();
80 // overload all pure virtual methods
81 virtual void Start( ULONG nMS
);
89 class SvpSalInstance
: public SalInstance
94 SvpSalYieldMutex m_aYieldMutex
;
96 // internal event queue
99 const SalFrame
* m_pFrame
;
103 SalUserEvent( const SalFrame
* pFrame
, void* pData
, USHORT nEvent
= SALEVENT_USEREVENT
)
104 : m_pFrame( pFrame
),
110 oslMutex m_aEventGuard
;
111 std::list
< SalUserEvent
> m_aUserEvents
;
113 std::list
< SalFrame
* > m_aFrames
;
115 static SvpSalInstance
* s_pDefaultInstance
;
118 virtual ~SvpSalInstance();
120 void PostEvent( const SalFrame
* pFrame
, void* pData
, USHORT nEvent
);
121 void CancelEvent( const SalFrame
* pFrame
, void* pData
, USHORT nEvent
);
123 void StartTimer( ULONG nMS
);
127 void registerFrame( SalFrame
* pFrame
) { m_aFrames
.push_back( pFrame
); }
128 void deregisterFrame( SalFrame
* pFrame
);
129 const std::list
< SalFrame
* >& getFrames() const { return m_aFrames
; }
131 bool CheckTimeout( bool bExecuteTimers
= true );
134 virtual SalFrame
* CreateChildFrame( SystemParentData
* pParent
, ULONG nStyle
);
135 virtual SalFrame
* CreateFrame( SalFrame
* pParent
, ULONG nStyle
);
136 virtual void DestroyFrame( SalFrame
* pFrame
);
138 // Object (System Child Window)
139 virtual SalObject
* CreateObject( SalFrame
* pParent
, SystemWindowData
* pWindowData
, BOOL bShow
= TRUE
);
140 virtual void DestroyObject( SalObject
* pObject
);
143 // nDX and nDY in Pixel
144 // nBitCount: 0 == Default(=as window) / 1 == Mono
145 // pData allows for using a system dependent graphics or device context
146 virtual SalVirtualDevice
* CreateVirtualDevice( SalGraphics
* pGraphics
,
148 USHORT nBitCount
, const SystemGraphicsData
*pData
= NULL
);
149 virtual void DestroyVirtualDevice( SalVirtualDevice
* pDevice
);
152 // pSetupData->mpDriverData can be 0
153 // pSetupData must be updatet with the current
155 virtual SalInfoPrinter
* CreateInfoPrinter( SalPrinterQueueInfo
* pQueueInfo
,
156 ImplJobSetup
* pSetupData
);
157 virtual void DestroyInfoPrinter( SalInfoPrinter
* pPrinter
);
158 virtual SalPrinter
* CreatePrinter( SalInfoPrinter
* pInfoPrinter
);
159 virtual void DestroyPrinter( SalPrinter
* pPrinter
);
161 virtual void GetPrinterQueueInfo( ImplPrnQueueList
* pList
);
162 virtual void GetPrinterQueueState( SalPrinterQueueInfo
* pInfo
);
163 virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo
* pInfo
);
164 virtual String
GetDefaultPrinter();
167 virtual SalTimer
* CreateSalTimer();
169 virtual SalI18NImeStatus
* CreateI18NImeStatus();
171 virtual SalSystem
* CreateSalSystem();
173 virtual SalBitmap
* CreateSalBitmap();
176 virtual vos::IMutex
* GetYieldMutex();
177 virtual ULONG
ReleaseYieldMutex();
178 virtual void AcquireYieldMutex( ULONG nCount
);
180 // wait next event and dispatch
181 // must returned by UserEvent (SalFrame::PostEvent)
183 virtual void Yield( bool bWait
, bool bHandleAllCurrentEvents
);
184 virtual bool AnyInput( USHORT nType
);
187 virtual SalMenu
* CreateMenu( BOOL bMenuBar
);
188 virtual void DestroyMenu( SalMenu
* pMenu
);
189 virtual SalMenuItem
* CreateMenuItem( const SalItemParams
* pItemData
);
190 virtual void DestroyMenuItem( SalMenuItem
* pItem
);
192 // may return NULL to disable session management
193 virtual SalSession
* CreateSalSession();
195 virtual void* GetConnectionIdentifier( ConnectionIdentifierType
& rReturnedType
, int& rReturnedBytes
);
197 virtual void AddToRecentDocumentList(const rtl::OUString
& rFileUrl
, const rtl::OUString
& rMimeType
);
200 #endif // _SV_SALINST_HXX