LCOV - code coverage report
Current view: top level - include/toolkit/awt - vclxprinter.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 32 3.1 %
Date: 2015-06-13 12:38:46 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/XServiceInfo.hpp>
      29             : #include <com/sun/star/lang/XTypeProvider.hpp>
      30             : #include <cppuhelper/weak.hxx>
      31             : #include <osl/mutex.hxx>
      32             : 
      33             : #include <toolkit/helper/mutexandbroadcasthelper.hxx>
      34             : #include <cppuhelper/propshlp.hxx>
      35             : #include <cppuhelper/implbase.hxx>
      36             : #include <comphelper/uno3.hxx>
      37             : 
      38             : #include <vcl/oldprintadaptor.hxx>
      39             : 
      40             : // relevant properties for the printer:
      41             : /*
      42             :      sal_Bool   Horizontal
      43             :      sal_uInt16 CopyCount;
      44             :      sal_Bool   Collate;
      45             :      String FormDescriptor;
      46             :      sal_uInt16 Orientation;    // PORTRAIT, LANDSCAPE
      47             : */
      48             : 
      49             : 
      50             : //  class VCLXPrinterPropertySet
      51             : 
      52             : 
      53             : typedef ::cppu::WeakImplHelper <   ::com::sun::star::awt::XPrinterPropertySet
      54             :                                 >   VCLXPrinterPropertySet_Base;
      55             : class VCLXPrinterPropertySet    :public VCLXPrinterPropertySet_Base
      56             :                                 ,public MutexAndBroadcastHelper
      57             :                                 ,public ::cppu::OPropertySetHelper
      58             : {
      59             : protected:
      60             :     VclPtr<Printer>             mxPrinter;
      61             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >  mxPrnDevice;
      62             : 
      63             :     sal_Int16                   mnOrientation;
      64             :     bool                        mbHorizontal;
      65             : public:
      66             :     VCLXPrinterPropertySet( const OUString& rPrinterName );
      67             :     virtual ~VCLXPrinterPropertySet();
      68             : 
      69           0 :     Printer*                    GetPrinter() const { return mxPrinter.get(); }
      70             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >  GetDevice();
      71             : 
      72             :     // ::com::sun::star::uno::XInterface
      73             :     DECLARE_XINTERFACE();
      74             : 
      75             :     // ::com::sun::star::lang::XTypeProvider
      76             :     DECLARE_XTYPEPROVIDER();
      77             : 
      78             :     // ::com::sun::star::beans::XPropertySet
      79             :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      80           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 ); }
      81           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 ); }
      82           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 ); }
      83           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 ); }
      84           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 ); }
      85           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 ); }
      86             : 
      87             :     // ::cppu::OPropertySetHelper
      88             :     ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
      89             :     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;
      90             :     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;
      91             :     using cppu::OPropertySetHelper::getFastPropertyValue;
      92             :     void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
      93             : 
      94             :     // ::com::sun::star::awt::XPrinterPropertySet
      95             :     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;
      96             :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFormDescriptions(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             :     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;
      98             :     ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             :     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;
     100             : };
     101             : 
     102             : 
     103             : //  class VCLXPrinter
     104             : 
     105             : 
     106             : typedef ::cppu::ImplInheritanceHelper  <   VCLXPrinterPropertySet
     107             :                                         ,   ::com::sun::star::awt::XPrinter
     108             :                                         >   VCLXPrinter_Base;
     109             : class VCLXPrinter:  public VCLXPrinter_Base
     110             : {
     111             :     std::shared_ptr<vcl::OldStylePrintAdaptor>    mxListener;
     112             :     JobSetup                                      maInitJobSetup;
     113             : public:
     114             :                     VCLXPrinter( const OUString& rPrinterName );
     115             :                     virtual ~VCLXPrinter();
     116             : 
     117             :     // ::com::sun::star::beans::XPropertySet
     118           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(); }
     119           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 ); }
     120           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 ); }
     121           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 ); }
     122           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 ); }
     123           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 ); }
     124           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 ); }
     125             : 
     126             :     // ::com::sun::star::awt::XPrinterPropertySet
     127           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 ); }
     128           0 :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFormDescriptions(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getFormDescriptions(); }
     129           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 ); }
     130           0 :     ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getBinarySetup(); }
     131           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 ); }
     132             : 
     133             :     // ::com::sun::star::awt::XPrinter
     134             :     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;
     135             :     void SAL_CALL end(  ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     136             :     void SAL_CALL terminate(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     137             :     ::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;
     138             :     void SAL_CALL endPage(  ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     139             : };
     140             : 
     141             : 
     142             : //  class VCLXInfoPrinter
     143             : 
     144             : 
     145             : typedef ::cppu::ImplInheritanceHelper  <   VCLXPrinterPropertySet
     146             :                                         ,   ::com::sun::star::awt::XInfoPrinter
     147             :                                         >   VCLXInfoPrinter_Base;
     148             : class VCLXInfoPrinter:  public VCLXInfoPrinter_Base
     149             : {
     150             : public:
     151             :                         VCLXInfoPrinter( const OUString& rPrinterName );
     152             :                         virtual ~VCLXInfoPrinter();
     153             : 
     154             :     // ::com::sun::star::beans::XPropertySet
     155           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(); }
     156           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 ); }
     157           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 ); }
     158           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 ); }
     159           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 ); }
     160           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 ); }
     161           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 ); }
     162             : 
     163             :     // ::com::sun::star::awt::XPrinterPropertySet
     164           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 ); }
     165           0 :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFormDescriptions(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getFormDescriptions(); }
     166           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 ); }
     167           0 :     ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return VCLXPrinterPropertySet::getBinarySetup(); }
     168           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 ); }
     169             : 
     170             :     // ::com::sun::star::awt::XInfoPrinter
     171             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createDevice(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     172             : };
     173             : 
     174             : 
     175             : //  class VCLXPrinterServer
     176             : 
     177             : 
     178             : typedef ::cppu::WeakImplHelper <   ::com::sun::star::awt::XPrinterServer,
     179             :                                    css::lang::XServiceInfo
     180             :                                 >   VCLXPrinterServer_Base;
     181           3 : class VCLXPrinterServer : public VCLXPrinterServer_Base
     182             : {
     183             : public:
     184             :     // ::com::sun::star::awt::XPrinterServer
     185             :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL getPrinterNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     186             :     ::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;
     187             :     ::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;
     188             : 
     189             :     OUString SAL_CALL getImplementationName()
     190             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     191             : 
     192             :     sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
     193             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     194             : 
     195             :     css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
     196             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     197             : };
     198             : 
     199             : #endif // INCLUDED_TOOLKIT_AWT_VCLXPRINTER_HXX
     200             : 
     201             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11