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_HEADLESS_SVPINST_HXX
21 #define INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
23 #include <osl/mutex.hxx>
24 #include <osl/thread.hxx>
25 #include <salinst.hxx>
26 #include <salwtype.hxx>
27 #include <saltimer.hxx>
28 #include <unx/geninst.h>
29 #include <unx/genprn.h>
35 #define VIRTUAL_DESKTOP_WIDTH 1024
36 #define VIRTUAL_DESKTOP_HEIGHT 768
39 #define SvpSalInstance AquaSalInstance
43 class SvpSalTimer
: public SalTimer
45 SvpSalInstance
* m_pInstance
;
47 SvpSalTimer( SvpSalInstance
* pInstance
) : m_pInstance( pInstance
) {}
48 virtual ~SvpSalTimer() override
;
50 // override all pure virtual methods
51 virtual void Start( sal_uLong nMS
) override
;
52 virtual void Stop() override
;
58 SalInstance
* svp_create_SalInstance();
60 class VCL_DLLPUBLIC SvpSalInstance
: public SalGenericInstance
63 sal_uLong m_nTimeoutMS
;
66 // internal event queue
69 const SalFrame
* m_pFrame
;
73 SalUserEvent( const SalFrame
* pFrame
, ImplSVEvent
* pData
, SalEvent nEvent
)
80 osl::Mutex m_aEventGuard
;
81 std::list
< SalUserEvent
> m_aUserEvents
;
83 std::list
< SalFrame
* > m_aFrames
;
85 bool isFrameAlive( const SalFrame
* pFrame
) const;
87 void DoReleaseYield( int nTimeoutMS
);
90 static SvpSalInstance
* s_pDefaultInstance
;
92 SvpSalInstance( SalYieldMutex
*pMutex
);
93 virtual ~SvpSalInstance() override
;
95 void CloseWakeupPipe(bool log
);
96 void CreateWakeupPipe(bool log
);
98 void PostEvent(const SalFrame
* pFrame
, ImplSVEvent
* pData
, SalEvent nEvent
);
101 bool PostedEventsInQueue();
104 void StartTimer( sal_uLong nMS
);
108 void registerFrame( SalFrame
* pFrame
) { m_aFrames
.push_back( pFrame
); }
109 void deregisterFrame( SalFrame
* pFrame
);
110 const std::list
< SalFrame
* >&
111 getFrames() const { return m_aFrames
; }
113 bool CheckTimeout( bool bExecuteTimers
= true );
116 virtual SalFrame
* CreateChildFrame( SystemParentData
* pParent
, SalFrameStyleFlags nStyle
) override
;
117 virtual SalFrame
* CreateFrame( SalFrame
* pParent
, SalFrameStyleFlags nStyle
) override
;
118 virtual void DestroyFrame( SalFrame
* pFrame
) override
;
120 // Object (System Child Window)
121 virtual SalObject
* CreateObject( SalFrame
* pParent
, SystemWindowData
* pWindowData
, bool bShow
) override
;
122 virtual void DestroyObject( SalObject
* pObject
) override
;
125 // nDX and nDY in Pixel
126 // nBitCount: 0 == Default(=as window) / 1 == Mono
127 // pData allows for using a system dependent graphics or device context
128 virtual SalVirtualDevice
* CreateVirtualDevice( SalGraphics
* pGraphics
,
129 long &nDX
, long &nDY
,
130 DeviceFormat eFormat
, const SystemGraphicsData
*pData
= nullptr ) override
;
133 // pSetupData->mpDriverData can be 0
134 // pSetupData must be updated with the current
136 virtual SalInfoPrinter
* CreateInfoPrinter( SalPrinterQueueInfo
* pQueueInfo
,
137 ImplJobSetup
* pSetupData
) override
;
138 virtual void DestroyInfoPrinter( SalInfoPrinter
* pPrinter
) override
;
139 virtual SalPrinter
* CreatePrinter( SalInfoPrinter
* pInfoPrinter
) override
;
140 virtual void DestroyPrinter( SalPrinter
* pPrinter
) override
;
142 virtual void GetPrinterQueueInfo( ImplPrnQueueList
* pList
) override
;
143 virtual void GetPrinterQueueState( SalPrinterQueueInfo
* pInfo
) override
;
144 virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo
* pInfo
) override
;
145 virtual OUString
GetDefaultPrinter() override
;
146 virtual void PostPrintersChanged() override
;
149 virtual SalTimer
* CreateSalTimer() override
;
151 virtual SalSystem
* CreateSalSystem() override
;
153 virtual SalBitmap
* CreateSalBitmap() override
;
155 // wait next event and dispatch
156 // must returned by UserEvent (SalFrame::PostEvent)
158 virtual SalYieldResult
DoYield(bool bWait
, bool bHandleAllCurrentEvents
, sal_uLong nReleased
) override
;
159 virtual bool AnyInput( VclInputFlags nType
) override
;
161 // may return NULL to disable session management
162 virtual SalSession
* CreateSalSession() override
;
164 virtual OpenGLContext
* CreateOpenGLContext() override
;
166 virtual OUString
GetConnectionIdentifier() override
;
168 virtual void AddToRecentDocumentList(const OUString
& rFileUrl
, const OUString
& rMimeType
, const OUString
& rDocumentService
) override
;
170 virtual GenPspGraphics
*CreatePrintGraphics() override
;
173 #endif // INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */