LCOV - code coverage report
Current view: top level - vcl/inc/generic - geninst.h (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 4 13 30.8 %
Date: 2014-04-14 Functions: 3 7 42.9 %
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_GENERIC_GENINST_H
      21             : #define INCLUDED_VCL_INC_GENERIC_GENINST_H
      22             : 
      23             : #include <comphelper/solarmutex.hxx>
      24             : #include <tools/solar.h>
      25             : #include <osl/thread.hxx>
      26             : #include <vclpluginapi.h>
      27             : #include <salinst.hxx>
      28             : #include <saldatabasic.hxx>
      29             : #include <generic/genprn.h>
      30             : 
      31             : class VCL_DLLPUBLIC SalYieldMutexReleaser
      32             : {
      33             :     sal_uLong m_nYieldCount;
      34             : public:
      35             :     inline SalYieldMutexReleaser();
      36             :     inline ~SalYieldMutexReleaser();
      37             : };
      38             : 
      39           0 : inline SalYieldMutexReleaser::SalYieldMutexReleaser()
      40             : {
      41           0 :     m_nYieldCount = GetSalData()->m_pInstance->ReleaseYieldMutex();
      42           0 : }
      43             : 
      44           0 : inline SalYieldMutexReleaser::~SalYieldMutexReleaser()
      45             : {
      46           0 :     GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount );
      47           0 : }
      48             : 
      49             : class VCL_DLLPUBLIC SalYieldMutex : public comphelper::SolarMutex
      50             : {
      51             :     osl::Mutex m_mutex;
      52             : 
      53             : protected:
      54             :     sal_uIntPtr         mnCount;
      55             :     oslThreadIdentifier mnThreadId;
      56             : 
      57             : public:
      58             :                         SalYieldMutex();
      59             :                         virtual ~SalYieldMutex();
      60             : 
      61             :     virtual void        acquire() SAL_OVERRIDE;
      62             :     virtual void        release() SAL_OVERRIDE;
      63             :     virtual bool        tryToAcquire() SAL_OVERRIDE;
      64             : 
      65           2 :     sal_uIntPtr GetAcquireCount() const { return mnCount; }
      66           2 :     oslThreadIdentifier GetThreadId() const { return mnThreadId; }
      67             : };
      68             : 
      69             : /*
      70             :  * Abstract generic class to build vclplugin's instance classes from
      71             :  */
      72             : class GenPspGraphics;
      73             : class PhysicalFontCollection;
      74             : class VCL_DLLPUBLIC SalGenericInstance : public SalInstance
      75             : {
      76             : protected:
      77             :     bool           mbPrinterInit;
      78             :     SalYieldMutex *mpSalYieldMutex;
      79             : 
      80             : public:
      81           1 :     SalGenericInstance( SalYieldMutex* pMutex )
      82           1 :         : mbPrinterInit( false ), mpSalYieldMutex( pMutex ) {}
      83             :     virtual ~SalGenericInstance();
      84             : 
      85             :     // Yield mutex
      86             :     virtual comphelper::SolarMutex* GetYieldMutex() SAL_OVERRIDE;
      87             :     virtual sal_uIntPtr         ReleaseYieldMutex() SAL_OVERRIDE;
      88             :     virtual void                AcquireYieldMutex( sal_uIntPtr nCount ) SAL_OVERRIDE;
      89             :     virtual bool                CheckYieldMutex() SAL_OVERRIDE;
      90             : 
      91             :     // Printing
      92             :     virtual SalInfoPrinter*     CreateInfoPrinter      ( SalPrinterQueueInfo* pQueueInfo,
      93             :                                                          ImplJobSetup* pSetupData ) SAL_OVERRIDE;
      94             :     virtual void                DestroyInfoPrinter     ( SalInfoPrinter* pPrinter ) SAL_OVERRIDE;
      95             :     virtual SalPrinter*         CreatePrinter          ( SalInfoPrinter* pInfoPrinter ) SAL_OVERRIDE;
      96             :     virtual void                DestroyPrinter         ( SalPrinter* pPrinter ) SAL_OVERRIDE;
      97             :     virtual void                GetPrinterQueueInfo    ( ImplPrnQueueList* pList ) SAL_OVERRIDE;
      98             :     virtual void                GetPrinterQueueState   ( SalPrinterQueueInfo* pInfo ) SAL_OVERRIDE;
      99             :     virtual void                DeletePrinterQueueInfo ( SalPrinterQueueInfo* pInfo ) SAL_OVERRIDE;
     100             :     virtual OUString            GetDefaultPrinter() SAL_OVERRIDE;
     101             :     virtual void                PostPrintersChanged() = 0;
     102             :     virtual void                updatePrinterUpdate() SAL_OVERRIDE;
     103             :     virtual void                jobStartedPrinterUpdate() SAL_OVERRIDE;
     104             :     virtual void                jobEndedPrinterUpdate() SAL_OVERRIDE;
     105           0 :     bool isPrinterInit() const { return mbPrinterInit; }
     106             :     virtual GenPspGraphics     *CreatePrintGraphics() = 0;
     107             : 
     108             :     // prolly belongs somewhere else ... just a font help
     109             :     static void RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection );
     110             :     static int  FetchFontSubstitutionFlags();
     111             : 
     112             : protected:
     113             :     void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter,
     114             :                                   SalPrinterQueueInfo* pQueueInfo,
     115             :                                   ImplJobSetup* pSetupData );
     116             : };
     117             : 
     118           0 : inline SalGenericInstance *GetGenericInstance()
     119             : {
     120           0 :     return static_cast<SalGenericInstance *>(GetSalData()->m_pInstance);
     121             : }
     122             : 
     123             : #endif // INCLUDED_VCL_INC_GENERIC_GENINST_H
     124             : 
     125             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10