LCOV - code coverage report
Current view: top level - vcl/inc/headless - svpinst.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 6 100.0 %
Date: 2015-06-13 12:38:46 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             : #include <map>
      34             : 
      35             : #include <time.h>
      36             : 
      37             : #define VIRTUAL_DESKTOP_WIDTH 1024
      38             : #define VIRTUAL_DESKTOP_HEIGHT 768
      39             : 
      40             : #ifdef IOS
      41             : #define SvpSalInstance AquaSalInstance
      42             : #endif
      43             : 
      44             : class SvpSalInstance;
      45             : class SvpSalTimer : public SalTimer
      46             : {
      47             :     SvpSalInstance* m_pInstance;
      48             : public:
      49         330 :     SvpSalTimer( SvpSalInstance* pInstance ) : m_pInstance( pInstance ) {}
      50             :     virtual ~SvpSalTimer();
      51             : 
      52             :     // override all pure virtual methods
      53             :     virtual void Start( sal_uLong nMS ) SAL_OVERRIDE;
      54             :     virtual void Stop() SAL_OVERRIDE;
      55             : };
      56             : 
      57             : class SvpSalFrame;
      58             : class GenPspGraphics;
      59             : 
      60             : SalInstance* svp_create_SalInstance();
      61             : 
      62             : class VCL_DLLPUBLIC SvpSalInstance : public SalGenericInstance
      63             : {
      64             :     timeval                 m_aTimeout;
      65             :     sal_uLong               m_nTimeoutMS;
      66             :     int                     m_pTimeoutFDS[2];
      67             : 
      68             :     // internal event queue
      69             :     struct SalUserEvent
      70             :     {
      71             :         const SalFrame*     m_pFrame;
      72             :         void*               m_pData;
      73             :         sal_uInt16          m_nEvent;
      74             : 
      75      111843 :         SalUserEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT )
      76             :                 : m_pFrame( pFrame ),
      77             :                   m_pData( pData ),
      78      111843 :                   m_nEvent( nEvent )
      79      111843 :         {}
      80             :     };
      81             : 
      82             :     oslMutex                m_aEventGuard;
      83             :     std::list< SalUserEvent > m_aUserEvents;
      84             : 
      85             :     std::list< SalFrame* >  m_aFrames;
      86             : 
      87             :     bool                    isFrameAlive( const SalFrame* pFrame ) const;
      88             : 
      89             :     void                    DoReleaseYield( int nTimeoutMS );
      90             : 
      91             :     typedef std::map< sal_uInt16, ::basebmp::Format > BitCountFormatMap;
      92             :     BitCountFormatMap m_aBitCountFormatMap;
      93             : 
      94             : public:
      95             :     static SvpSalInstance*  s_pDefaultInstance;
      96             : 
      97             :     SvpSalInstance( SalYieldMutex *pMutex );
      98             :     virtual ~SvpSalInstance();
      99             : 
     100             :     void                    PostEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent );
     101             : 
     102             :     bool                    PostedEventsInQueue();
     103             : 
     104             :     void                    StartTimer( sal_uLong nMS );
     105             :     void                    StopTimer();
     106             :     void                    Wakeup();
     107             : 
     108        6925 :     void                    registerFrame( SalFrame* pFrame ) { m_aFrames.push_back( pFrame ); }
     109             :     void                    deregisterFrame( SalFrame* pFrame );
     110             :     const std::list< SalFrame* >&
     111           9 :                             getFrames() const { return m_aFrames; }
     112             : 
     113             :     bool                    CheckTimeout( bool bExecuteTimers = true );
     114             : 
     115             :     // Frame
     116             :     virtual SalFrame*       CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
     117             :     virtual SalFrame*       CreateFrame( SalFrame* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
     118             :     virtual void            DestroyFrame( SalFrame* pFrame ) SAL_OVERRIDE;
     119             : 
     120             :     // Object (System Child Window)
     121             :     virtual SalObject*      CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) SAL_OVERRIDE;
     122             :     virtual void            DestroyObject( SalObject* pObject ) SAL_OVERRIDE;
     123             : 
     124             :     // VirtualDevice
     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             :                                                      sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) SAL_OVERRIDE;
     131             : 
     132             :     // Printer
     133             :     // pSetupData->mpDriverData can be 0
     134             :     // pSetupData must be updatet with the current
     135             :     // JobSetup
     136             :     virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
     137             :                                                ImplJobSetup* pSetupData ) SAL_OVERRIDE;
     138             :     virtual void            DestroyInfoPrinter( SalInfoPrinter* pPrinter ) SAL_OVERRIDE;
     139             :     virtual SalPrinter*     CreatePrinter( SalInfoPrinter* pInfoPrinter ) SAL_OVERRIDE;
     140             :     virtual void            DestroyPrinter( SalPrinter* pPrinter ) SAL_OVERRIDE;
     141             : 
     142             :     virtual void            GetPrinterQueueInfo( ImplPrnQueueList* pList ) SAL_OVERRIDE;
     143             :     virtual void            GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) SAL_OVERRIDE;
     144             :     virtual void            DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) SAL_OVERRIDE;
     145             :     virtual OUString        GetDefaultPrinter() SAL_OVERRIDE;
     146             :     virtual void            PostPrintersChanged() SAL_OVERRIDE;
     147             : 
     148             :     // SalTimer
     149             :     virtual SalTimer*       CreateSalTimer() SAL_OVERRIDE;
     150             :     // SalI18NImeStatus
     151             :     virtual SalI18NImeStatus*   CreateI18NImeStatus() SAL_OVERRIDE;
     152             :     // SalSystem
     153             :     virtual SalSystem*      CreateSalSystem() SAL_OVERRIDE;
     154             :     // SalBitmap
     155             :     virtual SalBitmap*      CreateSalBitmap() SAL_OVERRIDE;
     156             : 
     157             :     // wait next event and dispatch
     158             :     // must returned by UserEvent (SalFrame::PostEvent)
     159             :     // and timer
     160             :     virtual void            Yield( bool bWait, bool bHandleAllCurrentEvents ) SAL_OVERRIDE;
     161             :     virtual bool            AnyInput( VclInputFlags nType ) SAL_OVERRIDE;
     162             : 
     163             :     // may return NULL to disable session management
     164             :     virtual SalSession*     CreateSalSession() SAL_OVERRIDE;
     165             : 
     166             :     virtual void*           GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) SAL_OVERRIDE;
     167             : 
     168             :     virtual void            AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) SAL_OVERRIDE;
     169             : 
     170             :     virtual GenPspGraphics *CreatePrintGraphics() SAL_OVERRIDE;
     171             : 
     172             :     // We want to be able to select colourspace, i.e. ARGB vs RGBA vs BGRA etc.
     173             :     // -- as the rest of vcl always uses bit depths, it is perhaps simplest
     174             :     // to let us simply change the mapping of bitcount to format (which was
     175             :     // previously unchangeable).
     176             :     void setBitCountFormatMapping( sal_uInt16 nBitCount, ::basebmp::Format aFormat );
     177             : 
     178             :     ::basebmp::Format getFormatForBitCount( sal_uInt16 );
     179             : };
     180             : 
     181             : #endif // INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
     182             : 
     183             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11