LCOV - code coverage report
Current view: top level - sc/inc - afmtuno.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 1 100.0 %
Date: 2015-06-13 12:38:46 Functions: 1 1 100.0 %
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_SC_INC_AFMTUNO_HXX
      21             : #define INCLUDED_SC_INC_AFMTUNO_HXX
      22             : 
      23             : #include <svl/lstner.hxx>
      24             : #include <svl/itemprop.hxx>
      25             : #include <com/sun/star/lang/XServiceInfo.hpp>
      26             : #include <com/sun/star/container/XContainer.hpp>
      27             : #include <com/sun/star/container/XIndexContainer.hpp>
      28             : #include <com/sun/star/container/XNameReplace.hpp>
      29             : #include <com/sun/star/container/XContainerListener.hpp>
      30             : #include <com/sun/star/container/XSet.hpp>
      31             : #include <com/sun/star/container/ContainerEvent.hpp>
      32             : #include <com/sun/star/container/XIndexReplace.hpp>
      33             : #include <com/sun/star/container/XNameContainer.hpp>
      34             : #include <com/sun/star/container/XNamed.hpp>
      35             : #include <com/sun/star/beans/XPropertySet.hpp>
      36             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      37             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      38             : #include <cppuhelper/implbase2.hxx>
      39             : #include <cppuhelper/implbase4.hxx>
      40             : #include <cppuhelper/implbase6.hxx>
      41             : 
      42             : class ScAutoFormatFieldObj;
      43             : class ScAutoFormatObj;
      44             : 
      45             : #define SC_AFMTOBJ_INVALID  USHRT_MAX
      46             : 
      47             : class ScAutoFormatsObj : public ::cppu::WeakImplHelper4<
      48             :                             ::com::sun::star::container::XNameContainer,
      49             :                             ::com::sun::star::container::XEnumerationAccess,
      50             :                             ::com::sun::star::container::XIndexAccess,
      51             :                             ::com::sun::star::lang::XServiceInfo >
      52             : {
      53             : private:
      54             :     static ScAutoFormatObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
      55             :     static ScAutoFormatObj* GetObjectByName_Impl(const OUString& aName);
      56             : 
      57             : public:
      58             :                             ScAutoFormatsObj();
      59             :     virtual                 ~ScAutoFormatsObj();
      60             : 
      61             :                             // XNameContainer
      62             :     virtual void SAL_CALL   insertByName( const OUString& aName,
      63             :                                 const ::com::sun::star::uno::Any& aElement )
      64             :                                     throw(::com::sun::star::lang::IllegalArgumentException,
      65             :                                         ::com::sun::star::container::ElementExistException,
      66             :                                         ::com::sun::star::lang::WrappedTargetException,
      67             :                                         ::com::sun::star::uno::RuntimeException,
      68             :                                         std::exception) SAL_OVERRIDE;
      69             :     virtual void SAL_CALL   removeByName( const OUString& Name )
      70             :                                 throw(::com::sun::star::container::NoSuchElementException,
      71             :                                     ::com::sun::star::lang::WrappedTargetException,
      72             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      73             : 
      74             :                             // XNameReplace
      75             :     virtual void SAL_CALL   replaceByName( const OUString& aName,
      76             :                                 const ::com::sun::star::uno::Any& aElement )
      77             :                                     throw(::com::sun::star::lang::IllegalArgumentException,
      78             :                                         ::com::sun::star::container::NoSuchElementException,
      79             :                                         ::com::sun::star::lang::WrappedTargetException,
      80             :                                         ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      81             : 
      82             :                             // XNameAccess
      83             :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
      84             :                                 throw(::com::sun::star::container::NoSuchElementException,
      85             :                                     ::com::sun::star::lang::WrappedTargetException,
      86             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      87             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
      88             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      89             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
      90             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      91             : 
      92             :                             // XElementAccess
      93             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
      94             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             :     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             : 
      97             :                             // XEnumerationAccess
      98             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
      99             :                             createEnumeration() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             : 
     101             :                             // XIndexAccess
     102             :     virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             :     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
     104             :                                 throw(::com::sun::star::lang::IndexOutOfBoundsException,
     105             :                                     ::com::sun::star::lang::WrappedTargetException,
     106             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     107             : 
     108             :                             // XServiceInfo
     109             :     virtual OUString SAL_CALL getImplementationName()
     110             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     112             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     113             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     114             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             : };
     116             : 
     117             : class ScAutoFormatObj : public ::cppu::WeakImplHelper6<
     118             :                             ::com::sun::star::container::XIndexAccess,
     119             :                             ::com::sun::star::container::XEnumerationAccess,
     120             :                             ::com::sun::star::container::XNamed,
     121             :                             ::com::sun::star::beans::XPropertySet,
     122             :                             ::com::sun::star::lang::XUnoTunnel,
     123             :                             ::com::sun::star::lang::XServiceInfo >,
     124             :                         public SfxListener
     125             : {
     126             : private:
     127             :     SfxItemPropertySet      aPropSet;
     128             :     sal_uInt16              nFormatIndex;
     129             : 
     130             :     ScAutoFormatFieldObj*   GetObjectByIndex_Impl(sal_uInt16 nIndex);
     131             : 
     132             : public:
     133             :                             ScAutoFormatObj(sal_uInt16 nIndex);
     134             :     virtual                 ~ScAutoFormatObj();
     135             : 
     136             :     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     137             : 
     138             :                             // per getImplementation gerufen:
     139         111 :     bool                    IsInserted() const      { return nFormatIndex != SC_AFMTOBJ_INVALID; }
     140             :     void                    InitFormat( sal_uInt16 nNewIndex );
     141             : 
     142             :                             // XIndexAccess
     143             :     virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     144             :     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
     145             :                                 throw(::com::sun::star::lang::IndexOutOfBoundsException,
     146             :                                     ::com::sun::star::lang::WrappedTargetException,
     147             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     148             : 
     149             :                             // XElementAccess
     150             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
     151             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             :     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             : 
     154             :                             // XEnumerationAccess
     155             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
     156             :                             createEnumeration() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     157             : 
     158             :                             // XNamed
     159             :     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     160             :     virtual void SAL_CALL   setName( const OUString& aName )
     161             :                                 throw (::com::sun::star::uno::RuntimeException,
     162             :                                        std::exception) SAL_OVERRIDE;
     163             : 
     164             :                             // XPropertySet
     165             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
     166             :                             SAL_CALL getPropertySetInfo()
     167             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     168             :     virtual void SAL_CALL   setPropertyValue( const OUString& aPropertyName,
     169             :                                     const ::com::sun::star::uno::Any& aValue )
     170             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     171             :                                     ::com::sun::star::beans::PropertyVetoException,
     172             :                                     ::com::sun::star::lang::IllegalArgumentException,
     173             :                                     ::com::sun::star::lang::WrappedTargetException,
     174             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     175             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
     176             :                                     const OUString& PropertyName )
     177             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     178             :                                     ::com::sun::star::lang::WrappedTargetException,
     179             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             :     virtual void SAL_CALL   addPropertyChangeListener( const OUString& aPropertyName,
     181             :                                     const ::com::sun::star::uno::Reference<
     182             :                                         ::com::sun::star::beans::XPropertyChangeListener >& xListener )
     183             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     184             :                                     ::com::sun::star::lang::WrappedTargetException,
     185             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     186             :     virtual void SAL_CALL   removePropertyChangeListener( const OUString& aPropertyName,
     187             :                                     const ::com::sun::star::uno::Reference<
     188             :                                         ::com::sun::star::beans::XPropertyChangeListener >& aListener )
     189             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     190             :                                     ::com::sun::star::lang::WrappedTargetException,
     191             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     192             :     virtual void SAL_CALL   addVetoableChangeListener( const OUString& PropertyName,
     193             :                                     const ::com::sun::star::uno::Reference<
     194             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     195             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     196             :                                     ::com::sun::star::lang::WrappedTargetException,
     197             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     198             :     virtual void SAL_CALL   removeVetoableChangeListener( const OUString& PropertyName,
     199             :                                     const ::com::sun::star::uno::Reference<
     200             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     201             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     202             :                                     ::com::sun::star::lang::WrappedTargetException,
     203             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     204             : 
     205             :                             // XServiceInfo
     206             :     virtual OUString SAL_CALL getImplementationName()
     207             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     208             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     209             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     210             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     211             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     212             : 
     213             :                             // XUnoTunnel
     214             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
     215             :                                     sal_Int8 >& aIdentifier )
     216             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     217             : 
     218             :     static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
     219             :     static ScAutoFormatObj* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj);
     220             : };
     221             : 
     222             : class ScAutoFormatFieldObj : public ::cppu::WeakImplHelper2<
     223             :                                 ::com::sun::star::beans::XPropertySet,
     224             :                                 ::com::sun::star::lang::XServiceInfo >,
     225             :                             public SfxListener
     226             : {
     227             : private:
     228             :     SfxItemPropertySet      aPropSet;
     229             :     sal_uInt16                  nFormatIndex;
     230             :     sal_uInt16                  nFieldIndex;
     231             : 
     232             : public:
     233             :                             ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField);
     234             :     virtual                 ~ScAutoFormatFieldObj();
     235             : 
     236             :     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     237             : 
     238             :                             // XPropertySet
     239             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
     240             :                             SAL_CALL getPropertySetInfo()
     241             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     242             :     virtual void SAL_CALL   setPropertyValue( const OUString& aPropertyName,
     243             :                                     const ::com::sun::star::uno::Any& aValue )
     244             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     245             :                                     ::com::sun::star::beans::PropertyVetoException,
     246             :                                     ::com::sun::star::lang::IllegalArgumentException,
     247             :                                     ::com::sun::star::lang::WrappedTargetException,
     248             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     249             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
     250             :                                     const OUString& PropertyName )
     251             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     252             :                                     ::com::sun::star::lang::WrappedTargetException,
     253             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     254             :     virtual void SAL_CALL   addPropertyChangeListener( const OUString& aPropertyName,
     255             :                                     const ::com::sun::star::uno::Reference<
     256             :                                         ::com::sun::star::beans::XPropertyChangeListener >& xListener )
     257             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     258             :                                     ::com::sun::star::lang::WrappedTargetException,
     259             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     260             :     virtual void SAL_CALL   removePropertyChangeListener( const OUString& aPropertyName,
     261             :                                     const ::com::sun::star::uno::Reference<
     262             :                                         ::com::sun::star::beans::XPropertyChangeListener >& aListener )
     263             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     264             :                                     ::com::sun::star::lang::WrappedTargetException,
     265             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     266             :     virtual void SAL_CALL   addVetoableChangeListener( const OUString& PropertyName,
     267             :                                     const ::com::sun::star::uno::Reference<
     268             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     269             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     270             :                                     ::com::sun::star::lang::WrappedTargetException,
     271             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     272             :     virtual void SAL_CALL   removeVetoableChangeListener( const OUString& PropertyName,
     273             :                                     const ::com::sun::star::uno::Reference<
     274             :                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     275             :                                 throw(::com::sun::star::beans::UnknownPropertyException,
     276             :                                     ::com::sun::star::lang::WrappedTargetException,
     277             :                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     278             : 
     279             :                             // XServiceInfo
     280             :     virtual OUString SAL_CALL getImplementationName()
     281             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     282             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     283             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     284             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     285             :                                 throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     286             : };
     287             : 
     288             : #endif
     289             : 
     290             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11