LCOV - code coverage report
Current view: top level - toolkit/source/awt - vclxprinter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 201 0.0 %
Date: 2012-08-25 Functions: 0 43 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 517 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <toolkit/awt/vclxprinter.hxx>
      30                 :            : #include <toolkit/helper/macros.hxx>
      31                 :            : #include <cppuhelper/typeprovider.hxx>
      32                 :            : #include <rtl/memory.h>
      33                 :            : #include <rtl/uuid.h>
      34                 :            : 
      35                 :            : 
      36                 :            : #include <vcl/print.hxx>
      37                 :            : #include <vcl/jobset.hxx>
      38                 :            : #include <vcl/svapp.hxx>
      39                 :            : 
      40                 :            : #include <tools/debug.hxx>
      41                 :            : #include <tools/stream.hxx>
      42                 :            : 
      43                 :            : #include <toolkit/awt/vclxdevice.hxx>
      44                 :            : 
      45                 :            : 
      46                 :            : #define BINARYSETUPMARKER   0x23864691
      47                 :            : 
      48                 :            : #define PROPERTY_Orientation    0
      49                 :            : #define PROPERTY_Horizontal     1
      50                 :            : 
      51                 :          0 : ::com::sun::star::beans::Property* ImplGetProperties( sal_uInt16& rElementCount )
      52                 :            : {
      53                 :            :     static ::com::sun::star::beans::Property* pProperties = NULL;
      54                 :            :     static sal_uInt16 nElements = 0;
      55         [ #  # ]:          0 :     if( !pProperties )
      56                 :            :     {
      57 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      58         [ #  # ]:          0 :         if( !pProperties )
      59                 :            :         {
      60                 :            :             static ::com::sun::star::beans::Property aPropTable[] =
      61                 :            :             {
      62         [ #  # ]:          0 :                 ::com::sun::star::beans::Property( ::rtl::OUString("Orientation"), PROPERTY_Orientation, ::getCppuType((const sal_Int16*)0), 0 ),
      63         [ #  # ]:          0 :                 ::com::sun::star::beans::Property( ::rtl::OUString("Horizontal"), PROPERTY_Horizontal, ::getBooleanCppuType(), 0 )
      64 [ #  # ][ #  # ]:          0 :             };
           [ #  #  #  #  
           #  # ][ #  # ]
      65                 :          0 :             pProperties = aPropTable;
      66                 :          0 :             nElements = sizeof( aPropTable ) / sizeof( ::com::sun::star::beans::Property );
      67         [ #  # ]:          0 :         }
      68                 :            :     }
      69                 :          0 :     rElementCount = nElements;
      70                 :          0 :     return pProperties;
      71                 :            : }
      72                 :            : 
      73                 :            : //  ----------------------------------------------------
      74                 :            : //  class VCLXPrinterPropertySet
      75                 :            : //  ----------------------------------------------------
      76                 :            : 
      77                 :            : // ::com::sun::star::uno::XInterface
      78                 :          0 : ::com::sun::star::uno::Any VCLXPrinterPropertySet::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
      79                 :            : {
      80                 :            :     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
      81                 :            :                                         (static_cast< ::com::sun::star::beans::XMultiPropertySet* >(this)),
      82                 :            :                                         (static_cast< ::com::sun::star::beans::XFastPropertySet* >(this)),
      83                 :            :                                         (static_cast< ::com::sun::star::beans::XPropertySet* >((::cppu::OPropertySetHelper*) this) ),
      84                 :            :                                         (static_cast< ::com::sun::star::awt::XPrinterPropertySet* >(this)),
      85         [ #  # ]:          0 :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
      86 [ #  # ][ #  # ]:          0 :     return (aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface( rType ));
      87                 :            : }
      88                 :            : 
      89                 :            : // ::com::sun::star::lang::XTypeProvider
      90 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_START( VCLXPrinterPropertySet )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      91         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>* ) NULL ),
      92         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>* ) NULL ),
      93         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>* ) NULL ),
      94         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinterPropertySet>* ) NULL )
      95 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_END
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      96                 :            : 
      97                 :          0 : VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
      98                 :            :     : OPropertySetHelper( BrdcstHelper )
      99 [ #  # ][ #  # ]:          0 :     , mpPrinter( new Printer( rPrinterName ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     100                 :            : {
     101         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     102                 :            : 
     103                 :          0 :     mnOrientation = 0;
     104         [ #  # ]:          0 :     mbHorizontal = sal_False;
     105                 :          0 : }
     106                 :            : 
     107 [ #  # ][ #  # ]:          0 : VCLXPrinterPropertySet::~VCLXPrinterPropertySet()
                 [ #  # ]
     108                 :            : {
     109         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     110 [ #  # ][ #  # ]:          0 :     mpPrinter.reset();
     111         [ #  # ]:          0 : }
     112                 :            : 
     113                 :          0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >  VCLXPrinterPropertySet::GetDevice()
     114                 :            : {
     115         [ #  # ]:          0 :     if ( !mxPrnDevice.is() )
     116                 :            :     {
     117         [ #  # ]:          0 :         VCLXDevice* pDev = new VCLXDevice;
     118                 :          0 :         pDev->SetOutputDevice( GetPrinter() );
     119                 :          0 :         mxPrnDevice = pDev;
     120                 :            :     }
     121                 :          0 :     return mxPrnDevice;
     122                 :            : }
     123                 :            : 
     124                 :          0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXPrinterPropertySet::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
     125                 :            : {
     126 [ #  # ][ #  # ]:          0 :     static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >  xInfo( createPropertySetInfo( getInfoHelper() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     127                 :          0 :     return xInfo;
     128                 :            : }
     129                 :            : 
     130                 :          0 : ::cppu::IPropertyArrayHelper& VCLXPrinterPropertySet::getInfoHelper()
     131                 :            : {
     132                 :            :     static ::cppu::OPropertyArrayHelper* pPropertyArrayHelper = NULL;
     133         [ #  # ]:          0 :     if ( !pPropertyArrayHelper )
     134                 :            :     {
     135 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     136         [ #  # ]:          0 :         if( !pPropertyArrayHelper )
     137                 :            :         {
     138                 :            :             sal_uInt16 nElements;
     139         [ #  # ]:          0 :             ::com::sun::star::beans::Property* pProps = ImplGetProperties( nElements );
     140         [ #  # ]:          0 :             pPropertyArrayHelper = new ::cppu::OPropertyArrayHelper( pProps, nElements, sal_False );
     141         [ #  # ]:          0 :         }
     142                 :            :     }
     143                 :          0 :     return *pPropertyArrayHelper ;
     144                 :            : }
     145                 :            : 
     146                 :          0 : sal_Bool VCLXPrinterPropertySet::convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException)
     147                 :            : {
     148         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     149                 :            : 
     150                 :          0 :     sal_Bool bDifferent = sal_False;
     151      [ #  #  # ]:          0 :     switch ( nHandle )
     152                 :            :     {
     153                 :            :         case PROPERTY_Orientation:
     154                 :            :         {
     155                 :            :             sal_Int16 n;
     156 [ #  # ][ #  # ]:          0 :             if( ( rValue >>= n ) && ( n != mnOrientation ) )
                 [ #  # ]
     157                 :            :             {
     158         [ #  # ]:          0 :                 rConvertedValue <<= n;
     159         [ #  # ]:          0 :                 rOldValue <<= mnOrientation;
     160                 :          0 :                 bDifferent = sal_True;
     161                 :            :             }
     162                 :            :         }
     163                 :          0 :         break;
     164                 :            :         case PROPERTY_Horizontal:
     165                 :            :         {
     166                 :            :             sal_Bool b;
     167 [ #  # ][ #  # ]:          0 :             if( ( rValue >>= b ) && ( b != mbHorizontal ) )
                 [ #  # ]
     168                 :            :             {
     169         [ #  # ]:          0 :                 rConvertedValue <<= b;
     170         [ #  # ]:          0 :                 rOldValue <<= mbHorizontal;
     171                 :          0 :                 bDifferent = sal_True;
     172                 :            :             }
     173                 :            :         }
     174                 :          0 :         break;
     175                 :            :         default:
     176                 :            :         {
     177                 :            :             OSL_FAIL( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
     178                 :            :         }
     179                 :            :     }
     180         [ #  # ]:          0 :     return bDifferent;
     181                 :            : }
     182                 :            : 
     183                 :          0 : void VCLXPrinterPropertySet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
     184                 :            : {
     185         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     186                 :            : 
     187      [ #  #  # ]:          0 :     switch( nHandle )
     188                 :            :     {
     189                 :            :         case PROPERTY_Orientation:
     190                 :            :         {
     191                 :          0 :             rValue >>= mnOrientation;
     192                 :            :         }
     193                 :          0 :         break;
     194                 :            :         case PROPERTY_Horizontal:
     195                 :            :         {
     196                 :          0 :             rValue >>= mbHorizontal;
     197                 :            :         }
     198                 :          0 :         break;
     199                 :            :         default:
     200                 :            :         {
     201                 :            :             OSL_FAIL( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
     202                 :            :         }
     203         [ #  # ]:          0 :     }
     204                 :          0 : }
     205                 :            : 
     206                 :          0 : void VCLXPrinterPropertySet::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const
     207                 :            : {
     208         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( ((VCLXPrinterPropertySet*)this)->Mutex );
     209                 :            : 
     210      [ #  #  # ]:          0 :     switch( nHandle )
     211                 :            :     {
     212                 :            :         case PROPERTY_Orientation:
     213         [ #  # ]:          0 :             rValue <<= mnOrientation;
     214                 :          0 :         break;
     215                 :            :         case PROPERTY_Horizontal:
     216         [ #  # ]:          0 :             rValue <<= mbHorizontal;
     217                 :          0 :         break;
     218                 :            :         default:
     219                 :            :         {
     220                 :            :             OSL_FAIL( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
     221                 :            :         }
     222         [ #  # ]:          0 :     }
     223                 :          0 : }
     224                 :            : 
     225                 :            : // ::com::sun::star::awt::XPrinterPropertySet
     226                 :          0 : void VCLXPrinterPropertySet::setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     227                 :            : {
     228         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     229                 :            : 
     230                 :          0 :     ::com::sun::star::uno::Any aValue;
     231         [ #  # ]:          0 :     aValue <<= bHorizontal;
     232 [ #  # ][ #  # ]:          0 :     setFastPropertyValue( PROPERTY_Horizontal, aValue );
     233                 :          0 : }
     234                 :            : 
     235                 :          0 : ::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterPropertySet::getFormDescriptions(  ) throw(::com::sun::star::uno::RuntimeException)
     236                 :            : {
     237         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     238                 :            : 
     239 [ #  # ][ #  # ]:          0 :     sal_uInt16 nPaperBinCount = GetPrinter()->GetPaperBinCount();
     240         [ #  # ]:          0 :     ::com::sun::star::uno::Sequence< ::rtl::OUString >  aDescriptions( nPaperBinCount );
     241         [ #  # ]:          0 :     for ( sal_uInt16 n = 0; n < nPaperBinCount; n++ )
     242                 :            :     {
     243                 :            :         // Format: <DisplayFormName;FormNameId;DisplayPaperBinName;PaperBinNameId;DisplayPaperName;PaperNameId>
     244         [ #  # ]:          0 :         String aDescr( RTL_CONSTASCII_USTRINGPARAM( "*;*;" ) );
     245 [ #  # ][ #  # ]:          0 :         aDescr += GetPrinter()->GetPaperBinName( n );
                 [ #  # ]
     246         [ #  # ]:          0 :         aDescr += ';';
     247         [ #  # ]:          0 :         aDescr += n;
     248         [ #  # ]:          0 :         aDescr.AppendAscii( ";*;*", 4 );
     249                 :            : 
     250 [ #  # ][ #  # ]:          0 :         aDescriptions.getArray()[n] = aDescr;
     251         [ #  # ]:          0 :     }
     252         [ #  # ]:          0 :     return aDescriptions;
     253                 :            : }
     254                 :            : 
     255                 :          0 : void VCLXPrinterPropertySet::selectForm( const ::rtl::OUString& rFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     256                 :            : {
     257         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     258                 :            : 
     259                 :          0 :     sal_Int32 nIndex = 0;
     260                 :            :     sal_uInt16 nPaperBin = sal::static_int_cast< sal_uInt16 >(
     261                 :          0 :         rFormDescription.getToken( 3, ';', nIndex ).toInt32());
     262 [ #  # ][ #  # ]:          0 :     GetPrinter()->SetPaperBin( nPaperBin );
                 [ #  # ]
     263                 :          0 : }
     264                 :            : 
     265                 :          0 : ::com::sun::star::uno::Sequence< sal_Int8 > VCLXPrinterPropertySet::getBinarySetup(  ) throw(::com::sun::star::uno::RuntimeException)
     266                 :            : {
     267         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     268                 :            : 
     269         [ #  # ]:          0 :     SvMemoryStream aMem;
     270         [ #  # ]:          0 :     aMem << sal_uInt32(BINARYSETUPMARKER);
     271 [ #  # ][ #  # ]:          0 :     aMem << GetPrinter()->GetJobSetup();
     272 [ #  # ][ #  # ]:          0 :     return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
         [ #  # ][ #  # ]
     273                 :            : }
     274                 :            : 
     275                 :          0 : void VCLXPrinterPropertySet::setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     276                 :            : {
     277         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     278                 :            : 
     279         [ #  # ]:          0 :     SvMemoryStream aMem( (char*) data.getConstArray(), data.getLength(), STREAM_READ );
     280                 :            :     sal_uInt32 nMarker;
     281         [ #  # ]:          0 :     aMem >> nMarker;
     282                 :            :     DBG_ASSERT( nMarker == BINARYSETUPMARKER, "setBinarySetup - invalid!" );
     283         [ #  # ]:          0 :     if ( nMarker == BINARYSETUPMARKER )
     284                 :            :     {
     285         [ #  # ]:          0 :         JobSetup aSetup;
     286         [ #  # ]:          0 :         aMem >> aSetup;
     287 [ #  # ][ #  # ]:          0 :         GetPrinter()->SetJobSetup( aSetup );
                 [ #  # ]
     288 [ #  # ][ #  # ]:          0 :     }
     289                 :          0 : }
     290                 :            : 
     291                 :            : 
     292                 :            : //  ----------------------------------------------------
     293                 :            : //  class VCLXPrinter
     294                 :            : //  ----------------------------------------------------
     295                 :          0 : VCLXPrinter::VCLXPrinter( const String& rPrinterName )
     296 [ #  # ][ #  # ]:          0 :     : VCLXPrinterPropertySet( rPrinterName )
                 [ #  # ]
     297                 :            : {
     298                 :          0 : }
     299                 :            : 
     300 [ #  # ][ #  # ]:          0 : VCLXPrinter::~VCLXPrinter()
         [ #  # ][ #  # ]
     301                 :            : {
     302         [ #  # ]:          0 : }
     303                 :            : 
     304                 :            : // ::com::sun::star::uno::XInterface
     305                 :          0 : ::com::sun::star::uno::Any VCLXPrinter::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
     306                 :            : {
     307                 :            :     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
     308         [ #  # ]:          0 :                                         (static_cast< ::com::sun::star::awt::XPrinter* >(this)) );
     309                 :            : 
     310         [ #  # ]:          0 :     if ( !aRet.hasValue() )
     311         [ #  # ]:          0 :         aRet = VCLXPrinterPropertySet::queryInterface( rType );
     312                 :            : 
     313 [ #  # ][ #  # ]:          0 :     return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
     314                 :            : }
     315                 :            : 
     316                 :            : // ::com::sun::star::lang::XTypeProvider
     317 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_START( VCLXPrinter )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     318         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter>* ) NULL ),
     319                 :            :     VCLXPrinterPropertySet::getTypes()
     320 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_END
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     321                 :            : 
     322                 :          0 : sal_Bool VCLXPrinter::start( const ::rtl::OUString& /*rJobName*/, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     323                 :            : {
     324         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     325                 :            : 
     326                 :          0 :     sal_Bool bDone = sal_True;
     327         [ #  # ]:          0 :     if ( mpListener.get() )
     328                 :            :     {
     329         [ #  # ]:          0 :         maInitJobSetup = mpPrinter->GetJobSetup();
     330 [ #  # ][ #  # ]:          0 :         mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) );
                 [ #  # ]
     331                 :            :     }
     332                 :            : 
     333         [ #  # ]:          0 :     return bDone;
     334                 :            : }
     335                 :            : 
     336                 :          0 : void VCLXPrinter::end(  ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
     337                 :            : {
     338         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     339                 :            : 
     340         [ #  # ]:          0 :     if ( mpListener.get() )
     341                 :            :     {
     342 [ #  # ][ #  # ]:          0 :         Printer::PrintJob( mpListener, maInitJobSetup );
                 [ #  # ]
     343         [ #  # ]:          0 :         mpListener.reset();
     344         [ #  # ]:          0 :     }
     345                 :          0 : }
     346                 :            : 
     347                 :          0 : void VCLXPrinter::terminate(  ) throw(::com::sun::star::uno::RuntimeException)
     348                 :            : {
     349         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     350                 :            : 
     351 [ #  # ][ #  # ]:          0 :     mpListener.reset();
     352                 :          0 : }
     353                 :            : 
     354                 :          0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage(  ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
     355                 :            : {
     356         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     357                 :            : 
     358         [ #  # ]:          0 :     if ( mpListener.get() )
     359                 :            :     {
     360         [ #  # ]:          0 :         mpListener->StartPage();
     361                 :            :     }
     362 [ #  # ][ #  # ]:          0 :     return GetDevice();
     363                 :            : }
     364                 :            : 
     365                 :          0 : void VCLXPrinter::endPage(  ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
     366                 :            : {
     367         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     368                 :            : 
     369         [ #  # ]:          0 :     if ( mpListener.get() )
     370                 :            :     {
     371         [ #  # ]:          0 :         mpListener->EndPage();
     372         [ #  # ]:          0 :     }
     373                 :          0 : }
     374                 :            : 
     375                 :            : 
     376                 :            : //  ----------------------------------------------------
     377                 :            : //  class VCLXInfoPrinter
     378                 :            : //  ----------------------------------------------------
     379                 :            : 
     380                 :          0 : VCLXInfoPrinter::VCLXInfoPrinter( const String& rPrinterName )
     381         [ #  # ]:          0 :     : VCLXPrinterPropertySet( rPrinterName )
     382                 :            : {
     383                 :          0 : }
     384                 :            : 
     385 [ #  # ][ #  # ]:          0 : VCLXInfoPrinter::~VCLXInfoPrinter()
     386                 :            : {
     387         [ #  # ]:          0 : }
     388                 :            : 
     389                 :            : // ::com::sun::star::uno::XInterface
     390                 :          0 : ::com::sun::star::uno::Any VCLXInfoPrinter::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
     391                 :            : {
     392                 :            :     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
     393         [ #  # ]:          0 :                                         (static_cast< ::com::sun::star::awt::XInfoPrinter* >(this)) );
     394                 :            : 
     395         [ #  # ]:          0 :     if ( !aRet.hasValue() )
     396         [ #  # ]:          0 :         aRet = VCLXPrinterPropertySet::queryInterface( rType );
     397                 :            : 
     398 [ #  # ][ #  # ]:          0 :     return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
     399                 :            : }
     400                 :            : 
     401                 :            : // ::com::sun::star::lang::XTypeProvider
     402 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_START( VCLXInfoPrinter )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     403         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter>* ) NULL ),
     404                 :            :     VCLXPrinterPropertySet::getTypes()
     405 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_END
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     406                 :            : 
     407                 :            : // ::com::sun::star::awt::XInfoPrinter
     408                 :          0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXInfoPrinter::createDevice(  ) throw(::com::sun::star::uno::RuntimeException)
     409                 :            : {
     410         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( Mutex );
     411                 :            : 
     412 [ #  # ][ #  # ]:          0 :     return GetDevice();
     413                 :            : }
     414                 :            : 
     415                 :            : //  ----------------------------------------------------
     416                 :            : //  class VCLXPrinterServer
     417                 :            : //  ----------------------------------------------------
     418                 :            : 
     419                 :            : // ::com::sun::star::uno::XInterface
     420                 :          0 : ::com::sun::star::uno::Any VCLXPrinterServer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
     421                 :            : {
     422                 :            :     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
     423         [ #  # ]:          0 :                                         (static_cast< ::com::sun::star::awt::XPrinterServer* >(this)) );
     424 [ #  # ][ #  # ]:          0 :     return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
     425                 :            : }
     426                 :            : 
     427                 :            : // ::com::sun::star::lang::XTypeProvider
     428 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_START( VCLXPrinterServer )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     429         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinterServer>* ) NULL )
     430 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_END
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     431                 :            : 
     432                 :            : // ::com::sun::star::awt::XPrinterServer
     433                 :          0 : ::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterServer::getPrinterNames(  ) throw(::com::sun::star::uno::RuntimeException)
     434                 :            : {
     435                 :          0 :     const std::vector<rtl::OUString>& rQueues = Printer::GetPrinterQueues();
     436                 :          0 :     sal_uInt32 nPrinters = rQueues.size();
     437                 :            : 
     438                 :          0 :     ::com::sun::star::uno::Sequence< ::rtl::OUString >  aNames( nPrinters );
     439         [ #  # ]:          0 :     for ( sal_uInt32 n = 0; n < nPrinters; n++ )
     440         [ #  # ]:          0 :         aNames.getArray()[n] = rQueues[n];
     441                 :            : 
     442                 :          0 :     return aNames;
     443                 :            : }
     444                 :            : 
     445                 :          0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > VCLXPrinterServer::createPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
     446                 :            : {
     447                 :          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > xP;
     448 [ #  # ][ #  # ]:          0 :     xP = new VCLXPrinter( rPrinterName );
         [ #  # ][ #  # ]
     449                 :          0 :     return xP;
     450                 :            : }
     451                 :            : 
     452                 :          0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > VCLXPrinterServer::createInfoPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
     453                 :            : {
     454                 :          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > xP;
     455 [ #  # ][ #  # ]:          0 :     xP = new VCLXInfoPrinter( rPrinterName );
         [ #  # ][ #  # ]
     456                 :          0 :     return xP;
     457                 :            : }
     458                 :            : 
     459                 :            : 
     460                 :            : 
     461                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10