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 _SVP_SALINST_HXX
21 #define _SVP_SALINST_HXX
23 #include <vcl/solarmutex.hxx>
25 #include <osl/mutex.hxx>
26 #include <osl/thread.hxx>
27 #include <salinst.hxx>
28 #include <salwtype.hxx>
29 #include <saltimer.hxx>
30 #include <generic/geninst.h>
31 #include <generic/genprn.h>
37 #define VIRTUAL_DESKTOP_WIDTH 1024
38 #define VIRTUAL_DESKTOP_HEIGHT 768
41 class SvpSalTimer
: public SalTimer
43 SvpSalInstance
* m_pInstance
;
45 SvpSalTimer( SvpSalInstance
* pInstance
) : m_pInstance( pInstance
) {}
46 virtual ~SvpSalTimer();
48 // overload all pure virtual methods
49 virtual void Start( sal_uLong nMS
);
56 class SvpSalInstance
: public SalGenericInstance
59 sal_uLong m_nTimeoutMS
;
62 // internal event queue
65 const SalFrame
* m_pFrame
;
69 SalUserEvent( const SalFrame
* pFrame
, void* pData
, sal_uInt16 nEvent
= SALEVENT_USEREVENT
)
76 oslMutex m_aEventGuard
;
77 std::list
< SalUserEvent
> m_aUserEvents
;
79 std::list
< SalFrame
* > m_aFrames
;
81 bool isFrameAlive( const SalFrame
* pFrame
) const;
84 virtual void DoReleaseYield( int nTimeoutMS
);
87 static SvpSalInstance
* s_pDefaultInstance
;
89 SvpSalInstance( SalYieldMutex
*pMutex
);
90 virtual ~SvpSalInstance();
92 void PostEvent( const SalFrame
* pFrame
, void* pData
, sal_uInt16 nEvent
);
94 bool PostedEventsInQueue();
96 void StartTimer( sal_uLong nMS
);
100 void registerFrame( SalFrame
* pFrame
) { m_aFrames
.push_back( pFrame
); }
101 void deregisterFrame( SalFrame
* pFrame
);
102 const std::list
< SalFrame
* >&
103 getFrames() const { return m_aFrames
; }
105 bool CheckTimeout( bool bExecuteTimers
= true );
108 virtual SalFrame
* CreateChildFrame( SystemParentData
* pParent
, sal_uLong nStyle
);
109 virtual SalFrame
* CreateFrame( SalFrame
* pParent
, sal_uLong nStyle
);
110 virtual void DestroyFrame( SalFrame
* pFrame
);
112 // Object (System Child Window)
113 virtual SalObject
* CreateObject( SalFrame
* pParent
, SystemWindowData
* pWindowData
, sal_Bool bShow
= sal_True
);
114 virtual void DestroyObject( SalObject
* pObject
);
117 // nDX and nDY in Pixel
118 // nBitCount: 0 == Default(=as window) / 1 == Mono
119 // pData allows for using a system dependent graphics or device context
120 virtual SalVirtualDevice
* CreateVirtualDevice( SalGraphics
* pGraphics
,
122 sal_uInt16 nBitCount
, const SystemGraphicsData
*pData
= NULL
);
123 virtual void DestroyVirtualDevice( SalVirtualDevice
* pDevice
);
126 // pSetupData->mpDriverData can be 0
127 // pSetupData must be updatet with the current
129 virtual SalInfoPrinter
* CreateInfoPrinter( SalPrinterQueueInfo
* pQueueInfo
,
130 ImplJobSetup
* pSetupData
);
131 virtual void DestroyInfoPrinter( SalInfoPrinter
* pPrinter
);
132 virtual SalPrinter
* CreatePrinter( SalInfoPrinter
* pInfoPrinter
);
133 virtual void DestroyPrinter( SalPrinter
* pPrinter
);
135 virtual void GetPrinterQueueInfo( ImplPrnQueueList
* pList
);
136 virtual void GetPrinterQueueState( SalPrinterQueueInfo
* pInfo
);
137 virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo
* pInfo
);
138 virtual OUString
GetDefaultPrinter();
139 virtual void PostPrintersChanged();
142 virtual SalTimer
* CreateSalTimer();
144 virtual SalI18NImeStatus
* CreateI18NImeStatus();
146 virtual SalSystem
* CreateSalSystem();
148 virtual SalBitmap
* CreateSalBitmap();
150 // wait next event and dispatch
151 // must returned by UserEvent (SalFrame::PostEvent)
153 virtual void Yield( bool bWait
, bool bHandleAllCurrentEvents
);
154 virtual bool AnyInput( sal_uInt16 nType
);
156 // may return NULL to disable session management
157 virtual SalSession
* CreateSalSession();
159 virtual void* GetConnectionIdentifier( ConnectionIdentifierType
& rReturnedType
, int& rReturnedBytes
);
161 virtual void AddToRecentDocumentList(const OUString
& rFileUrl
, const OUString
& rMimeType
, const OUString
& rDocumentService
);
163 virtual GenPspGraphics
*CreatePrintGraphics();
166 #endif // _SV_SALINST_HXX
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */