LCOV - code coverage report
Current view: top level - vcl/inc/headless - svpinst.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 6 100.0 %
Date: 2014-11-03 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
      21             : #define INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
      22             : 
      23             : #include <osl/mutex.hxx>
      24             : #include <osl/thread.hxx>
      25             : #include <salinst.hxx>
      26             : #include <salwtype.hxx>
      27             : #include <saltimer.hxx>
      28             : #include <generic/geninst.h>
      29             : #include <generic/genprn.h>
      30             : #include <basebmp/scanlineformats.hxx>
      31             : 
      32             : #include <list>
      33             : 
      34             : #include <time.h>
      35             : 
      36             : #define VIRTUAL_DESKTOP_WIDTH 1024
      37             : #define VIRTUAL_DESKTOP_HEIGHT 768
      38             : 
      39             : #ifdef IOS
      40             : #define SvpSalInstance AquaSalInstance
      41             : #endif
      42             : 
      43             : class SvpSalInstance;
      44             : class SvpSalTimer : public SalTimer
      45             : {
      46             :     SvpSalInstance* m_pInstance;
      47             : public:
      48         477 :     SvpSalTimer( SvpSalInstance* pInstance ) : m_pInstance( pInstance ) {}
      49             :     virtual ~SvpSalTimer();
      50             : 
      51             :     // overload all pure virtual methods
      52             :     virtual void Start( sal_uLong nMS ) SAL_OVERRIDE;
      53             :     virtual void Stop() SAL_OVERRIDE;
      54             : };
      55             : 
      56             : class SvpSalFrame;
      57             : class GenPspGraphics;
      58             : 
      59             : class SvpSalInstance : public SalGenericInstance
      60             : {
      61             :     timeval                 m_aTimeout;
      62             :     sal_uLong               m_nTimeoutMS;
      63             :     int                     m_pTimeoutFDS[2];
      64             : 
      65             :     // internal event queue
      66             :     struct SalUserEvent
      67             :     {
      68             :         const SalFrame*     m_pFrame;
      69             :         void*               m_pData;
      70             :         sal_uInt16          m_nEvent;
      71             : 
      72      105832 :         SalUserEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT )
      73             :                 : m_pFrame( pFrame ),
      74             :                   m_pData( pData ),
      75      105832 :                   m_nEvent( nEvent )
      76      105832 :         {}
      77             :     };
      78             : 
      79             :     oslMutex                m_aEventGuard;
      80             :     std::list< SalUserEvent > m_aUserEvents;
      81             : 
      82             :     std::list< SalFrame* >  m_aFrames;
      83             : 
      84             :     bool                    isFrameAlive( const SalFrame* pFrame ) const;
      85             : 
      86             :     void                    DoReleaseYield( int nTimeoutMS );
      87             : 
      88             :     typedef std::map< sal_uInt16, ::basebmp::Format > BitCountFormatMap;
      89             :     BitCountFormatMap m_aBitCountFormatMap;
      90             : 
      91             : public:
      92             :     static SvpSalInstance*  s_pDefaultInstance;
      93             : 
      94             :     SvpSalInstance( SalYieldMutex *pMutex );
      95             :     virtual ~SvpSalInstance();
      96             : 
      97             :     void                    PostEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent );
      98             : 
      99             :     bool                    PostedEventsInQueue();
     100             : 
     101             :     void                    StartTimer( sal_uLong nMS );
     102             :     void                    StopTimer();
     103             :     void                    Wakeup();
     104             : 
     105       12438 :     void                    registerFrame( SalFrame* pFrame ) { m_aFrames.push_back( pFrame ); }
     106             :     void                    deregisterFrame( SalFrame* pFrame );
     107             :     const std::list< SalFrame* >&
     108          16 :                             getFrames() const { return m_aFrames; }
     109             : 
     110             :     bool                    CheckTimeout( bool bExecuteTimers = true );
     111             : 
     112             :     // Frame
     113             :     virtual SalFrame*       CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
     114             :     virtual SalFrame*       CreateFrame( SalFrame* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
     115             :     virtual void            DestroyFrame( SalFrame* pFrame ) SAL_OVERRIDE;
     116             : 
     117             :     // Object (System Child Window)
     118             :     virtual SalObject*      CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) SAL_OVERRIDE;
     119             :     virtual void            DestroyObject( SalObject* pObject ) SAL_OVERRIDE;
     120             : 
     121             :     // VirtualDevice
     122             :     // nDX and nDY in Pixel
     123             :     // nBitCount: 0 == Default(=as window) / 1 == Mono
     124             :     // pData allows for using a system dependent graphics or device context
     125             :     virtual SalVirtualDevice*   CreateVirtualDevice( SalGraphics* pGraphics,
     126             :                                                      long nDX, long nDY,
     127             :                                                      sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) SAL_OVERRIDE;
     128             : 
     129             :     // Printer
     130             :     // pSetupData->mpDriverData can be 0
     131             :     // pSetupData must be updatet with the current
     132             :     // JobSetup
     133             :     virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
     134             :                                                ImplJobSetup* pSetupData ) SAL_OVERRIDE;
     135             :     virtual void            DestroyInfoPrinter( SalInfoPrinter* pPrinter ) SAL_OVERRIDE;
     136             :     virtual SalPrinter*     CreatePrinter( SalInfoPrinter* pInfoPrinter ) SAL_OVERRIDE;
     137             :     virtual void            DestroyPrinter( SalPrinter* pPrinter ) SAL_OVERRIDE;
     138             : 
     139             :     virtual void            GetPrinterQueueInfo( ImplPrnQueueList* pList ) SAL_OVERRIDE;
     140             :     virtual void            GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) SAL_OVERRIDE;
     141             :     virtual void            DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) SAL_OVERRIDE;
     142             :     virtual OUString        GetDefaultPrinter() SAL_OVERRIDE;
     143             :     virtual void            PostPrintersChanged() SAL_OVERRIDE;
     144             : 
     145             :     // SalTimer
     146             :     virtual SalTimer*       CreateSalTimer() SAL_OVERRIDE;
     147             :     // SalI18NImeStatus
     148             :     virtual SalI18NImeStatus*   CreateI18NImeStatus() SAL_OVERRIDE;
     149             :     // SalSystem
     150             :     virtual SalSystem*      CreateSalSystem() SAL_OVERRIDE;
     151             :     // SalBitmap
     152             :     virtual SalBitmap*      CreateSalBitmap() SAL_OVERRIDE;
     153             : 
     154             :     // wait next event and dispatch
     155             :     // must returned by UserEvent (SalFrame::PostEvent)
     156             :     // and timer
     157             :     virtual void            Yield( bool bWait, bool bHandleAllCurrentEvents ) SAL_OVERRIDE;
     158             :     virtual bool            AnyInput( sal_uInt16 nType ) SAL_OVERRIDE;
     159             : 
     160             :     // may return NULL to disable session management
     161             :     virtual SalSession*     CreateSalSession() SAL_OVERRIDE;
     162             : 
     163             :     virtual void*           GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) SAL_OVERRIDE;
     164             : 
     165             :     virtual void            AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) SAL_OVERRIDE;
     166             : 
     167             :     virtual GenPspGraphics *CreatePrintGraphics() SAL_OVERRIDE;
     168             : 
     169             :     // We want to be able to select colourspace, i.e. ARGB vs RGBA vs BGRA etc.
     170             :     // -- as the rest of vcl always uses bit depths, it is perhaps simplest
     171             :     // to let us simply change the mapping of bitcount to format (which was
     172             :     // previously unchangeable).
     173             :     SAL_DLLPUBLIC_EXPORT void setBitCountFormatMapping( sal_uInt16 nBitCount, ::basebmp::Format aFormat );
     174             : 
     175             :     SAL_DLLPUBLIC_EXPORT ::basebmp::Format getFormatForBitCount( sal_uInt16 );
     176             : };
     177             : 
     178             : #endif // INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
     179             : 
     180             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10