1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _CPPUHELPER_PROPSHLP_HXX
21 #define _CPPUHELPER_PROPSHLP_HXX
23 #include <rtl/alloc.h>
25 #include <cppuhelper/interfacecontainer.hxx>
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>
33 #include "cppuhelperdllapi.h"
40 /*************************************************************************
41 *************************************************************************/
45 This interface is used by the OPropertyHelper, to access the property description.
47 class CPPUHELPER_DLLPUBLIC IPropertyArrayHelper
50 // these are here to force memory de/allocation to sal lib.
51 inline static void * SAL_CALL
operator new( size_t nSize
) SAL_THROW(())
52 { return ::rtl_allocateMemory( nSize
); }
53 inline static void SAL_CALL
operator delete( void * pMem
) SAL_THROW(())
54 { ::rtl_freeMemory( pMem
); }
55 inline static void * SAL_CALL
operator new( size_t, void * pMem
) SAL_THROW(())
57 inline static void SAL_CALL
operator delete( void *, void * ) SAL_THROW(())
61 Following the rule, the first virtual method implies a virtual destructor.
63 virtual ~IPropertyArrayHelper();
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.
76 virtual sal_Bool SAL_CALL
fillPropertyMembersByHandle(
77 ::rtl::OUString
* pPropName
, sal_Int16
* pAttributes
, sal_Int32 nHandle
) = 0;
79 Return the sequence of properties. The sequence is sorted by name.
81 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
getProperties(void) = 0;
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.
87 virtual ::com::sun::star::beans::Property SAL_CALL
getPropertyByName(
88 const ::rtl::OUString
& rPropertyName
)
89 throw (::com::sun::star::beans::UnknownPropertyException
) = 0;
91 Return true if the property with the name rPropertyName exist, otherwise false.
92 @param rPropertyName the name of the property.
94 virtual sal_Bool SAL_CALL
hasPropertyByName(const ::rtl::OUString
& rPropertyName
) = 0;
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.
100 virtual sal_Int32 SAL_CALL
getHandleByName( const ::rtl::OUString
& rPropertyName
) = 0;
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.
106 virtual sal_Int32 SAL_CALL
fillHandles(
107 /*out*/ sal_Int32
* pHandles
, const ::com::sun::star::uno::Sequence
< ::rtl::OUString
> & rPropNames
) = 0;
111 You can use this helper class to map a XPropertySet-Interface to a XFast-
112 or a XMultiPropertySet interface.
114 class CPPUHELPER_DLLPUBLIC OPropertyArrayHelper
: public IPropertyArrayHelper
118 Create an object which supports the common property interfaces.
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.
125 OPropertyArrayHelper(
126 ::com::sun::star::beans::Property
*pProps
,
127 sal_Int32 nElements
,
128 sal_Bool bSorted
= sal_True
)
132 Create an object which supports the common property interfaces.
133 @param aProps sequence of properties which are supported by this helper.
134 The sequence aProps should be sorted.
135 @param bSorted indicates that the elements are sorted.
137 OPropertyArrayHelper(
138 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> & aProps
,
139 sal_Bool bSorted
= sal_True
)
143 Return the number of properties.
145 sal_Int32 SAL_CALL
getCount() const SAL_THROW(());
147 Return the property members Name and Attribute from the handle nHandle.
148 @param nHandle the handle of a property. If the values of the handles
149 are sorted in the same way as the names and the highest handle value
150 is getCount() -1, than it is only an indexed acces to the property array.
151 Otherwise it is a linear search through the array.
152 @param pPropName is an out parameter filled with property name of the property with the
153 handle nHandle. May be NULL.
154 @param pAttributes is an out parameter filled with attributes of the property with the
155 handle nHandle. May be NULL.
156 @return True, if the handle exist, otherwise false.
158 virtual sal_Bool SAL_CALL
fillPropertyMembersByHandle(
159 ::rtl::OUString
* pPropName
, sal_Int16
* pAttributes
, sal_Int32 nHandle
);
161 Return the sequence of properties. The sequence is sorted by name.
163 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
getProperties(void);
165 Return the property with the name rPropertyName.
166 @param rPropertyName the name of the property.
167 @exception UnknownPropertyException thrown if the property name is unknown.
169 virtual ::com::sun::star::beans::Property SAL_CALL
getPropertyByName(
170 const ::rtl::OUString
& rPropertyName
)
171 throw (::com::sun::star::beans::UnknownPropertyException
);
173 Return true if the property with the name rPropertyName exist, otherwise false.
174 @param rPropertyName the name of the property.
176 virtual sal_Bool SAL_CALL
hasPropertyByName(const ::rtl::OUString
& rPropertyName
);
178 Return the handle of the property with the name rPropertyName.
179 If the property does not exist -1 is returned.
180 @param rPropertyName the name of the property.
182 virtual sal_Int32 SAL_CALL
getHandleByName( const ::rtl::OUString
& rPropertyName
);
184 Fill the array with the handles of the properties.
185 @return the handles of the names from the pHandles array. -1
186 indicates an unknown property name.
188 virtual sal_Int32 SAL_CALL
fillHandles(
189 /*out*/sal_Int32
* pHandles
, const ::com::sun::star::uno::Sequence
< ::rtl::OUString
> & rPropNames
);
192 /** reserved for future use. do not use.
197 void init( sal_Bool bSorted
) SAL_THROW(());
199 /** The sequence generated from the pProperties array. */
200 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> aInfos
;
203 True, If the values of the handles are sorted in the same way as the names
204 and the highest handle value is getCount() -1, otherwise false.
206 sal_Bool bRightOrdered
;
210 //-----------------------------------------------------------------------------
211 // helper defines needed for an interface container with a 32 bit key values
213 struct equalInt32_Impl
215 bool operator()(const sal_Int32
& i1
, const sal_Int32
& i2
) const SAL_THROW(())
219 struct hashInt32_Impl
221 size_t operator()(const sal_Int32
& i
) const SAL_THROW(())
224 /** Specialized class for key type sal_Int32,
225 without explicit usage of STL symbols.
227 class CPPUHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelperInt32
230 // these are here to force memory de/allocation to sal lib.
231 inline static void * SAL_CALL
operator new( size_t nSize
) SAL_THROW(())
232 { return ::rtl_allocateMemory( nSize
); }
233 inline static void SAL_CALL
operator delete( void * pMem
) SAL_THROW(())
234 { ::rtl_freeMemory( pMem
); }
235 inline static void * SAL_CALL
operator new( size_t, void * pMem
) SAL_THROW(())
237 inline static void SAL_CALL
operator delete( void *, void * ) SAL_THROW(())
241 Create a container of interface containers.
243 @param rMutex the mutex to protect multi thread access.
244 The lifetime must be longer than the lifetime
247 OMultiTypeInterfaceContainerHelperInt32( ::osl::Mutex
& rMutex
) SAL_THROW(());
249 Delete all containers.
251 ~OMultiTypeInterfaceContainerHelperInt32() SAL_THROW(());
254 Return all id's under which at least one interface is added.
256 ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
getContainedTypes() const SAL_THROW(());
259 Return the container created under this key.
260 @return the container created under this key. If the container
261 was not created, null was returned.
263 OInterfaceContainerHelper
* SAL_CALL
getContainer( const sal_Int32
& rKey
) const SAL_THROW(());
266 Insert an element in the container specified with the key. The position is not specified.
267 @param rKey the id of the container.
268 @param r the added interface. It is allowed to insert null or
269 the same pointer more than once.
270 @return the new count of elements in the container.
272 sal_Int32 SAL_CALL
addInterface(
273 const sal_Int32
& rKey
,
274 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> & r
)
278 Remove an element from the container specified with the key.
279 It uses the equal definition of uno objects to remove the interfaces.
280 @param rKey the id of the container.
281 @param rxIFace the removed interface.
282 @return the new count of elements in the container.
284 sal_Int32 SAL_CALL
removeInterface(
285 const sal_Int32
& rKey
,
286 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> & rxIFace
)
290 Call disposing on all objects in the container that
291 support XEventListener. Then clear the container.
293 void SAL_CALL
disposeAndClear( const ::com::sun::star::lang::EventObject
& rEvt
) SAL_THROW(());
295 Remove all elements of all containers. Does not delete the container.
297 void SAL_CALL
clear() SAL_THROW(());
299 typedef sal_Int32 keyType
;
302 ::osl::Mutex
& rMutex
;
304 inline OMultiTypeInterfaceContainerHelperInt32( const OMultiTypeInterfaceContainerHelperInt32
& ) SAL_THROW(());
305 inline OMultiTypeInterfaceContainerHelperInt32
& operator = ( const OMultiTypeInterfaceContainerHelperInt32
& ) SAL_THROW(());
309 /** An interface to extend event notification actions.
311 class IEventNotificationHook
315 Method to be called by OPropertySetHelper::fire.
317 @param bIgnoreRuntimeExceptionsWhileFiring
318 indicates whether occuring RuntimeExceptions shall be
319 ignored when firing notifications
320 @param pnHandles the id's of the properties that changed.
321 @param nCount the number of elements in the arrays pnHandles, pNewValues and pOldValues.
322 @param bVetoable true means fire to VetoableChangeListener, false means fire to
323 XPropertyChangedListener and XMultiPropertyChangedListener.
324 @param bIgnoreRuntimeExceptionsWhileFiring
325 indicates whether occurring RuntimeExceptions will be
326 ignored when firing notifications
327 (vetoableChange(), propertyChange())
329 PropertyVetoExceptions may still be thrown.
330 This flag is useful in an inter-process scenario when
331 remote bridges may break down
332 (firing DisposedExceptions).
334 @see OPropertySetHelper::fire
336 virtual void fireEvents(
337 sal_Int32
* pnHandles
,
340 bool bIgnoreRuntimeExceptionsWhileFiring
) = 0;
342 #if !defined _MSC_VER // public -> protected changes mangled names there
345 ~IEventNotificationHook() {}
346 // avoid warnings about virtual members and non-virtual dtor
352 This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet
353 and XPropertySet to the methods getInfoHelper, convertFastPropertyValue,
354 setFastPropertyValue_NoBroadcast and getFastPropertyValue. You must derive from
355 this class and overload the methods.
356 It provides a standard implementation of the XPropertySetInfo.
357 The XPropertiesChangeListener are inserted in the rBHelper.aLC structure.
358 The XPropertyChangeListener and XVetoableChangeListener with no names are inserted
359 in the rBHelper.aLC structure. So it is possible to advise property listeners with
360 the connection point interfaces. But only listeners that listen to all property changes.
363 class CPPUHELPER_DLLPUBLIC OPropertySetHelper
:
364 public ::com::sun::star::beans::XMultiPropertySet
,
365 public ::com::sun::star::beans::XFastPropertySet
,
366 public ::com::sun::star::beans::XPropertySet
370 @param rBHelper this structure contains the basic members of
372 The lifetime must be longer than the lifetime
373 of this object. Stored in the variable rBHelper.
375 OPropertySetHelper( OBroadcastHelper
& rBHelper
) SAL_THROW(());
380 this structure contains the basic members of
382 The lifetime must be longer than the lifetime
383 of this object. Stored in the variable rBHelper.
385 @param bIgnoreRuntimeExceptionsWhileFiring
386 indicates whether occurring RuntimeExceptions will be
387 ignored when firing notifications
388 (vetoableChange(), propertyChange())
390 PropertyVetoExceptions may still be thrown.
391 This flag is useful in an inter-process scenario when
392 remote bridges may break down
393 (firing DisposedExceptions).
396 OBroadcastHelper
& rBHelper
, bool bIgnoreRuntimeExceptionsWhileFiring
);
401 this structure contains the basic members of
403 The lifetime must be longer than the lifetime
404 of this object. Stored in the variable rBHelper.
407 additional event notifier
409 @param bIgnoreRuntimeExceptionsWhileFiring
410 indicates whether occurring RuntimeExceptions will be
411 ignored when firing notifications
412 (vetoableChange(), propertyChange())
414 PropertyVetoExceptions may still be thrown.
415 This flag is useful in an inter-process scenario when
416 remote bridges may break down
417 (firing DisposedExceptions).
420 OBroadcastHelper
& rBHelper
,
421 IEventNotificationHook
*i_pFireEvents
,
422 bool bIgnoreRuntimeExceptionsWhileFiring
= false);
425 Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and
428 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
429 throw (::com::sun::star::uno::RuntimeException
);
431 /** eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet
433 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> getTypes()
434 throw(::com::sun::star::uno::RuntimeException
);
437 Send a disposing notification to the listeners in the conatiners aBoundLC
440 @see OComponentHelper
442 void SAL_CALL
disposing() SAL_THROW(());
445 Throw UnknownPropertyException or PropertyVetoException if the property with the name
446 rPropertyName does not exist or is readonly. Otherwise rPropertyName is changed to its handle
447 value and setFastPropertyValue is called.
449 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& rPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
450 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
);
452 Throw UnknownPropertyException if the property with the name
453 rPropertyName does not exist.
455 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(const ::rtl::OUString
& aPropertyName
)
456 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
457 /** Ignored if the property is not bound. */
458 virtual void SAL_CALL
addPropertyChangeListener(
459 const ::rtl::OUString
& aPropertyName
,
460 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
461 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
463 /** Ignored if the property is not bound. */
464 virtual void SAL_CALL
removePropertyChangeListener(
465 const ::rtl::OUString
& aPropertyName
,
466 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
467 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
469 /** Ignored if the property is not constrained. */
470 virtual void SAL_CALL
addVetoableChangeListener(
471 const ::rtl::OUString
& aPropertyName
,
472 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
473 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
475 /** Ignored if the property is not constrained. */
476 virtual void SAL_CALL
removeVetoableChangeListener(
477 const ::rtl::OUString
& aPropertyName
,
478 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
> & aListener
)
479 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
482 Throw UnknownPropertyException or PropertyVetoException if the property with the name
483 rPropertyName does not exist or is readonly. Otherwise the method convertFastPropertyValue
484 is called, then the vetoable listeners are notified. After this the value of the property
485 is changed with the setFastPropertyValue_NoBroadcast method and the bound listeners are
488 virtual void SAL_CALL
setFastPropertyValue( sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
)
489 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
);
492 @exception com::sun::star::beans::UnknownPropertyException
493 if the property with the handle nHandle does not exist.
495 virtual ::com::sun::star::uno::Any SAL_CALL
getFastPropertyValue( sal_Int32 nHandle
)
496 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
499 virtual void SAL_CALL
setPropertyValues(
500 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& PropertyNames
,
501 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Values
)
502 throw(::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
504 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getPropertyValues(
505 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& PropertyNames
)
506 throw(::com::sun::star::uno::RuntimeException
);
508 virtual void SAL_CALL
addPropertiesChangeListener(
509 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& PropertyNames
,
510 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& Listener
)
511 throw(::com::sun::star::uno::RuntimeException
);
513 virtual void SAL_CALL
removePropertiesChangeListener(
514 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& Listener
)
515 throw(::com::sun::star::uno::RuntimeException
);
517 virtual void SAL_CALL
firePropertiesChangeEvent(
518 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& PropertyNames
,
519 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
> & Listener
)
520 throw(::com::sun::star::uno::RuntimeException
);
523 The property sequence is created in the call. The interface isn't used after the call.
525 static ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
526 createPropertySetInfo( IPropertyArrayHelper
& rProperties
) SAL_THROW(());
529 This method fire events to all registered property listeners.
530 @param pnHandles the id's of the properties that changed.
531 @param pNewValues the new values of the properties.
532 @param pOldValues the old values of the properties.
533 @param nCount the number of elements in the arrays pnHandles, pNewValues and pOldValues.
534 @param bVetoable true means fire to VetoableChangeListener, false means fire to
535 XPropertyChangedListener and XMultiPropertyChangedListener.
538 sal_Int32
* pnHandles
,
539 const ::com::sun::star::uno::Any
* pNewValues
,
540 const ::com::sun::star::uno::Any
* pOldValues
,
542 sal_Bool bVetoable
);
545 Set multiple properties with the handles.
546 @param nSeqLen the length of the arrays pHandles and Values.
547 @param pHandles the handles of the properties. The number of elements
548 in the Values sequence is the length of the handle array. A value of -1
549 of a handle means invalid property. These are ignored.
550 @param pValues the values of the properties.
551 @param nHitCount the number of valid entries in the handle array.
553 void SAL_CALL
setFastPropertyValues(
555 sal_Int32
* pHandles
,
556 const ::com::sun::star::uno::Any
* pValues
,
557 sal_Int32 nHitCount
)
558 SAL_THROW( (::com::sun::star::uno::Exception
) );
561 This abstract method must return the name to index table. This table contains all property
562 names and types of this object. The method is not implemented in this class.
564 virtual IPropertyArrayHelper
& SAL_CALL
getInfoHelper() = 0;
567 Converted the value rValue and return the result in rConvertedValue and the
568 old value in rOldValue. A IllegalArgumentException is thrown.
569 The method is not implemented in this class. After this call the vetoable
570 listeners are notified.
572 @param rConvertedValue the converted value. Only set if return is true.
573 @param rOldValue the old value. Only set if return is true.
574 @param nHandle the handle of the proberty.
575 @param rValue the value to be converted
576 @return true if the value converted.
578 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
579 ::com::sun::star::uno::Any
& rConvertedValue
,
580 ::com::sun::star::uno::Any
& rOldValue
,
582 const ::com::sun::star::uno::Any
& rValue
)
583 throw (::com::sun::star::lang::IllegalArgumentException
) = 0;
585 /** The same as setFastProperyValue; nHandle is always valid.
586 The changes must not be broadcasted in this method.
587 The method is implemented in a derived class.
590 Although you are permitted to throw any UNO exception, only the following
592 -- com::sun::star::beans::UnknownPropertyException
593 -- com::sun::star::beans::PropertyVetoException
594 -- com::sun::star::lang::IllegalArgumentException
595 -- com::sun::star::lang::WrappedTargetException
596 -- com::sun::star::uno::RuntimeException
603 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
605 const ::com::sun::star::uno::Any
& rValue
)
606 throw (::com::sun::star::uno::Exception
) = 0;
608 The same as getFastProperyValue, but return the value through rValue and nHandle
610 The method is not implemented in this class.
612 virtual void SAL_CALL
getFastPropertyValue(
613 ::com::sun::star::uno::Any
& rValue
,
614 sal_Int32 nHandle
) const = 0;
616 /** sets an dependent property's value
618 <p>Sometimes setting a given property needs to implicitly modify another property's value. Calling |setPropertyValue|
619 from within |setFastPropertyValue_NoBroadcast| is not an option here, as it would notify the property listeners
620 while our mutex is still locked. Setting the dependent property's value directly (e.g. by calling |setFastPropertyValue_NoBroadcast|
621 recursively) is not an option, too, since it would miss firing the property change event.</p>
623 <p>So, in such cases, you use |setDependentFastPropertyValue| from within |setFastPropertyValue_NoBroadcast|.
624 It will convert and actually set the property value (invoking |convertFastPropertyValue| and |setFastPropertyValue_NoBroadcast|
625 for the given handle and value), and add the property change event to the list of events to be notified
626 when the bottom-most |setFastPropertyValue_NoBroadcast| on the stack returns.</p>
628 <p><strong>Note</strong>: The method will <em>not</em> invoke veto listeners for the property.</p>
630 <p><strong>Note</strong>: It's the caller's responsibility to ensure that our mutex is locked. This is
631 canonically given when the method is invoked from within |setFastPropertyValue_NoBroadcast|, in other
632 contexts, you might need to take own measures.</p>
634 void setDependentFastPropertyValue(
636 const ::com::sun::star::uno::Any
& i_value
639 /** The common data of a broadcaster. Use the mutex, disposing state and the listener container. */
640 OBroadcastHelper
&rBHelper
;
642 Container for the XProperyChangedListener. The listeners are inserted by handle.
644 OMultiTypeInterfaceContainerHelperInt32 aBoundLC
;
646 Container for the XPropertyVetoableListener. The listeners are inserted by handle.
648 OMultiTypeInterfaceContainerHelperInt32 aVetoableLC
;
652 /** reserved for future use. finally, the future has arrived...
654 const std::auto_ptr
<Impl
> m_pReserved
;
657 OPropertySetHelper( const OPropertySetHelper
& ) SAL_THROW(());
658 OPropertySetHelper
& operator = ( const OPropertySetHelper
& ) SAL_THROW(());
660 /** notifies the given changes in property's values, <em>plus</em> all property changes collected during recent
661 |setDependentFastPropertyValue| calls.
664 sal_Int32
* i_handles
,
665 const ::com::sun::star::uno::Any
* i_newValues
,
666 const ::com::sun::star::uno::Any
* i_oldValues
,
670 #if defined _MSC_VER // public -> protected changes mangled names there
675 // Suppress warning about virtual functions but non-virtual destructor:
677 #pragma warning(push)
678 #pragma warning(disable: 4265)
681 You must call disposing before destruction.
683 ~OPropertySetHelper() SAL_THROW(());
690 OPropertySetHelper plus XPropertySetOption
692 class CPPUHELPER_DLLPUBLIC OPropertySetHelper2
: public OPropertySetHelper
,
693 public ::com::sun::star::beans::XPropertySetOption
698 See OPropertySetHelper constructors documentation
700 explicit OPropertySetHelper2(
701 OBroadcastHelper
& rBHelper
,
702 IEventNotificationHook
*i_pFireEvents
= NULL
,
703 bool bIgnoreRuntimeExceptionsWhileFiring
= false);
706 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
707 throw (::com::sun::star::uno::RuntimeException
);
709 // XPropertySetOption
710 virtual void SAL_CALL
enableChangeListenerNotification( sal_Bool bEnable
)
711 throw(::com::sun::star::uno::RuntimeException
);
716 OPropertySetHelper2( const OPropertySetHelper2
& ) SAL_THROW(());
717 OPropertySetHelper2
& operator = ( const OPropertySetHelper2
& ) SAL_THROW(());
719 #if defined _MSC_VER // public -> protected changes mangled names there
724 // Suppress warning about virtual functions but non-virtual destructor:
726 You must call disposing before destruction.
728 virtual ~OPropertySetHelper2() SAL_THROW(());
731 } // end namespace cppuhelper
736 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */