2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-06 12:12:33 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2007-07-24 09:28:49 +00:00
|
|
|
*
|
2012-11-06 12:12:33 +00:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2007-07-24 09:28:49 +00:00
|
|
|
*
|
2012-11-06 12:12:33 +00:00
|
|
|
* This file incorporates work covered by the following license notice:
|
2007-07-24 09:28:49 +00:00
|
|
|
*
|
2012-11-06 12:12:33 +00:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2013-10-28 04:06:23 +01:00
|
|
|
#ifndef INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
|
|
|
|
#define INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2010-10-16 03:20:00 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2010-10-10 21:29:08 -05:00
|
|
|
#include <osl/thread.hxx>
|
2011-01-24 16:34:14 +01:00
|
|
|
#include <salinst.hxx>
|
|
|
|
#include <salwtype.hxx>
|
|
|
|
#include <saltimer.hxx>
|
2011-09-29 12:11:28 +01:00
|
|
|
#include <generic/geninst.h>
|
2011-10-07 12:41:35 +01:00
|
|
|
#include <generic/genprn.h>
|
2014-05-23 19:59:03 +01:00
|
|
|
#include <basebmp/scanlineformats.hxx>
|
2007-07-24 09:28:49 +00:00
|
|
|
|
|
|
|
#include <list>
|
2015-01-01 19:58:59 +00:00
|
|
|
#include <map>
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2013-03-18 19:27:01 +02:00
|
|
|
#include <time.h>
|
2008-06-16 13:30:53 +00:00
|
|
|
|
2007-07-24 09:28:49 +00:00
|
|
|
#define VIRTUAL_DESKTOP_WIDTH 1024
|
|
|
|
#define VIRTUAL_DESKTOP_HEIGHT 768
|
|
|
|
|
iOS tiled rendering work
Possibly quite broken intermediate commit. But anyway, now it is
possible to render the tile diretly to a CGContext. Can be seen in
the MobileLibreOffice app when build in the Debug_tile_tester
configuration. See touch_lo_draw_tile() in viewsh.cxx. Unfortunately
the old plain LibreOffice test app is now broken, though, and
displays nothing at all.
This refactoring and hacking in vcl was done in a quite ugly fashion,
with ifdefs etc. But trust me, I did try, several times, for many
days, to get where I wanted in an elegant and clean fashion. But doing
it cleanly meant not being able to actually build it for days while
trying to figure ut which bits go where and which class should be
split into what base and derived class(es), and it was too much for my
limited brain capacity. I just couldn't juggle all the vcl class
structure in my head, especially as I don't have any good
understanding of the general design of it all.
Change-Id: Ia59d6a9cce15a63e63f94e8d8574bef21993fb1f
2013-12-09 21:53:23 +02:00
|
|
|
#ifdef IOS
|
|
|
|
#define SvpSalInstance AquaSalInstance
|
|
|
|
#endif
|
|
|
|
|
2007-07-24 09:28:49 +00:00
|
|
|
class SvpSalInstance;
|
|
|
|
class SvpSalTimer : public SalTimer
|
|
|
|
{
|
|
|
|
SvpSalInstance* m_pInstance;
|
|
|
|
public:
|
|
|
|
SvpSalTimer( SvpSalInstance* pInstance ) : m_pInstance( pInstance ) {}
|
|
|
|
virtual ~SvpSalTimer();
|
|
|
|
|
2015-01-08 23:08:34 +01:00
|
|
|
// override all pure virtual methods
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void Start( sal_uLong nMS ) SAL_OVERRIDE;
|
|
|
|
virtual void Stop() SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SvpSalFrame;
|
2011-10-07 12:41:35 +01:00
|
|
|
class GenPspGraphics;
|
2013-03-18 19:27:01 +02:00
|
|
|
|
2015-03-20 18:36:02 +02:00
|
|
|
SalInstance* svp_create_SalInstance();
|
2015-03-20 16:57:22 +02:00
|
|
|
|
2015-03-02 14:59:24 +00:00
|
|
|
class VCL_DLLPUBLIC SvpSalInstance : public SalGenericInstance
|
2007-07-24 09:28:49 +00:00
|
|
|
{
|
2013-03-18 19:27:01 +02:00
|
|
|
timeval m_aTimeout;
|
|
|
|
sal_uLong m_nTimeoutMS;
|
|
|
|
int m_pTimeoutFDS[2];
|
2007-07-24 09:28:49 +00:00
|
|
|
|
|
|
|
// internal event queue
|
|
|
|
struct SalUserEvent
|
|
|
|
{
|
|
|
|
const SalFrame* m_pFrame;
|
|
|
|
void* m_pData;
|
2013-03-18 19:27:01 +02:00
|
|
|
sal_uInt16 m_nEvent;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2011-01-07 18:24:18 +01:00
|
|
|
SalUserEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT )
|
2007-07-24 09:28:49 +00:00
|
|
|
: m_pFrame( pFrame ),
|
|
|
|
m_pData( pData ),
|
|
|
|
m_nEvent( nEvent )
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2013-03-18 19:27:01 +02:00
|
|
|
oslMutex m_aEventGuard;
|
2007-07-24 09:28:49 +00:00
|
|
|
std::list< SalUserEvent > m_aUserEvents;
|
|
|
|
|
2013-03-18 19:27:01 +02:00
|
|
|
std::list< SalFrame* > m_aFrames;
|
2010-01-26 16:53:19 +01:00
|
|
|
|
2013-03-18 19:27:01 +02:00
|
|
|
bool isFrameAlive( const SalFrame* pFrame ) const;
|
2010-01-26 16:53:19 +01:00
|
|
|
|
2014-03-26 09:52:04 +02:00
|
|
|
void DoReleaseYield( int nTimeoutMS );
|
2012-01-24 22:36:25 +00:00
|
|
|
|
2014-05-23 19:59:03 +01:00
|
|
|
typedef std::map< sal_uInt16, ::basebmp::Format > BitCountFormatMap;
|
|
|
|
BitCountFormatMap m_aBitCountFormatMap;
|
|
|
|
|
2007-07-24 09:28:49 +00:00
|
|
|
public:
|
2013-03-18 19:27:01 +02:00
|
|
|
static SvpSalInstance* s_pDefaultInstance;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2011-09-30 15:46:24 +01:00
|
|
|
SvpSalInstance( SalYieldMutex *pMutex );
|
2007-07-24 09:28:49 +00:00
|
|
|
virtual ~SvpSalInstance();
|
|
|
|
|
2013-03-18 19:27:01 +02:00
|
|
|
void PostEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent );
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2013-03-18 19:27:01 +02:00
|
|
|
bool PostedEventsInQueue();
|
2013-03-06 00:26:50 +02:00
|
|
|
|
2013-03-18 19:27:01 +02:00
|
|
|
void StartTimer( sal_uLong nMS );
|
|
|
|
void StopTimer();
|
|
|
|
void Wakeup();
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2013-03-18 19:27:01 +02:00
|
|
|
void registerFrame( SalFrame* pFrame ) { m_aFrames.push_back( pFrame ); }
|
|
|
|
void deregisterFrame( SalFrame* pFrame );
|
|
|
|
const std::list< SalFrame* >&
|
|
|
|
getFrames() const { return m_aFrames; }
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2013-03-18 19:27:01 +02:00
|
|
|
bool CheckTimeout( bool bExecuteTimers = true );
|
2007-07-24 09:28:49 +00:00
|
|
|
|
|
|
|
// Frame
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
|
|
|
|
virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
|
|
|
|
virtual void DestroyFrame( SalFrame* pFrame ) SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
|
|
|
// Object (System Child Window)
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) SAL_OVERRIDE;
|
|
|
|
virtual void DestroyObject( SalObject* pObject ) SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
|
|
|
// VirtualDevice
|
|
|
|
// nDX and nDY in Pixel
|
|
|
|
// nBitCount: 0 == Default(=as window) / 1 == Mono
|
|
|
|
// pData allows for using a system dependent graphics or device context
|
|
|
|
virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics,
|
2015-02-28 12:22:29 +00:00
|
|
|
long &nDX, long &nDY,
|
2014-03-26 09:52:04 +02:00
|
|
|
sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
|
|
|
// Printer
|
|
|
|
// pSetupData->mpDriverData can be 0
|
|
|
|
// pSetupData must be updatet with the current
|
|
|
|
// JobSetup
|
|
|
|
virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
|
2014-03-26 09:52:04 +02:00
|
|
|
ImplJobSetup* pSetupData ) SAL_OVERRIDE;
|
|
|
|
virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) SAL_OVERRIDE;
|
|
|
|
virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) SAL_OVERRIDE;
|
|
|
|
virtual void DestroyPrinter( SalPrinter* pPrinter ) SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) SAL_OVERRIDE;
|
|
|
|
virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) SAL_OVERRIDE;
|
|
|
|
virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) SAL_OVERRIDE;
|
|
|
|
virtual OUString GetDefaultPrinter() SAL_OVERRIDE;
|
|
|
|
virtual void PostPrintersChanged() SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
|
|
|
// SalTimer
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual SalTimer* CreateSalTimer() SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
// SalI18NImeStatus
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual SalI18NImeStatus* CreateI18NImeStatus() SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
// SalSystem
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual SalSystem* CreateSalSystem() SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
// SalBitmap
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual SalBitmap* CreateSalBitmap() SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
|
|
|
// wait next event and dispatch
|
|
|
|
// must returned by UserEvent (SalFrame::PostEvent)
|
|
|
|
// and timer
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) SAL_OVERRIDE;
|
2015-01-01 16:49:23 +02:00
|
|
|
virtual bool AnyInput( VclInputFlags nType ) SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
|
|
|
// may return NULL to disable session management
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual SalSession* CreateSalSession() SAL_OVERRIDE;
|
2007-07-24 09:28:49 +00:00
|
|
|
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) SAL_OVERRIDE;
|
2009-10-01 09:16:17 +00:00
|
|
|
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) SAL_OVERRIDE;
|
2010-12-17 11:51:54 +00:00
|
|
|
|
2014-03-26 09:52:04 +02:00
|
|
|
virtual GenPspGraphics *CreatePrintGraphics() SAL_OVERRIDE;
|
2014-05-23 19:59:03 +01:00
|
|
|
|
|
|
|
// We want to be able to select colourspace, i.e. ARGB vs RGBA vs BGRA etc.
|
|
|
|
// -- as the rest of vcl always uses bit depths, it is perhaps simplest
|
|
|
|
// to let us simply change the mapping of bitcount to format (which was
|
|
|
|
// previously unchangeable).
|
2015-03-02 14:59:24 +00:00
|
|
|
void setBitCountFormatMapping( sal_uInt16 nBitCount, ::basebmp::Format aFormat );
|
2014-05-23 19:59:03 +01:00
|
|
|
|
2015-03-02 14:59:24 +00:00
|
|
|
::basebmp::Format getFormatForBitCount( sal_uInt16 );
|
2007-07-24 09:28:49 +00:00
|
|
|
};
|
|
|
|
|
2013-12-02 12:00:22 +02:00
|
|
|
#endif // INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|