1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _PROPERTYSETBASE_HXX 28*cdf0e10cSrcweir #define _PROPERTYSETBASE_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // include for parent class 32*cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 33*cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 34*cdf0e10cSrcweir #include <comphelper/propstate.hxx> 35*cdf0e10cSrcweir #include <comphelper/propertysetinfo.hxx> 36*cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx> 37*cdf0e10cSrcweir #include <rtl/ref.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir // include for inlined helper function below 40*cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include <map> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir // forward declarations for method arguments 46*cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace uno { 47*cdf0e10cSrcweir class Any; 48*cdf0e10cSrcweir class Type; 49*cdf0e10cSrcweir class RuntimeException; 50*cdf0e10cSrcweir template<class T> class Sequence; 51*cdf0e10cSrcweir } } } } 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir /** base class which encapsulates accessing (reading/writing) concrete property values 54*cdf0e10cSrcweir */ 55*cdf0e10cSrcweir class PropertyAccessorBase : public ::rtl::IReference 56*cdf0e10cSrcweir { 57*cdf0e10cSrcweir private: 58*cdf0e10cSrcweir oslInterlockedCount m_refCount; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir protected: 61*cdf0e10cSrcweir PropertyAccessorBase() : m_refCount( 0 ) { } 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir public: 64*cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL acquire(); 65*cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL release(); 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir virtual bool approveValue( const com::sun::star::uno::Any& rValue ) const = 0; 68*cdf0e10cSrcweir virtual void setValue( const com::sun::star::uno::Any& rValue ) = 0; 69*cdf0e10cSrcweir virtual void getValue( com::sun::star::uno::Any& rValue ) const = 0; 70*cdf0e10cSrcweir virtual bool isWriteable() const = 0; 71*cdf0e10cSrcweir }; 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir /** helper class for implementing property accessors through public member functions 75*cdf0e10cSrcweir */ 76*cdf0e10cSrcweir template< typename CLASS, typename VALUE, class WRITER, class READER > 77*cdf0e10cSrcweir class GenericPropertyAccessor : public PropertyAccessorBase 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir public: 80*cdf0e10cSrcweir typedef WRITER Writer; 81*cdf0e10cSrcweir typedef READER Reader; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir private: 84*cdf0e10cSrcweir CLASS* m_pInstance; 85*cdf0e10cSrcweir Writer m_pWriter; 86*cdf0e10cSrcweir Reader m_pReader; 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir public: 89*cdf0e10cSrcweir GenericPropertyAccessor( CLASS* pInstance, Writer pWriter, Reader pReader ) 90*cdf0e10cSrcweir :m_pInstance( pInstance ) 91*cdf0e10cSrcweir ,m_pWriter( pWriter ) 92*cdf0e10cSrcweir ,m_pReader( pReader ) 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir virtual bool approveValue( const com::sun::star::uno::Any& rValue ) const 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir VALUE aVal; 99*cdf0e10cSrcweir return ( rValue >>= aVal ); 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir virtual void setValue( const com::sun::star::uno::Any& rValue ) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir VALUE aTypedVal = VALUE(); 105*cdf0e10cSrcweir OSL_VERIFY( rValue >>= aTypedVal ); 106*cdf0e10cSrcweir (m_pInstance->*m_pWriter)( aTypedVal ); 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir virtual void getValue( com::sun::star::uno::Any& rValue ) const 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir rValue = com::sun::star::uno::makeAny( (m_pInstance->*m_pReader)() ); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir virtual bool isWriteable() const 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir return m_pWriter != NULL; 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir }; 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir /** helper class for implementing property accessors via non-UNO methods 121*cdf0e10cSrcweir */ 122*cdf0e10cSrcweir template< typename CLASS, typename VALUE > 123*cdf0e10cSrcweir class DirectPropertyAccessor 124*cdf0e10cSrcweir :public GenericPropertyAccessor < CLASS 125*cdf0e10cSrcweir , VALUE 126*cdf0e10cSrcweir , void (CLASS::*)( const VALUE& ) 127*cdf0e10cSrcweir , VALUE (CLASS::*)() const 128*cdf0e10cSrcweir > 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir protected: 131*cdf0e10cSrcweir typedef void (CLASS::*Writer)( const VALUE& ); 132*cdf0e10cSrcweir typedef VALUE (CLASS::*Reader)() const; 133*cdf0e10cSrcweir public: 134*cdf0e10cSrcweir DirectPropertyAccessor( CLASS* pInstance, Writer pWriter, Reader pReader ) 135*cdf0e10cSrcweir :GenericPropertyAccessor< CLASS, VALUE, Writer, Reader >( pInstance, pWriter, pReader ) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir }; 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir /** helper class for implementing non-UNO accessors to a boolean property 141*cdf0e10cSrcweir */ 142*cdf0e10cSrcweir template< typename CLASS, typename DUMMY > 143*cdf0e10cSrcweir class BooleanPropertyAccessor 144*cdf0e10cSrcweir :public GenericPropertyAccessor < CLASS 145*cdf0e10cSrcweir , bool 146*cdf0e10cSrcweir , void (CLASS::*)( bool ) 147*cdf0e10cSrcweir , bool (CLASS::*)() const 148*cdf0e10cSrcweir > 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir protected: 151*cdf0e10cSrcweir typedef void (CLASS::*Writer)( bool ); 152*cdf0e10cSrcweir typedef bool (CLASS::*Reader)() const; 153*cdf0e10cSrcweir public: 154*cdf0e10cSrcweir BooleanPropertyAccessor( CLASS* pInstance, Writer pWriter, Reader pReader ) 155*cdf0e10cSrcweir :GenericPropertyAccessor< CLASS, bool, Writer, Reader >( pInstance, pWriter, pReader ) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir }; 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir /** helper class for implementing property accessors via UNO methods 161*cdf0e10cSrcweir */ 162*cdf0e10cSrcweir template< typename CLASS, typename VALUE > 163*cdf0e10cSrcweir class APIPropertyAccessor 164*cdf0e10cSrcweir :public GenericPropertyAccessor < CLASS 165*cdf0e10cSrcweir , VALUE 166*cdf0e10cSrcweir , void (SAL_CALL CLASS::*)( const VALUE& ) 167*cdf0e10cSrcweir , VALUE (SAL_CALL CLASS::*)() 168*cdf0e10cSrcweir > 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir protected: 171*cdf0e10cSrcweir typedef void (SAL_CALL CLASS::*Writer)( const VALUE& ); 172*cdf0e10cSrcweir typedef VALUE (SAL_CALL CLASS::*Reader)(); 173*cdf0e10cSrcweir public: 174*cdf0e10cSrcweir APIPropertyAccessor( CLASS* pInstance, Writer pWriter, Reader pReader ) 175*cdf0e10cSrcweir :GenericPropertyAccessor< CLASS, VALUE, Writer, Reader >( pInstance, pWriter, pReader ) 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir }; 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir /** bridges two XPropertySet helper implementations 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir The <type scope="comphelper">OStatefulPropertySet</type> (basically, the 183*cdf0e10cSrcweir <type scope="cppu">OPropertySetHelper</type>) implements a comprehensive framework 184*cdf0e10cSrcweir for property sets, including property change notifications. 185*cdf0e10cSrcweir However, it lacks some easy possibilities to declare the supported properties. 186*cdf0e10cSrcweir Other helper structs and classes allow for this, but are lacking needed features 187*cdf0e10cSrcweir such as property change notifications. 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir The <type>PropertySetBase</type> bridges various implementations, 190*cdf0e10cSrcweir so you have the best of both worlds. 191*cdf0e10cSrcweir */ 192*cdf0e10cSrcweir class PropertySetBase : public ::comphelper::OStatefulPropertySet 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir private: 195*cdf0e10cSrcweir typedef com::sun::star::uno::Any Any_t; 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir typedef ::std::map< const sal_Int32, ::rtl::Reference< PropertyAccessorBase > > PropertyAccessors; 198*cdf0e10cSrcweir typedef ::std::vector< ::com::sun::star::beans::Property > PropertyArray; 199*cdf0e10cSrcweir typedef ::std::map< const sal_Int32, Any_t > PropertyValueCache; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir PropertyArray m_aProperties; 202*cdf0e10cSrcweir cppu::IPropertyArrayHelper* m_pProperties; 203*cdf0e10cSrcweir PropertyAccessors m_aAccessors; 204*cdf0e10cSrcweir PropertyValueCache m_aCache; 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir protected: 207*cdf0e10cSrcweir PropertySetBase(); 208*cdf0e10cSrcweir virtual ~PropertySetBase(); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir /** registers a new property to be supported by this instance 211*cdf0e10cSrcweir @param rProperty 212*cdf0e10cSrcweir the descriptor for the to-be-supported property 213*cdf0e10cSrcweir @param rAccessor 214*cdf0e10cSrcweir an instance which is able to provide read and possibly write access to 215*cdf0e10cSrcweir the property. 216*cdf0e10cSrcweir @precond 217*cdf0e10cSrcweir Must not be called after any of the property set related UNO interfaces 218*cdf0e10cSrcweir has been used. Usually, you will do a number of <member>registerProperty</member> 219*cdf0e10cSrcweir calls in the constructor of your class. 220*cdf0e10cSrcweir */ 221*cdf0e10cSrcweir void registerProperty( 222*cdf0e10cSrcweir const com::sun::star::beans::Property& rProperty, 223*cdf0e10cSrcweir const ::rtl::Reference< PropertyAccessorBase >& rAccessor 224*cdf0e10cSrcweir ); 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir /** notifies a change in a given property value, if necessary 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir The necessity of the notification is determined by a cached value for the given 229*cdf0e10cSrcweir property. Caching happens after notification. 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir That is, when you call <member>notifyAndCachePropertyValue</member> for the first time, 232*cdf0e10cSrcweir a value for the given property is default constructed, and considered to be the "old value". 233*cdf0e10cSrcweir If this value differs from the current value, then this change is notified to all interested 234*cdf0e10cSrcweir listeners. Finally, the current value is remembered. 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir Subsequent calls to <member>notifyAndCachePropertyValue</member> use the remembered value as 237*cdf0e10cSrcweir "old value", and from then on behave as the first call. 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir @param nHandle 240*cdf0e10cSrcweir the handle of the property. Must denote a property supported by this instance, i.e. 241*cdf0e10cSrcweir one previously registered via <member>registerProperty</member>. 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir @precond 244*cdf0e10cSrcweir our ref count must not be 0. The reason is that during this method's execution, 245*cdf0e10cSrcweir the instance might be acquired and released, which would immediately destroy 246*cdf0e10cSrcweir the instance if it has a ref count of 0. 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir @seealso initializePropertyValueCache 249*cdf0e10cSrcweir */ 250*cdf0e10cSrcweir void notifyAndCachePropertyValue( sal_Int32 nHandle ); 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir /** initializes the property value cache for the given property, with its current value 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir Usually used to initialize the cache with values which are different from default 255*cdf0e10cSrcweir constructed values. Say you have a boolean property whose initial state 256*cdf0e10cSrcweir is <TRUE/>. Say you call <member>notifyAndCachePropertyValue</member> the first time: it will 257*cdf0e10cSrcweir default construct the "old value" for this property as <FALSE/>, and thus <b>not</b> do 258*cdf0e10cSrcweir any notifications if the "current value" is also <FALSE/> - which might be wrong, since 259*cdf0e10cSrcweir the guessing of the "old value" differed from the real initial value which was <TRUE/>. 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir Too confusing? Okay, than just call this method for every property you have. 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir @param nHandle 264*cdf0e10cSrcweir the handle of the property. Must denote a property supported by this instance, i.e. 265*cdf0e10cSrcweir one previously registered via <member>registerProperty</member>. 266*cdf0e10cSrcweir @param rValue 267*cdf0e10cSrcweir the value to cache 268*cdf0e10cSrcweir @seealso notifyAndCachePropertyValue 269*cdf0e10cSrcweir */ 270*cdf0e10cSrcweir void initializePropertyValueCache( sal_Int32 nHandle ); 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir /// OPropertysetHelper methods 273*cdf0e10cSrcweir virtual sal_Bool SAL_CALL convertFastPropertyValue( Any_t& rConvertedValue, Any_t& rOldValue, sal_Int32 nHandle, const Any_t& rValue ) 274*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException); 275*cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any_t& rValue ) 276*cdf0e10cSrcweir throw (::com::sun::star::uno::Exception); 277*cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue( Any_t& rValue, sal_Int32 nHandle ) const; 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 280*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir public: 283*cdf0e10cSrcweir /// helper struct for granting selective access to some notification-related methods 284*cdf0e10cSrcweir struct NotifierAccess { friend struct PropertyChangeNotifier; private: NotifierAccess() { } }; 285*cdf0e10cSrcweir /** retrieves the current property value for the given handle 286*cdf0e10cSrcweir @param nHandle 287*cdf0e10cSrcweir the handle of the property. Must denote a property supported by this instance, i.e. 288*cdf0e10cSrcweir one previously registered via <member>registerProperty</member>. 289*cdf0e10cSrcweir @see registerProperty 290*cdf0e10cSrcweir */ 291*cdf0e10cSrcweir inline void getCurrentPropertyValueByHandle( sal_Int32 nHandle, Any_t& /* [out] */ rValue, const NotifierAccess& ) const 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir getFastPropertyValue( rValue, nHandle ); 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir /** notifies a change in a given property to all interested listeners 297*cdf0e10cSrcweir */ 298*cdf0e10cSrcweir inline void notifyPropertyChange( sal_Int32 nHandle, const Any_t& rOldValue, const Any_t& rNewValue, const NotifierAccess& ) const 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir const_cast< PropertySetBase* >( this )->firePropertyChange( nHandle, rNewValue, rOldValue ); 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir using ::comphelper::OStatefulPropertySet::getFastPropertyValue; 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir private: 306*cdf0e10cSrcweir /** locates a property given by handle 307*cdf0e10cSrcweir @param nHandle 308*cdf0e10cSrcweir the handle of the property. Must denote a property supported by this instance, i.e. 309*cdf0e10cSrcweir one previously registered via <member>registerProperty</member>. 310*cdf0e10cSrcweir @see registerProperty 311*cdf0e10cSrcweir */ 312*cdf0e10cSrcweir PropertyAccessorBase& locatePropertyHandler( sal_Int32 nHandle ) const; 313*cdf0e10cSrcweir }; 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir /** a helper class for notifying property changes in a <type>PropertySetBase</type> instance. 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir You can create an instance of this class on the stack of a method which is to programmatically 318*cdf0e10cSrcweir change the value of a property. In its constructor, the instance will acquire the current property 319*cdf0e10cSrcweir value, and in its destructor, it will notify the change of this property's value (if necessary). 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir You do not need this class if you are modifying property values by using the X(Fast|Multi)PropertSet 322*cdf0e10cSrcweir methods, since those already care for property notifications. You only need it if you're changing 323*cdf0e10cSrcweir the internal representation of your property directly. 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir Also note that usually, notifications in the UNO world should be done without a locked mutex. So 326*cdf0e10cSrcweir if you use this class in conjunction with a <type>MutexGuard</type>, ensure that you <b>first</b> 327*cdf0e10cSrcweir instantiate the <type>PropertyChangeNotifier</type>, and <b>then</b> the <type>MutexGuard</type>, 328*cdf0e10cSrcweir so your mutex is released before the notification happens. 329*cdf0e10cSrcweir */ 330*cdf0e10cSrcweir struct PropertyChangeNotifier 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir private: 333*cdf0e10cSrcweir const PropertySetBase& m_rPropertySet; 334*cdf0e10cSrcweir sal_Int32 m_nHandle; 335*cdf0e10cSrcweir com::sun::star::uno::Any m_aOldValue; 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir public: 338*cdf0e10cSrcweir /** constructs a PropertyChangeNotifier 339*cdf0e10cSrcweir @param rPropertySet 340*cdf0e10cSrcweir the property set implementation whose property is going to be changed. Note 341*cdf0e10cSrcweir that this property set implementation must live at least as long as the 342*cdf0e10cSrcweir PropertyChangeNotifier instance does. 343*cdf0e10cSrcweir @param nHandle 344*cdf0e10cSrcweir the handle of the property which is going to be changed. Must be a valid property 345*cdf0e10cSrcweir handle for the given <arg>rPropertySet</arg> 346*cdf0e10cSrcweir */ 347*cdf0e10cSrcweir inline PropertyChangeNotifier( const PropertySetBase& rPropertySet, sal_Int32 nHandle ) 348*cdf0e10cSrcweir :m_rPropertySet( rPropertySet ) 349*cdf0e10cSrcweir ,m_nHandle( nHandle ) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir m_rPropertySet.getCurrentPropertyValueByHandle( m_nHandle, m_aOldValue, PropertySetBase::NotifierAccess() ); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir inline ~PropertyChangeNotifier() 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir com::sun::star::uno::Any aNewValue; 356*cdf0e10cSrcweir m_rPropertySet.getCurrentPropertyValueByHandle( m_nHandle, aNewValue, PropertySetBase::NotifierAccess() ); 357*cdf0e10cSrcweir if ( aNewValue != m_aOldValue ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir m_rPropertySet.notifyPropertyChange( m_nHandle, m_aOldValue, aNewValue, PropertySetBase::NotifierAccess() ); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir }; 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir #define PROPERTY_FLAGS( NAME, TYPE, FLAG ) com::sun::star::beans::Property( \ 366*cdf0e10cSrcweir ::rtl::OUString( #NAME, sizeof( #NAME ) - 1, RTL_TEXTENCODING_ASCII_US ), \ 367*cdf0e10cSrcweir HANDLE_##NAME, getCppuType( static_cast< TYPE* >( NULL ) ), FLAG ) 368*cdf0e10cSrcweir #define PROPERTY( NAME, TYPE ) PROPERTY_FLAGS( NAME, TYPE, com::sun::star::beans::PropertyAttribute::BOUND ) 369*cdf0e10cSrcweir #define PROPERTY_RO( NAME, TYPE ) PROPERTY_FLAGS( NAME, TYPE, com::sun::star::beans::PropertyAttribute::BOUND | com::sun::star::beans::PropertyAttribute::READONLY ) 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir #endif 372