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

Generated by: LCOV version 1.10