LCOV - code coverage report
Current view: top level - include/toolkit/awt - vclxprinter.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 32 3.1 %
Date: 2014-11-03 Functions: 3 34 8.8 %
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_TOOLKIT_AWT_VCLXPRINTER_HXX
      21             : #define INCLUDED_TOOLKIT_AWT_VCLXPRINTER_HXX
      22             : 
      23             : 
      24             : #include <com/sun/star/awt/XPrinterPropertySet.hpp>
      25             : #include <com/sun/star/awt/XPrinter.hpp>
      26             : #include <com/sun/star/awt/XPrinterServer.hpp>
      27             : #include <com/sun/star/awt/XInfoPrinter.hpp>
      28             : #include <com/sun/star/lang/XTypeProvider.hpp>
      29             : #include <cppuhelper/weak.hxx>
      30             : #include <osl/mutex.hxx>
      31             : 
      32             : #include <toolkit/helper/mutexandbroadcasthelper.hxx>
      33             : #include <cppuhelper/propshlp.hxx>
      34             : #include <cppuhelper/implbase1.hxx>
      35             : #include <comphelper/uno3.hxx>
      36             : 
      37             : #include <vcl/oldprintadaptor.hxx>
      38             : 
      39             : // relevant properties for the printer:
      40             : /*
      41             :      sal_Bool   Horizontal
      42             :      sal_uInt16 CopyCount;
      43             :      sal_Bool   Collate;
      44             :      String FormDescriptor;
      45             :      sal_uInt16 Orientation;    // PORTRAIT, LANDSCAPE
      46             : */
      47             : 
      48             : 
      49             : //  class VCLXPrinterPropertySet
      50             : 
      51             : 
      52             : typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::awt::XPrinterPropertySet
      53             :                                 >   VCLXPrinterPropertySet_Base;
      54             : class VCLXPrinterPropertySet    :public VCLXPrinterPropertySet_Base
      55             :                                 ,public MutexAndBroadcastHelper
      56             :                                 ,public ::cppu::OPropertySetHelper
      57             : {
      58             : protected:
      59             :     boost::shared_ptr<Printer>                      mpPrinter;
      60             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >  mxPrnDevice;
      61             : 
      62             :     sal_Int16                   mnOrientation;
      63             :     bool                    mbHorizontal;
      64             : public:
      65             :     VCLXPrinterPropertySet( const OUString& rPrinterName );
      66             :     virtual ~VCLXPrinterPropertySet();
      67             : 
      68           0 :     Printer*                    GetPrinter() const { return mpPrinter.get(); }
      69             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >  GetDevice();
      70             : 
      71             :     // ::com::sun::star::uno::XInterface
      72             :     DECLARE_XINTERFACE();
      73             : 
      74             :     // ::com::sun::star::lang::XTypeProvider
      75             :     DECLARE_XTYPEPROVIDER();
      76             : 
      77             :     // ::com::sun::star::beans::XPropertySet
      78             :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      79           0 :     void SAL_CALL setPropertyValue( const OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { OPropertySetHelper::setPropertyValue( rPropertyName, aValue ); }
      80           0 :     ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return OPropertySetHelper::getPropertyValue( rPropertyName ); }
      81           0 :     void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { OPropertySetHelper::addPropertyChangeListener( rPropertyName, rxListener ); }
      82           0 :     void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { OPropertySetHelper::removePropertyChangeListener( rPropertyName, rxListener ); }
      83           0 :     void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { OPropertySetHelper::addVetoableChangeListener( rPropertyName, rxListener ); }
      84           0 :     void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { OPropertySetHelper::removeVetoableChangeListener( rPropertyName, rxListener ); }
      85             : 
      86             :     // ::cppu::OPropertySetHelper
      87             :     ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
      88             :     sal_Bool SAL_CALL 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) SAL_OVERRIDE;
      89             :     void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
      90             :     using cppu::OPropertySetHelper::getFastPropertyValue;
      91             :     void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
      92             : 
      93             :     // ::com::sun::star::awt::XPrinterPropertySet
      94             :     void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFormDescriptions(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             :     void SAL_CALL selectForm( const OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             :     ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             :     void SAL_CALL 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, std::exception) SAL_OVERRIDE;
      99             : };
     100             : 
     101             : 
     102             : //  class VCLXPrinter
     103             : 
     104             : 
     105             : typedef ::cppu::ImplInheritanceHelper1  <   VCLXPrinterPropertySet
     106             :                                         ,   ::com::sun::star::awt::XPrinter
     107             :                                         >   VCLXPrinter_Base;
     108             : class VCLXPrinter:  public VCLXPrinter_Base
     109             : {
     110             :     boost::shared_ptr<vcl::OldStylePrintAdaptor>    mpListener;
     111             :     JobSetup                                        maInitJobSetup;
     112             : public:
     113             :                     VCLXPrinter( const OUString& rPrinterName );
     114             :                     virtual ~VCLXPrinter();
     115             : 
     116             :     // ::com::sun::star::beans::XPropertySet
     117           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getPropertySetInfo(); }
     118           0 :     void SAL_CALL setPropertyValue( const OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); }
     119           0 :     ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); }
     120           0 :     void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); }
     121           0 :     void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); }
     122           0 :     void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); }
     123           0 :     void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); }
     124             : 
     125             :     // ::com::sun::star::awt::XPrinterPropertySet
     126           0 :     void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); }
     127           0 :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFormDescriptions(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getFormDescriptions(); }
     128           0 :     void SAL_CALL selectForm( const OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::selectForm( aFormDescription ); }
     129           0 :     ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getBinarySetup(); }
     130           0 :     void SAL_CALL 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, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::setBinarySetup( data ); }
     131             : 
     132             :     // ::com::sun::star::awt::XPrinter
     133             :     sal_Bool SAL_CALL start( const OUString& nJobName, sal_Int16 nCopies, sal_Bool nCollate ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             :     void SAL_CALL end(  ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     135             :     void SAL_CALL terminate(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     136             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL startPage(  ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     137             :     void SAL_CALL endPage(  ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     138             : };
     139             : 
     140             : 
     141             : //  class VCLXInfoPrinter
     142             : 
     143             : 
     144             : typedef ::cppu::ImplInheritanceHelper1  <   VCLXPrinterPropertySet
     145             :                                         ,   ::com::sun::star::awt::XInfoPrinter
     146             :                                         >   VCLXInfoPrinter_Base;
     147             : class VCLXInfoPrinter:  public VCLXInfoPrinter_Base
     148             : {
     149             : public:
     150             :                         VCLXInfoPrinter( const OUString& rPrinterName );
     151             :                         virtual ~VCLXInfoPrinter();
     152             : 
     153             :     // ::com::sun::star::beans::XPropertySet
     154           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getPropertySetInfo(); }
     155           0 :     void SAL_CALL setPropertyValue( const OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); }
     156           0 :     ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); }
     157           0 :     void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); }
     158           0 :     void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); }
     159           0 :     void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); }
     160           0 :     void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); }
     161             : 
     162             :     // ::com::sun::star::awt::XPrinterPropertySet
     163           0 :     void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); }
     164           0 :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFormDescriptions(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getFormDescriptions(); }
     165           0 :     void SAL_CALL selectForm( const OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::selectForm( aFormDescription ); }
     166           0 :     ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getBinarySetup(); }
     167           0 :     void SAL_CALL 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, std::exception) SAL_OVERRIDE { VCLXPrinterPropertySet::setBinarySetup( data ); }
     168             : 
     169             :     // ::com::sun::star::awt::XInfoPrinter
     170             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createDevice(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     171             : };
     172             : 
     173             : 
     174             : //  class VCLXPrinterServer
     175             : 
     176             : 
     177             : typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::awt::XPrinterServer
     178             :                                 >   VCLXPrinterServer_Base;
     179           6 : class VCLXPrinterServer : public VCLXPrinterServer_Base
     180             : {
     181             : public:
     182             :     // ::com::sun::star::awt::XPrinterServer
     183             :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL getPrinterNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     184             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > SAL_CALL createPrinter( const OUString& printerName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     185             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > SAL_CALL createInfoPrinter( const OUString& printerName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     186             : };
     187             : 
     188             : #endif // INCLUDED_TOOLKIT_AWT_VCLXPRINTER_HXX
     189             : 
     190             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10