LCOV - code coverage report
Current view: top level - include/cppuhelper - propshlp.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 12 100.0 %
Date: 2014-11-03 Functions: 9 9 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_CPPUHELPER_PROPSHLP_HXX
      21             : #define INCLUDED_CPPUHELPER_PROPSHLP_HXX
      22             : 
      23             : #include <rtl/alloc.h>
      24             : 
      25             : #include <cppuhelper/interfacecontainer.hxx>
      26             : 
      27             : #include <com/sun/star/beans/XPropertySet.hpp>
      28             : #include <com/sun/star/beans/XPropertySetOption.hpp>
      29             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      30             : #include <com/sun/star/beans/XFastPropertySet.hpp>
      31             : 
      32             : #include <memory>
      33             : #include <cppuhelper/cppuhelperdllapi.h>
      34             : 
      35             : 
      36             : namespace cppu
      37             : {
      38             : 
      39             : 
      40             : /*************************************************************************
      41             : *************************************************************************/
      42             : 
      43             : 
      44             : /**
      45             :    This interface is used by the OPropertyHelper, to access the property description.
      46             :  */
      47       18895 : class CPPUHELPER_DLLPUBLIC IPropertyArrayHelper
      48             : {
      49             : public:
      50             :     // these are here to force memory de/allocation to sal lib.
      51       18217 :     inline static void * SAL_CALL operator new( size_t nSize )
      52       18217 :         { return ::rtl_allocateMemory( nSize ); }
      53       17784 :     inline static void SAL_CALL operator delete( void * pMem )
      54       17784 :         { ::rtl_freeMemory( pMem ); }
      55             :     inline static void * SAL_CALL operator new( size_t, void * pMem )
      56             :         { return pMem; }
      57             :     inline static void SAL_CALL operator delete( void *, void * )
      58             :         {}
      59             : 
      60             :     /**
      61             :        Following the rule, the first virtual method implies a virtual destructor.
      62             :      */
      63             :     virtual ~IPropertyArrayHelper();
      64             : 
      65             :     /**
      66             :        Return the property members Name and Attribute from the handle nHandle.
      67             :        @param nHandle   the handle of a property. If the values of the handles
      68             :                           are sorted in the same way as the names and the highest handle value
      69             :                           is getCount() -1, than it must be an indexed acces to the property array.
      70             :        @param pPropName is an out parameter filled with property name of the property with the
      71             :                               handle nHandle. May be NULL.
      72             :        @param pAttributes is an out parameter filled with attributes of the property with the
      73             :                               handle nHandle. May be NULL.
      74             :        @return True, if the handle exist, otherwise false.
      75             :      */
      76             :     virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
      77             :         ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) = 0;
      78             :     /**
      79             :        Return the sequence of properties. The sequence is sorted by name.
      80             :      */
      81             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void) = 0;
      82             :     /**
      83             :        Return the property with the name rPropertyName.
      84             :        @param rPropertyName the name of the property.
      85             :        @exception UnknownPropertyException  thrown if the property name is unknown.
      86             :      */
      87             :     virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
      88             :         const ::rtl::OUString& rPropertyName )
      89             :         throw (::com::sun::star::beans::UnknownPropertyException) = 0;
      90             :     /**
      91             :        Return true if the property with the name rPropertyName exist, otherwise false.
      92             :        @param rPropertyName the name of the property.
      93             :      */
      94             :     virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) = 0;
      95             :     /**
      96             :        Return the handle of the property with the name rPropertyName.
      97             :        If the property does not exist -1 is returned.
      98             :        @param rPropertyName the name of the property.
      99             :      */
     100             :     virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) = 0;
     101             :     /**
     102             :        Fill the array with the handles of the properties.
     103             :        @return the handles of the names from the pHandles array. -1
     104             :        indicates an unknown property name.
     105             :      */
     106             :     virtual sal_Int32 SAL_CALL fillHandles(
     107             :         /*out*/ sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ) = 0;
     108             : };
     109             : 
     110             : /**
     111             :    You can use this helper class to map a XPropertySet-Interface to a XFast-
     112             :    or a XMultiPropertySet interface.
     113             :  */
     114       33290 : class CPPUHELPER_DLLPUBLIC OPropertyArrayHelper : public IPropertyArrayHelper
     115             : {
     116             : public:
     117             :      /**
     118             :        Create an object which supports the common property interfaces.
     119             : 
     120             :        @param pProps    array of properties
     121             :                           The array pProps should be sorted.
     122             :        @param nElements is the number of properties in the pProps structure.
     123             :        @param bSorted   indicates that the elements are sorted.
     124             :       *********/
     125             :     OPropertyArrayHelper(
     126             :         ::com::sun::star::beans::Property *pProps,
     127             :         sal_Int32 nElements ,
     128             :         sal_Bool bSorted = sal_True );
     129             : 
     130             :      /**
     131             :        Create an object which supports the common property interfaces.
     132             :        @param aProps     sequence of properties which are supported by this helper.
     133             :                            The sequence aProps should be sorted.
     134             :        @param bSorted    indicates that the elements are sorted.
     135             :      */
     136             :     OPropertyArrayHelper(
     137             :         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > & aProps,
     138             :         sal_Bool bSorted = sal_True );
     139             : 
     140             :     /**
     141             :        Return the number of properties.
     142             :      */
     143             :     sal_Int32 SAL_CALL getCount() const;
     144             :     /**
     145             :        Return the property members Name and Attribute from the handle nHandle.
     146             :        @param nHandle   the handle of a property. If the values of the handles
     147             :                           are sorted in the same way as the names and the highest handle value
     148             :                           is getCount() -1, than it is only an indexed acces to the property array.
     149             :                           Otherwise it is a linear search through the array.
     150             :        @param pPropName is an out parameter filled with property name of the property with the
     151             :                               handle nHandle. May be NULL.
     152             :        @param pAttributes is an out parameter filled with attributes of the property with the
     153             :                               handle nHandle. May be NULL.
     154             :        @return True, if the handle exist, otherwise false.
     155             :      */
     156             :     virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
     157             :         ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) SAL_OVERRIDE;
     158             :     /**
     159             :        Return the sequence of properties. The sequence is sorted by name.
     160             :      */
     161             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void) SAL_OVERRIDE;
     162             :     /**
     163             :        Return the property with the name rPropertyName.
     164             :        @param rPropertyName the name of the property.
     165             :        @exception UnknownPropertyException  thrown if the property name is unknown.
     166             :      */
     167             :     virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
     168             :         const ::rtl::OUString& rPropertyName )
     169             :         throw (::com::sun::star::beans::UnknownPropertyException) SAL_OVERRIDE;
     170             :     /**
     171             :        Return true if the property with the name rPropertyName exist, otherwise false.
     172             :        @param rPropertyName the name of the property.
     173             :      */
     174             :     virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) SAL_OVERRIDE;
     175             :     /**
     176             :        Return the handle of the property with the name rPropertyName.
     177             :        If the property does not exist -1 is returned.
     178             :        @param rPropertyName the name of the property.
     179             :      */
     180             :     virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) SAL_OVERRIDE;
     181             :     /**
     182             :        Fill the array with the handles of the properties.
     183             :        @return the handles of the names from the pHandles array. -1
     184             :        indicates an unknown property name.
     185             :      */
     186             :     virtual sal_Int32 SAL_CALL fillHandles(
     187             :         /*out*/sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ) SAL_OVERRIDE;
     188             : 
     189             : protected:
     190             :     /** reserved for future use. do not use.
     191             :      */
     192             :     void * m_pReserved;
     193             : 
     194             : private:
     195             :     void init( sal_Bool bSorted );
     196             : 
     197             :     /** The sequence generated from the pProperties array. */
     198             :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aInfos;
     199             : 
     200             :     /**
     201             :        True, If the values of the handles are sorted in the same way as the names
     202             :        and the highest handle value is getCount() -1, otherwise false.
     203             :      */
     204             :     sal_Bool                    bRightOrdered;
     205             : };
     206             : 
     207             : 
     208             : 
     209             : // helper defines needed for an interface container with a 32 bit key values
     210             : 
     211             : struct equalInt32_Impl
     212             : {
     213             :     bool operator()(const sal_Int32 & i1 , const sal_Int32 & i2) const
     214             :         { return i1 == i2; }
     215             : };
     216             : 
     217             : struct hashInt32_Impl
     218             : {
     219             :     size_t operator()(const sal_Int32 & i) const
     220             :         { return i; }
     221             : };
     222             : /** Specialized class for key type sal_Int32,
     223             :     without explicit usage of STL symbols.
     224             : */
     225             : class CPPUHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelperInt32
     226             : {
     227             : public:
     228             :     // these are here to force memory de/allocation to sal lib.
     229           2 :     inline static void * SAL_CALL operator new( size_t nSize )
     230           2 :         { return ::rtl_allocateMemory( nSize ); }
     231           2 :     inline static void SAL_CALL operator delete( void * pMem )
     232           2 :         { ::rtl_freeMemory( pMem ); }
     233             :     inline static void * SAL_CALL operator new( size_t, void * pMem )
     234             :         { return pMem; }
     235             :     inline static void SAL_CALL operator delete( void *, void * )
     236             :         {}
     237             : 
     238             :     /**
     239             :       Create a container of interface containers.
     240             : 
     241             :       @param rMutex the mutex to protect multi thread access.
     242             :                          The lifetime must be longer than the lifetime
     243             :                          of this object.
     244             :      */
     245             :     OMultiTypeInterfaceContainerHelperInt32( ::osl::Mutex & rMutex );
     246             :     /**
     247             :       Delete all containers.
     248             :      */
     249             :     ~OMultiTypeInterfaceContainerHelperInt32();
     250             : 
     251             :     /**
     252             :       Return all id's under which at least one interface is added.
     253             :      */
     254             :     ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getContainedTypes() const;
     255             : 
     256             :     /**
     257             :       Return the container created under this key.
     258             :       @return the container created under this key. If the container
     259             :                  was not created, null was returned.
     260             :      */
     261             :     OInterfaceContainerHelper * SAL_CALL getContainer( const sal_Int32 & rKey ) const;
     262             : 
     263             :     /**
     264             :       Insert an element in the container specified with the key. The position is not specified.
     265             :       @param rKey       the id of the container.
     266             :       @param r          the added interface. It is allowed to insert null or
     267             :                          the same pointer more than once.
     268             :       @return the new count of elements in the container.
     269             :      */
     270             :     sal_Int32 SAL_CALL addInterface(
     271             :         const sal_Int32 & rKey,
     272             :         const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & r );
     273             : 
     274             :     /**
     275             :       Remove an element from the container specified with the key.
     276             :       It uses the equal definition of uno objects to remove the interfaces.
     277             :       @param rKey       the id of the container.
     278             :       @param rxIFace    the removed interface.
     279             :       @return the new count of elements in the container.
     280             :      */
     281             :     sal_Int32 SAL_CALL removeInterface(
     282             :         const sal_Int32 & rKey,
     283             :         const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace );
     284             : 
     285             :     /**
     286             :       Call disposing on all objects in the container that
     287             :       support XEventListener. Then clear the container.
     288             :      */
     289             :     void    SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt );
     290             :     /**
     291             :       Remove all elements of all containers. Does not delete the container.
     292             :      */
     293             :     void SAL_CALL clear();
     294             : 
     295             :     typedef sal_Int32 keyType;
     296             : private:
     297             :     void *m_pMap;
     298             :     ::osl::Mutex &  rMutex;
     299             : 
     300             :     inline OMultiTypeInterfaceContainerHelperInt32( const OMultiTypeInterfaceContainerHelperInt32 & );
     301             :     inline OMultiTypeInterfaceContainerHelperInt32 & operator = ( const OMultiTypeInterfaceContainerHelperInt32 & );
     302             : };
     303             : 
     304             : 
     305             : /** An interface to extend event notification actions.
     306             :   */
     307        4876 : class IEventNotificationHook
     308             : {
     309             : public:
     310             :     /**
     311             :         Method to be called by OPropertySetHelper::fire.
     312             : 
     313             :         @param bIgnoreRuntimeExceptionsWhileFiring
     314             :                         indicates whether occurring RuntimeExceptions shall be
     315             :                         ignored when firing notifications
     316             :        @param pnHandles     the id's of the properties that changed.
     317             :        @param nCount        the number of elements in the arrays pnHandles, pNewValues and pOldValues.
     318             :        @param bVetoable true means fire to VetoableChangeListener, false means fire to
     319             :                   XPropertyChangedListener and XMultiPropertyChangedListener.
     320             :        @param bIgnoreRuntimeExceptionsWhileFiring
     321             :                         indicates whether occurring RuntimeExceptions will be
     322             :                         ignored when firing notifications
     323             :                         (vetoableChange(), propertyChange())
     324             :                         to listeners.
     325             :                         PropertyVetoExceptions may still be thrown.
     326             :                         This flag is useful in an inter-process scenario when
     327             :                         remote bridges may break down
     328             :                         (firing DisposedExceptions).
     329             : 
     330             :         @see OPropertySetHelper::fire
     331             :      */
     332             :     virtual void fireEvents(
     333             :         sal_Int32 * pnHandles,
     334             :         sal_Int32 nCount,
     335             :         sal_Bool bVetoable,
     336             :         bool bIgnoreRuntimeExceptionsWhileFiring) = 0;
     337             : 
     338             : #if !defined _MSC_VER // public -> protected changes mangled names there
     339             : protected:
     340             : #endif
     341        4867 :     ~IEventNotificationHook() {}
     342             :         // avoid warnings about virtual members and non-virtual dtor
     343             : };
     344             : 
     345             : 
     346             : 
     347             : /**
     348             :    This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet
     349             :    and XPropertySet to the methods getInfoHelper, convertFastPropertyValue,
     350             :    setFastPropertyValue_NoBroadcast and getFastPropertyValue. You must derive from
     351             :    this class and overload the methods.
     352             :    It provides a standard implementation of the XPropertySetInfo.
     353             :    The XPropertiesChangeListener are inserted in the rBHelper.aLC structure.
     354             :    The XPropertyChangeListener and XVetoableChangeListener with no names are inserted
     355             :    in the rBHelper.aLC structure. So it is possible to advise property listeners with
     356             :    the connection point interfaces. But only listeners that listen to all property changes.
     357             : 
     358             :  */
     359             : class CPPUHELPER_DLLPUBLIC OPropertySetHelper :
     360             :                            public ::com::sun::star::beans::XMultiPropertySet,
     361             :                            public ::com::sun::star::beans::XFastPropertySet,
     362             :                            public ::com::sun::star::beans::XPropertySet
     363             : {
     364             : public:
     365             :     /**
     366             :        @param rBHelper  this structure contains the basic members of
     367             :                           a broadcaster.
     368             :                           The lifetime must be longer than the lifetime
     369             :                           of this object. Stored in the variable rBHelper.
     370             :      */
     371             :     OPropertySetHelper( OBroadcastHelper & rBHelper );
     372             : 
     373             :     /** Constructor.
     374             : 
     375             :         @param rBHelper
     376             :                         this structure contains the basic members of
     377             :                         a broadcaster.
     378             :                           The lifetime must be longer than the lifetime
     379             :                           of this object. Stored in the variable rBHelper.
     380             : 
     381             :         @param bIgnoreRuntimeExceptionsWhileFiring
     382             :                         indicates whether occurring RuntimeExceptions will be
     383             :                         ignored when firing notifications
     384             :                         (vetoableChange(), propertyChange())
     385             :                         to listeners.
     386             :                         PropertyVetoExceptions may still be thrown.
     387             :                         This flag is useful in an inter-process scenario when
     388             :                         remote bridges may break down
     389             :                         (firing DisposedExceptions).
     390             :     */
     391             :     OPropertySetHelper(
     392             :         OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring );
     393             : 
     394             :     /** Constructor.
     395             : 
     396             :         @param rBHelper
     397             :                         this structure contains the basic members of
     398             :                         a broadcaster.
     399             :                         The lifetime must be longer than the lifetime
     400             :                         of this object. Stored in the variable rBHelper.
     401             : 
     402             :         @param i_pFireEvents
     403             :                         additional event notifier
     404             : 
     405             :         @param bIgnoreRuntimeExceptionsWhileFiring
     406             :                         indicates whether occurring RuntimeExceptions will be
     407             :                         ignored when firing notifications
     408             :                         (vetoableChange(), propertyChange())
     409             :                         to listeners.
     410             :                         PropertyVetoExceptions may still be thrown.
     411             :                         This flag is useful in an inter-process scenario when
     412             :                         remote bridges may break down
     413             :                         (firing DisposedExceptions).
     414             :     */
     415             :     OPropertySetHelper(
     416             :         OBroadcastHelper & rBHelper,
     417             :         IEventNotificationHook *i_pFireEvents,
     418             :         bool bIgnoreRuntimeExceptionsWhileFiring = false);
     419             : 
     420             :     /**
     421             :        Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and
     422             :        XEventListener.
     423             :      */
     424             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
     425             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     426             : 
     427             :     /** eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet
     428             :      */
     429             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > getTypes()
     430             :         throw(::com::sun::star::uno::RuntimeException);
     431             : 
     432             :     /**
     433             :        Send a disposing notification to the listeners in the conatiners aBoundLC
     434             :        and aVetoableLC.
     435             : 
     436             :        @see OComponentHelper
     437             :      */
     438             :     void SAL_CALL disposing();
     439             : 
     440             :     /**
     441             :        Throw UnknownPropertyException or PropertyVetoException if the property with the name
     442             :        rPropertyName does not exist or is readonly. Otherwise rPropertyName is changed to its handle
     443             :        value and setFastPropertyValue is called.
     444             :      */
     445             :     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue )
     446             :         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;
     447             :     /**
     448             :        Throw UnknownPropertyException if the property with the name
     449             :        rPropertyName does not exist.
     450             :      */
     451             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName)
     452             :         throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     453             :     /** Ignored if the property is not bound. */
     454             :     virtual void SAL_CALL addPropertyChangeListener(
     455             :         const ::rtl::OUString& aPropertyName,
     456             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener)
     457             :         throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     458             : 
     459             :     /** Ignored if the property is not bound. */
     460             :     virtual void SAL_CALL removePropertyChangeListener(
     461             :         const ::rtl::OUString& aPropertyName,
     462             :         const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertyChangeListener >& aListener)
     463             :         throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     464             : 
     465             :     /** Ignored if the property is not constrained. */
     466             :     virtual void SAL_CALL addVetoableChangeListener(
     467             :         const ::rtl::OUString& aPropertyName,
     468             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener)
     469             :         throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     470             : 
     471             :     /** Ignored if the property is not constrained. */
     472             :     virtual void SAL_CALL removeVetoableChangeListener(
     473             :         const ::rtl::OUString& aPropertyName,
     474             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener )
     475             :         throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     476             : 
     477             :     /**
     478             :        Throw UnknownPropertyException or PropertyVetoException if the property with the name
     479             :        rPropertyName does not exist or is readonly. Otherwise the method convertFastPropertyValue
     480             :        is called, then the vetoable listeners are notified. After this the value of the property
     481             :        is changed with the setFastPropertyValue_NoBroadcast method and the bound listeners are
     482             :        notified.
     483             :       */
     484             :     virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
     485             :         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;
     486             : 
     487             :     /**
     488             :        @exception com::sun::star::beans::UnknownPropertyException
     489             :          if the property with the handle nHandle does not exist.
     490             :      */
     491             :     virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle )
     492             :         throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     493             : 
     494             :     // XMultiPropertySet
     495             :     virtual void SAL_CALL setPropertyValues(
     496             :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
     497             :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values )
     498             :         throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     499             : 
     500             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues(
     501             :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames )
     502             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     503             : 
     504             :     virtual void SAL_CALL addPropertiesChangeListener(
     505             :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
     506             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
     507             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     508             : 
     509             :     virtual void SAL_CALL removePropertiesChangeListener(
     510             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
     511             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     512             : 
     513             :     virtual void SAL_CALL firePropertiesChangeEvent(
     514             :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
     515             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > & Listener )
     516             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     517             : 
     518             :     /**
     519             :        The property sequence is created in the call. The interface isn't used after the call.
     520             :      */
     521             :     static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
     522             :         createPropertySetInfo( IPropertyArrayHelper & rProperties );
     523             : protected:
     524             :     /**
     525             :        This method fire events to all registered property listeners.
     526             :        @param pnHandles     the id's of the properties that changed.
     527             :        @param pNewValues    the new values of the properties.
     528             :        @param pOldValues    the old values of the properties.
     529             :        @param nCount        the number of elements in the arrays pnHandles, pNewValues and pOldValues.
     530             :        @param bVetoable true means fire to VetoableChangeListener, false means fire to
     531             :                   XPropertyChangedListener and XMultiPropertyChangedListener.
     532             :      */
     533             :     void SAL_CALL fire(
     534             :         sal_Int32 * pnHandles,
     535             :         const ::com::sun::star::uno::Any * pNewValues,
     536             :         const ::com::sun::star::uno::Any * pOldValues,
     537             :         sal_Int32 nCount,
     538             :         sal_Bool bVetoable );
     539             : 
     540             :     /**
     541             :        Set multiple properties with the handles.
     542             :        @param nSeqLen   the length of the arrays pHandles and Values.
     543             :        @param pHandles the handles of the properties. The number of elements
     544             :               in the Values sequence is the length of the handle array. A value of -1
     545             :               of a handle means invalid property. These are ignored.
     546             :        @param pValues the values of the properties.
     547             :        @param nHitCount the number of valid entries in the handle array.
     548             :      */
     549             :     void SAL_CALL setFastPropertyValues(
     550             :         sal_Int32 nSeqLen,
     551             :         sal_Int32 * pHandles,
     552             :         const ::com::sun::star::uno::Any * pValues,
     553             :         sal_Int32 nHitCount );
     554             : 
     555             :     /**
     556             :        This abstract method must return the name to index table. This table contains all property
     557             :        names and types of this object. The method is not implemented in this class.
     558             :      */
     559             :     virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
     560             : 
     561             :     /**
     562             :        Converted the value rValue and return the result in rConvertedValue and the
     563             :        old value in rOldValue. A IllegalArgumentException is thrown.
     564             :        The method is not implemented in this class. After this call the vetoable
     565             :        listeners are notified.
     566             : 
     567             :        @param rConvertedValue the converted value. Only set if return is true.
     568             :        @param rOldValue the old value. Only set if return is true.
     569             :        @param nHandle the handle of the proberty.
     570             :        @param rValue the value to be converted
     571             :        @return true if the value converted.
     572             :      */
     573             :     virtual sal_Bool SAL_CALL convertFastPropertyValue(
     574             :         ::com::sun::star::uno::Any & rConvertedValue,
     575             :         ::com::sun::star::uno::Any & rOldValue,
     576             :         sal_Int32 nHandle,
     577             :         const ::com::sun::star::uno::Any& rValue )
     578             :         throw (css::lang::IllegalArgumentException,
     579             :                css::beans::UnknownPropertyException,
     580             :                css::uno::RuntimeException, std::exception) = 0;
     581             : 
     582             :     /** The same as setFastProperyValue; nHandle is always valid.
     583             :         The changes must not be broadcasted in this method.
     584             :         The method is implemented in a derived class.
     585             : 
     586             :         @attention
     587             :         Although you are permitted to throw any UNO exception, only the following
     588             :         are valid for usage:
     589             :         -- com::sun::star::beans::UnknownPropertyException
     590             :         -- com::sun::star::beans::PropertyVetoException
     591             :         -- com::sun::star::lang::IllegalArgumentException
     592             :         -- com::sun::star::lang::WrappedTargetException
     593             :         -- com::sun::star::uno::RuntimeException
     594             : 
     595             :         @param nHandle
     596             :                handle
     597             :         @param rValue
     598             :                value
     599             :     */
     600             :     virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     601             :         sal_Int32 nHandle,
     602             :         const ::com::sun::star::uno::Any& rValue )
     603             :             throw (::com::sun::star::uno::Exception,
     604             :                    std::exception) = 0;
     605             :     /**
     606             :        The same as getFastProperyValue, but return the value through rValue and nHandle
     607             :        is always valid.
     608             :        The method is not implemented in this class.
     609             :      */
     610             :     virtual void SAL_CALL getFastPropertyValue(
     611             :         ::com::sun::star::uno::Any& rValue,
     612             :         sal_Int32 nHandle ) const = 0;
     613             : 
     614             :     /** sets an dependent property's value
     615             : 
     616             :         <p>Sometimes setting a given property needs to implicitly modify another property's value. Calling |setPropertyValue|
     617             :         from within |setFastPropertyValue_NoBroadcast| is not an option here, as it would notify the property listeners
     618             :         while our mutex is still locked. Setting the dependent property's value directly (e.g. by calling |setFastPropertyValue_NoBroadcast|
     619             :         recursively) is not an option, too, since it would miss firing the property change event.</p>
     620             : 
     621             :         <p>So, in such cases, you use |setDependentFastPropertyValue| from within |setFastPropertyValue_NoBroadcast|.
     622             :         It will convert and actually set the property value (invoking |convertFastPropertyValue| and |setFastPropertyValue_NoBroadcast|
     623             :         for the given handle and value), and add the property change event to the list of events to be notified
     624             :         when the bottom-most |setFastPropertyValue_NoBroadcast| on the stack returns.</p>
     625             : 
     626             :         <p><strong>Note</strong>: The method will <em>not</em> invoke veto listeners for the property.</p>
     627             : 
     628             :         <p><strong>Note</strong>: It's the caller's responsibility to ensure that our mutex is locked. This is
     629             :         canonically given when the method is invoked from within |setFastPropertyValue_NoBroadcast|, in other
     630             :         contexts, you might need to take own measures.</p>
     631             :     */
     632             :     void    setDependentFastPropertyValue(
     633             :                 sal_Int32 i_handle,
     634             :                 const ::com::sun::star::uno::Any& i_value
     635             :             );
     636             : 
     637             :     /** The common data of a broadcaster. Use the mutex, disposing state and the listener container. */
     638             :     OBroadcastHelper    &rBHelper;
     639             :     /**
     640             :        Container for the XProperyChangedListener. The listeners are inserted by handle.
     641             :      */
     642             :     OMultiTypeInterfaceContainerHelperInt32  aBoundLC;
     643             :     /**
     644             :        Container for the XPropertyVetoableListener. The listeners are inserted by handle.
     645             :      */
     646             :     OMultiTypeInterfaceContainerHelperInt32 aVetoableLC;
     647             : 
     648             :     class Impl;
     649             : 
     650             :     /** reserved for future use. finally, the future has arrived...
     651             :      */
     652             :     const std::auto_ptr<Impl> m_pReserved;
     653             : 
     654             : private:
     655             :     OPropertySetHelper( const OPropertySetHelper & );
     656             :     OPropertySetHelper &    operator = ( const OPropertySetHelper & );
     657             : 
     658             :     /** notifies the given changes in property's values, <em>plus</em> all property changes collected during recent
     659             :         |setDependentFastPropertyValue| calls.
     660             :     */
     661             :     void    impl_fireAll(
     662             :                 sal_Int32* i_handles,
     663             :                 const ::com::sun::star::uno::Any * i_newValues,
     664             :                 const ::com::sun::star::uno::Any * i_oldValues,
     665             :                 sal_Int32 i_count
     666             :             );
     667             : 
     668             : #if defined _MSC_VER // public -> protected changes mangled names there
     669             : public:
     670             : #else
     671             : protected:
     672             : #endif
     673             : // Suppress warning about virtual functions but non-virtual destructor:
     674             : #if defined _MSC_VER
     675             : #pragma warning(push)
     676             : #pragma warning(disable: 4265)
     677             : #endif
     678             :     /**
     679             :        You must call disposing before destruction.
     680             :      */
     681             :     ~OPropertySetHelper();
     682             : };
     683             : #if defined _MSC_VER
     684             : #pragma warning(pop)
     685             : #endif
     686             : 
     687             : /**
     688             :    OPropertySetHelper plus XPropertySetOption
     689             :  */
     690             : class CPPUHELPER_DLLPUBLIC OPropertySetHelper2 : public OPropertySetHelper,
     691             :                             public ::com::sun::star::beans::XPropertySetOption
     692             : {
     693             : public:
     694             :     /** Constructor.
     695             : 
     696             :         See OPropertySetHelper constructors documentation
     697             :     */
     698             :     explicit OPropertySetHelper2(
     699             :         OBroadcastHelper & rBHelper,
     700             :         IEventNotificationHook *i_pFireEvents = NULL,
     701             :         bool bIgnoreRuntimeExceptionsWhileFiring = false);
     702             : 
     703             :     // XInterface
     704             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
     705             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     706             : 
     707             :     // XPropertySetOption
     708             :     virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
     709             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     710             : 
     711             : 
     712             : 
     713             : private:
     714             :     OPropertySetHelper2( const OPropertySetHelper2 & );
     715             :     OPropertySetHelper2 &    operator = ( const OPropertySetHelper2 & );
     716             : 
     717             : #if defined _MSC_VER // public -> protected changes mangled names there
     718             : public:
     719             : #else
     720             : protected:
     721             : #endif
     722             : // Suppress warning about virtual functions but non-virtual destructor:
     723             :     /**
     724             :        You must call disposing before destruction.
     725             :      */
     726             :     virtual ~OPropertySetHelper2();
     727             : };
     728             : 
     729             : } // end namespace cppuhelper
     730             : #endif
     731             : 
     732             : 
     733             : 
     734             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10