LCOV - code coverage report
Current view: top level - libreoffice/vcl/inc/unx/gtk - gtkinst.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 13 0.0 %
Date: 2012-12-27 Functions: 0 10 0.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 _VCL_GTKINST_HXX
      21             : #define _VCL_GTKINST_HXX
      22             : 
      23             : #include <boost/shared_ptr.hpp>
      24             : 
      25             : #include <unx/salinst.h>
      26             : #include <generic/gensys.h>
      27             : #include <headless/svpinst.hxx>
      28             : #include <gtk/gtk.h>
      29             : 
      30             : namespace vcl
      31             : {
      32             : namespace unx
      33             : {
      34             : class GtkPrintWrapper;
      35             : }
      36             : }
      37             : 
      38             : class GenPspGraphics;
      39           0 : class GtkYieldMutex : public SalYieldMutex
      40             : {
      41             : public:
      42             :                                                 GtkYieldMutex();
      43             :     virtual void                                acquire();
      44             :     virtual void                                release();
      45             :     virtual sal_Bool                            tryToAcquire();
      46             : 
      47             :     virtual int Grab();
      48             :     virtual void Ungrab( int );
      49             : 
      50             :     class GtkYieldGuard
      51             :     {
      52             :         GtkYieldMutex*  m_pMutex;
      53             :         int             m_nGrab;
      54             :     public:
      55           0 :         GtkYieldGuard( GtkYieldMutex* pMutex )
      56           0 :                 : m_pMutex( pMutex )
      57             :         {
      58           0 :             m_nGrab = m_pMutex->Grab();
      59           0 :         }
      60           0 :         ~GtkYieldGuard()
      61             :         {
      62           0 :             m_pMutex->Ungrab( m_nGrab );
      63           0 :         }
      64             :     };
      65             : };
      66             : 
      67           0 : class GtkHookedYieldMutex : public GtkYieldMutex
      68             : {
      69           0 :     virtual int      Grab()             { return 0; };
      70           0 :     virtual void     Ungrab(int )       {};
      71             :     std::list<sal_uLong> aYieldStack;
      72             : public:
      73             :     GtkHookedYieldMutex();
      74             :     virtual void      acquire();
      75             :     virtual void      release();
      76           0 :     virtual sal_Bool  tryToAcquire() { return SalYieldMutex::tryToAcquire(); }
      77             :     void ThreadsEnter();
      78             :     void ThreadsLeave();
      79             : };
      80             : 
      81             : 
      82             : #define GTK_YIELD_GRAB() GtkYieldMutex::GtkYieldGuard aLocalGtkYieldGuard( static_cast<GtkYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex()) )
      83             : 
      84             : class GtkSalTimer;
      85             : #if GTK_CHECK_VERSION(3,0,0)
      86             : class GtkInstance : public SvpSalInstance
      87             : #else
      88             : class GtkInstance : public X11SalInstance
      89             : #endif
      90             : {
      91             : #if GTK_CHECK_VERSION(3,0,0)
      92             :     typedef SvpSalInstance Superclass_t;
      93             : #else
      94             :     typedef X11SalInstance Superclass_t;
      95             : #endif
      96             : public:
      97             :             GtkInstance( SalYieldMutex* pMutex );
      98             :     virtual ~GtkInstance();
      99             :     void    Init();
     100             : 
     101             :     virtual SalFrame*           CreateFrame( SalFrame* pParent, sal_uLong nStyle );
     102             :     virtual SalFrame*           CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle );
     103             :     virtual SalObject*          CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True );
     104             :     virtual SalSystem*          CreateSalSystem();
     105             :     virtual SalInfoPrinter*     CreateInfoPrinter(SalPrinterQueueInfo* pPrinterQueueInfo, ImplJobSetup* pJobSetup);
     106             :     virtual SalPrinter*         CreatePrinter( SalInfoPrinter* pInfoPrinter );
     107             :     virtual SalMenu*            CreateMenu( sal_Bool, Menu* );
     108             :     virtual void                DestroyMenu( SalMenu* pMenu );
     109             :     virtual SalMenuItem*        CreateMenuItem( const SalItemParams* );
     110             :     virtual void                DestroyMenuItem( SalMenuItem* pItem );
     111             :     virtual SalTimer*           CreateSalTimer();
     112             :     virtual void                AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
     113             :     virtual SalVirtualDevice*   CreateVirtualDevice( SalGraphics*,
     114             :                                                      long nDX, long nDY,
     115             :                                                      sal_uInt16 nBitCount,
     116             :                                                      const SystemGraphicsData* );
     117             :     virtual SalBitmap*          CreateSalBitmap();
     118             : 
     119             :     virtual void                Yield( bool bWait, bool bHandleAllCurrentEvents );
     120             :     virtual bool                AnyInput( sal_uInt16 nType );
     121             : 
     122             :     virtual GenPspGraphics     *CreatePrintGraphics();
     123             : 
     124           0 :     virtual bool hasNativeFileSelection() const { return true; }
     125             : 
     126             :     virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
     127             :         createFilePicker( const com::sun::star::uno::Reference<
     128             :                               com::sun::star::uno::XComponentContext >& );
     129             :     virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker2 >
     130             :         createFolderPicker( const com::sun::star::uno::Reference<
     131             :                                 com::sun::star::uno::XComponentContext >& );
     132             : 
     133             :     void                        RemoveTimer (SalTimer *pTimer);
     134             : 
     135             :     // for managing a mirror of the in-flight un-dispatched gdk event queue
     136             :     void                        addEvent( sal_uInt16 nMask );
     137             :     void                        subtractEvent( sal_uInt16 nMask );
     138             : 
     139             :     boost::shared_ptr<vcl::unx::GtkPrintWrapper> getPrintWrapper() const;
     140             :   private:
     141             :     std::vector<GtkSalTimer *>  m_aTimers;
     142             :     bool                        IsTimerExpired();
     143             : 
     144             :     mutable boost::shared_ptr<vcl::unx::GtkPrintWrapper> m_pPrintWrapper;
     145             : };
     146             : 
     147             : #endif // _VCL_GTKINST_HXX
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10