LCOV - code coverage report
Current view: top level - libreoffice/vcl/inc/headless - svpinst.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 6 83.3 %
Date: 2012-12-27 Functions: 3 4 75.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 _SVP_SALINST_HXX
      21             : #define _SVP_SALINST_HXX
      22             : 
      23             : #include <vcl/solarmutex.hxx>
      24             : 
      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>
      32             : 
      33             : #include <list>
      34             : 
      35             : #include <time.h>  // timeval
      36             : 
      37             : #define VIRTUAL_DESKTOP_WIDTH 1024
      38             : #define VIRTUAL_DESKTOP_HEIGHT 768
      39             : 
      40             : // ---------------
      41             : // - SalTimer -
      42             : // ---------------
      43             : class SvpSalInstance;
      44             : class SvpSalTimer : public SalTimer
      45             : {
      46             :     SvpSalInstance* m_pInstance;
      47             : public:
      48          19 :     SvpSalTimer( SvpSalInstance* pInstance ) : m_pInstance( pInstance ) {}
      49             :     virtual ~SvpSalTimer();
      50             : 
      51             :     // overload all pure virtual methods
      52             :     virtual void Start( sal_uLong nMS );
      53             :     virtual void Stop();
      54             : };
      55             : 
      56             : // ---------------
      57             : // - SalInstance -
      58             : // ---------------
      59             : class SvpSalFrame;
      60             : class GenPspGraphics;
      61             : class SvpSalInstance : public SalGenericInstance
      62             : {
      63             :     timeval             m_aTimeout;
      64             :     sal_uLong           m_nTimeoutMS;
      65             :     int                 m_pTimeoutFDS[2];
      66             : 
      67             :     // internal event queue
      68             :     struct SalUserEvent
      69             :     {
      70             :         const SalFrame*     m_pFrame;
      71             :         void*               m_pData;
      72             :         sal_uInt16         m_nEvent;
      73             : 
      74        4836 :         SalUserEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT )
      75             :                 : m_pFrame( pFrame ),
      76             :                   m_pData( pData ),
      77        4836 :                   m_nEvent( nEvent )
      78        4836 :         {}
      79             :     };
      80             : 
      81             :     oslMutex        m_aEventGuard;
      82             :     std::list< SalUserEvent > m_aUserEvents;
      83             : 
      84             :     std::list< SalFrame* > m_aFrames;
      85             : 
      86             :     bool isFrameAlive( const SalFrame* pFrame ) const;
      87             : 
      88             : protected:
      89             :     virtual void DoReleaseYield( int nTimeoutMS );
      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             :     void StartTimer( sal_uLong nMS );
     100             :     void StopTimer();
     101             :     void Wakeup();
     102             : 
     103         267 :     void registerFrame( SalFrame* pFrame ) { m_aFrames.push_back( pFrame ); }
     104             :     void deregisterFrame( SalFrame* pFrame );
     105           0 :     const std::list< SalFrame* >& getFrames() const { return m_aFrames; }
     106             : 
     107             :     bool            CheckTimeout( bool bExecuteTimers = true );
     108             : 
     109             :     // Frame
     110             :     virtual SalFrame*       CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle );
     111             :     virtual SalFrame*       CreateFrame( SalFrame* pParent, sal_uLong nStyle );
     112             :     virtual void            DestroyFrame( SalFrame* pFrame );
     113             : 
     114             :     // Object (System Child Window)
     115             :     virtual SalObject*      CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True );
     116             :     virtual void            DestroyObject( SalObject* pObject );
     117             : 
     118             :     // VirtualDevice
     119             :     // nDX and nDY in Pixel
     120             :     // nBitCount: 0 == Default(=as window) / 1 == Mono
     121             :     // pData allows for using a system dependent graphics or device context
     122             :     virtual SalVirtualDevice*   CreateVirtualDevice( SalGraphics* pGraphics,
     123             :                                                      long nDX, long nDY,
     124             :                                                      sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL );
     125             :     virtual void                DestroyVirtualDevice( SalVirtualDevice* pDevice );
     126             : 
     127             :     // Printer
     128             :     // pSetupData->mpDriverData can be 0
     129             :     // pSetupData must be updatet with the current
     130             :     // JobSetup
     131             :     virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
     132             :                                                ImplJobSetup* pSetupData );
     133             :     virtual void            DestroyInfoPrinter( SalInfoPrinter* pPrinter );
     134             :     virtual SalPrinter*     CreatePrinter( SalInfoPrinter* pInfoPrinter );
     135             :     virtual void            DestroyPrinter( SalPrinter* pPrinter );
     136             : 
     137             :     virtual void            GetPrinterQueueInfo( ImplPrnQueueList* pList );
     138             :     virtual void            GetPrinterQueueState( SalPrinterQueueInfo* pInfo );
     139             :     virtual void            DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo );
     140             :     virtual rtl::OUString   GetDefaultPrinter();
     141             :     virtual void            PostPrintersChanged();
     142             : 
     143             :     // SalTimer
     144             :     virtual SalTimer*       CreateSalTimer();
     145             :     // SalI18NImeStatus
     146             :     virtual SalI18NImeStatus*   CreateI18NImeStatus();
     147             :     // SalSystem
     148             :     virtual SalSystem*      CreateSalSystem();
     149             :     // SalBitmap
     150             :     virtual SalBitmap*      CreateSalBitmap();
     151             : 
     152             :     // wait next event and dispatch
     153             :     // must returned by UserEvent (SalFrame::PostEvent)
     154             :     // and timer
     155             :     virtual void            Yield( bool bWait, bool bHandleAllCurrentEvents );
     156             :     virtual bool            AnyInput( sal_uInt16 nType );
     157             : 
     158             :     // may return NULL to disable session management
     159             :     virtual SalSession*     CreateSalSession();
     160             : 
     161             :     virtual void*           GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes );
     162             : 
     163             :     virtual void            AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
     164             : 
     165             :     virtual GenPspGraphics *CreatePrintGraphics();
     166             : };
     167             : 
     168             : #endif // _SV_SALINST_HXX
     169             : 
     170             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10