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 INCLUDED_CPPUHELPER_PROPSHLP_HXX
21 #define INCLUDED_CPPUHELPER_PROPSHLP_HXX
23 #include <rtl/alloc.h>
25 #include <cppuhelper/interfacecontainer.h>
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>
32 #include <cppuhelper/cppuhelperdllapi.h>
39 /*************************************************************************
40 *************************************************************************/
44 This interface is used by the OPropertyHelper, to access the property description.
46 class CPPUHELPER_DLLPUBLIC IPropertyArrayHelper
49 // these are here to force memory de/allocation to sal lib.
50 inline static void * SAL_CALL
operator new( size_t nSize
)
51 { return ::rtl_allocateMemory( nSize
); }
52 inline static void SAL_CALL
operator delete( void * pMem
)
53 { ::rtl_freeMemory( pMem
); }
54 inline static void * SAL_CALL
operator new( size_t, void * pMem
)
56 inline static void SAL_CALL
operator delete( void *, void * )
60 Following the rule, the first virtual method implies a virtual destructor.
62 virtual ~IPropertyArrayHelper();
65 Return the property members Name and Attribute from the handle nHandle.
66 @param nHandle the handle of a property. If the values of the handles
67 are sorted in the same way as the names and the highest handle value
68 is getCount() -1, than it must be an indexed access to the property array.
69 @param pPropName is an out parameter filled with property name of the property with the
70 handle nHandle. May be NULL.
71 @param pAttributes is an out parameter filled with attributes of the property with the
72 handle nHandle. May be NULL.
73 @return True, if the handle exist, otherwise false.
75 virtual sal_Bool SAL_CALL
fillPropertyMembersByHandle(
76 ::rtl::OUString
* pPropName
, sal_Int16
* pAttributes
, sal_Int32 nHandle
) = 0;
78 Return the sequence of properties. The sequence is sorted by name.
80 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
getProperties() = 0;
82 Return the property with the name rPropertyName.
83 @param rPropertyName the name of the property.
84 @exception UnknownPropertyException thrown if the property name is unknown.
86 virtual ::com::sun::star::beans::Property SAL_CALL
getPropertyByName(
87 const ::rtl::OUString
& rPropertyName
)
88 throw (::com::sun::star::beans::UnknownPropertyException
) = 0;
90 Return true if the property with the name rPropertyName exist, otherwise false.
91 @param rPropertyName the name of the property.
93 virtual sal_Bool SAL_CALL
hasPropertyByName(const ::rtl::OUString
& rPropertyName
) = 0;
95 Return the handle of the property with the name rPropertyName.
96 If the property does not exist -1 is returned.
97 @param rPropertyName the name of the property.
99 virtual sal_Int32 SAL_CALL
getHandleByName( const ::rtl::OUString
& rPropertyName
) = 0;
101 Fill the array with the handles of the properties.
102 @return the handles of the names from the pHandles array. -1
103 indicates an unknown property name.
105 virtual sal_Int32 SAL_CALL
fillHandles(
106 /*out*/ sal_Int32
* pHandles
, const ::com::sun::star::uno::Sequence
< ::rtl::OUString
> & rPropNames
) = 0;
110 You can use this helper class to map a XPropertySet-Interface to a XFast-
111 or a XMultiPropertySet interface.
113 class CPPUHELPER_DLLPUBLIC OPropertyArrayHelper
: public IPropertyArrayHelper
117 Create an object which supports the common property interfaces.
119 @param pProps array of properties
120 The array pProps should be sorted.
121 @param nElements is the number of properties in the pProps structure.
122 @param bSorted indicates that the elements are sorted.
124 OPropertyArrayHelper(
125 ::com::sun::star::beans::Property
*pProps
,
126 sal_Int32 nElements
,
127 sal_Bool bSorted
= sal_True
);
130 Create an object which supports the common property interfaces.
131 @param aProps sequence of properties which are supported by this helper.
132 The sequence aProps should be sorted.
133 @param bSorted indicates that the elements are sorted.
135 OPropertyArrayHelper(
136 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> & aProps
,
137 sal_Bool bSorted
= sal_True
);
140 Return the number of properties.
142 sal_Int32 SAL_CALL
getCount() const;
144 Return the property members Name and Attribute from the handle nHandle.
145 @param nHandle the handle of a property. If the values of the handles
146 are sorted in the same way as the names and the highest handle value
147 is getCount() -1, than it is only an indexed access to the property array.
148 Otherwise it is a linear search through the array.
149 @param pPropName is an out parameter filled with property name of the property with the
150 handle nHandle. May be NULL.
151 @param pAttributes is an out parameter filled with attributes of the property with the
152 handle nHandle. May be NULL.
153 @return True, if the handle exist, otherwise false.
155 virtual sal_Bool SAL_CALL
fillPropertyMembersByHandle(
156 ::rtl::OUString
* pPropName
, sal_Int16
* pAttributes
, sal_Int32 nHandle
) SAL_OVERRIDE
;
158 Return the sequence of properties. The sequence is sorted by name.
160 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
getProperties() SAL_OVERRIDE
;
162 Return the property with the name rPropertyName.
163 @param rPropertyName the name of the property.
164 @exception UnknownPropertyException thrown if the property name is unknown.
166 virtual ::com::sun::star::beans::Property SAL_CALL
getPropertyByName(
167 const ::rtl::OUString
& rPropertyName
)
168 throw (::com::sun::star::beans::UnknownPropertyException
) SAL_OVERRIDE
;
170 Return true if the property with the name rPropertyName exist, otherwise false.
171 @param rPropertyName the name of the property.
173 virtual sal_Bool SAL_CALL
hasPropertyByName(const ::rtl::OUString
& rPropertyName
) SAL_OVERRIDE
;
175 Return the handle of the property with the name rPropertyName.
176 If the property does not exist -1 is returned.
177 @param rPropertyName the name of the property.
179 virtual sal_Int32 SAL_CALL
getHandleByName( const ::rtl::OUString
& rPropertyName
) SAL_OVERRIDE
;
181 Fill the array with the handles of the properties.
182 @return the handles of the names from the pHandles array. -1
183 indicates an unknown property name.
185 virtual sal_Int32 SAL_CALL
fillHandles(
186 /*out*/sal_Int32
* pHandles
, const ::com::sun::star::uno::Sequence
< ::rtl::OUString
> & rPropNames
) SAL_OVERRIDE
;
189 /** reserved for future use. do not use.
194 void init( sal_Bool bSorted
);
196 /** The sequence generated from the pProperties array. */
197 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> aInfos
;
200 True, If the values of the handles are sorted in the same way as the names
201 and the highest handle value is getCount() -1, otherwise false.
203 sal_Bool bRightOrdered
;
208 // helper defines needed for an interface container with a 32 bit key values
210 struct equalInt32_Impl
212 bool operator()(const sal_Int32
& i1
, const sal_Int32
& i2
) const
216 struct hashInt32_Impl
218 size_t operator()(const sal_Int32
& i
) const
221 /** Specialized class for key type sal_Int32,
222 without explicit usage of STL symbols.
224 class CPPUHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelperInt32
227 // these are here to force memory de/allocation to sal lib.
228 inline static void * SAL_CALL
operator new( size_t nSize
)
229 { return ::rtl_allocateMemory( nSize
); }
230 inline static void SAL_CALL
operator delete( void * pMem
)
231 { ::rtl_freeMemory( pMem
); }
232 inline static void * SAL_CALL
operator new( size_t, void * pMem
)
234 inline static void SAL_CALL
operator delete( void *, void * )
238 Create a container of interface containers.
240 @param rMutex the mutex to protect multi thread access.
241 The lifetime must be longer than the lifetime
244 OMultiTypeInterfaceContainerHelperInt32( ::osl::Mutex
& rMutex
);
246 Delete all containers.
248 ~OMultiTypeInterfaceContainerHelperInt32();
251 Return all id's under which at least one interface is added.
253 ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
getContainedTypes() const;
256 Return the container created under this key.
257 @return the container created under this key. If the container
258 was not created, null was returned.
260 OInterfaceContainerHelper
* SAL_CALL
getContainer( const sal_Int32
& rKey
) const;
263 Insert an element in the container specified with the key. The position is not specified.
264 @param rKey the id of the container.
265 @param r the added interface. It is allowed to insert null or
266 the same pointer more than once.
267 @return the new count of elements in the container.
269 sal_Int32 SAL_CALL
addInterface(
270 const sal_Int32
& rKey
,
271 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> & r
);
274 Remove an element from the container specified with the key.
275 It uses the equal definition of uno objects to remove the interfaces.
276 @param rKey the id of the container.
277 @param rxIFace the removed interface.
278 @return the new count of elements in the container.
280 sal_Int32 SAL_CALL
removeInterface(
281 const sal_Int32
& rKey
,
282 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> & rxIFace
);
285 Call disposing on all objects in the container that
286 support XEventListener. Then clear the container.
288 void SAL_CALL
disposeAndClear( const ::com::sun::star::lang::EventObject
& rEvt
);
290 Remove all elements of all containers. Does not delete the container.
292 void SAL_CALL
clear();
294 typedef sal_Int32 keyType
;
297 ::osl::Mutex
& rMutex
;
299 OMultiTypeInterfaceContainerHelperInt32( const OMultiTypeInterfaceContainerHelperInt32
& ) SAL_DELETED_FUNCTION
;
300 OMultiTypeInterfaceContainerHelperInt32
& operator = ( const OMultiTypeInterfaceContainerHelperInt32
& )SAL_DELETED_FUNCTION
;
304 /** An interface to extend event notification actions.
306 class IEventNotificationHook
310 Method to be called by OPropertySetHelper::fire.
312 @param bIgnoreRuntimeExceptionsWhileFiring
313 indicates whether occurring RuntimeExceptions shall be
314 ignored when firing notifications
315 @param pnHandles the id's of the properties that changed.
316 @param nCount the number of elements in the arrays pnHandles, pNewValues and pOldValues.
317 @param bVetoable true means fire to VetoableChangeListener, false means fire to
318 XPropertyChangedListener and XMultiPropertyChangedListener.
319 @param bIgnoreRuntimeExceptionsWhileFiring
320 indicates whether occurring RuntimeExceptions will be
321 ignored when firing notifications
322 (vetoableChange(), propertyChange())
324 PropertyVetoExceptions may still be thrown.
325 This flag is useful in an inter-process scenario when
326 remote bridges may break down
327 (firing DisposedExceptions).
329 @see OPropertySetHelper::fire
331 virtual void fireEvents(
332 sal_Int32
* pnHandles
,
335 bool bIgnoreRuntimeExceptionsWhileFiring
) = 0;
337 #if !defined _MSC_VER // public -> protected changes mangled names there
340 ~IEventNotificationHook() {}
341 // avoid warnings about virtual members and non-virtual dtor
347 This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet
348 and XPropertySet to the methods getInfoHelper, convertFastPropertyValue,
349 setFastPropertyValue_NoBroadcast and getFastPropertyValue. You must derive from
350 this class and override the methods.
351 It provides a standard implementation of the XPropertySetInfo.
352 The XPropertiesChangeListener are inserted in the rBHelper.aLC structure.
353 The XPropertyChangeListener and XVetoableChangeListener with no names are inserted
354 in the rBHelper.aLC structure. So it is possible to advise property listeners with
355 the connection point interfaces. But only listeners that listen to all property changes.
358 class CPPUHELPER_DLLPUBLIC OPropertySetHelper
:
359 public ::com::sun::star::beans::XMultiPropertySet
,
360 public ::com::sun::star::beans::XFastPropertySet
,
361 public ::com::sun::star::beans::XPropertySet
365 @param rBHelper this structure contains the basic members of
367 The lifetime must be longer than the lifetime
368 of this object. Stored in the variable rBHelper.
370 OPropertySetHelper( OBroadcastHelper
& rBHelper
);
375 this structure contains the basic members of
377 The lifetime must be longer than the lifetime
378 of this object. Stored in the variable rBHelper.
380 @param bIgnoreRuntimeExceptionsWhileFiring
381 indicates whether occurring RuntimeExceptions will be
382 ignored when firing notifications
383 (vetoableChange(), propertyChange())
385 PropertyVetoExceptions may still be thrown.
386 This flag is useful in an inter-process scenario when
387 remote bridges may break down
388 (firing DisposedExceptions).
391 OBroadcastHelper
& rBHelper
, bool bIgnoreRuntimeExceptionsWhileFiring
);
396 this structure contains the basic members of
398 The lifetime must be longer than the lifetime
399 of this object. Stored in the variable rBHelper.
402 additional event notifier
404 @param bIgnoreRuntimeExceptionsWhileFiring
405 indicates whether occurring RuntimeExceptions will be
406 ignored when firing notifications
407 (vetoableChange(), propertyChange())
409 PropertyVetoExceptions may still be thrown.
410 This flag is useful in an inter-process scenario when
411 remote bridges may break down
412 (firing DisposedExceptions).
415 OBroadcastHelper
& rBHelper
,
416 IEventNotificationHook
*i_pFireEvents
,
417 bool bIgnoreRuntimeExceptionsWhileFiring
= false);
420 Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and
423 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
424 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
426 /** eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet
428 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> getTypes()
429 throw(::com::sun::star::uno::RuntimeException
);
432 Send a disposing notification to the listeners in the conatiners aBoundLC
435 @see OComponentHelper
437 void SAL_CALL
disposing();
440 Throw UnknownPropertyException or PropertyVetoException if the property with the name
441 rPropertyName does not exist or is readonly. Otherwise rPropertyName is changed to its handle
442 value and setFastPropertyValue is called.
444 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& rPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
445 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 Throw UnknownPropertyException if the property with the name
448 rPropertyName does not exist.
450 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(const ::rtl::OUString
& aPropertyName
)
451 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
452 /** Ignored if the property is not bound. */
453 virtual void SAL_CALL
addPropertyChangeListener(
454 const ::rtl::OUString
& aPropertyName
,
455 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
456 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
458 /** Ignored if the property is not bound. */
459 virtual void SAL_CALL
removePropertyChangeListener(
460 const ::rtl::OUString
& aPropertyName
,
461 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
462 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
464 /** Ignored if the property is not constrained. */
465 virtual void SAL_CALL
addVetoableChangeListener(
466 const ::rtl::OUString
& aPropertyName
,
467 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
468 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
470 /** Ignored if the property is not constrained. */
471 virtual void SAL_CALL
removeVetoableChangeListener(
472 const ::rtl::OUString
& aPropertyName
,
473 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
> & aListener
)
474 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
477 Throw UnknownPropertyException or PropertyVetoException if the property with the name
478 rPropertyName does not exist or is readonly. Otherwise the method convertFastPropertyValue
479 is called, then the vetoable listeners are notified. After this the value of the property
480 is changed with the setFastPropertyValue_NoBroadcast method and the bound listeners are
483 virtual void SAL_CALL
setFastPropertyValue( sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
)
484 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
;
487 @exception com::sun::star::beans::UnknownPropertyException
488 if the property with the handle nHandle does not exist.
490 virtual ::com::sun::star::uno::Any SAL_CALL
getFastPropertyValue( sal_Int32 nHandle
)
491 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
494 virtual void SAL_CALL
setPropertyValues(
495 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& PropertyNames
,
496 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Values
)
497 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 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getPropertyValues(
500 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& PropertyNames
)
501 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
503 virtual void SAL_CALL
addPropertiesChangeListener(
504 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& PropertyNames
,
505 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& Listener
)
506 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
508 virtual void SAL_CALL
removePropertiesChangeListener(
509 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& Listener
)
510 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
512 virtual void SAL_CALL
firePropertiesChangeEvent(
513 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& PropertyNames
,
514 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
> & Listener
)
515 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
518 The property sequence is created in the call. The interface isn't used after the call.
520 static ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
521 createPropertySetInfo( IPropertyArrayHelper
& rProperties
);
524 This method fire events to all registered property listeners.
525 @param pnHandles the id's of the properties that changed.
526 @param pNewValues the new values of the properties.
527 @param pOldValues the old values of the properties.
528 @param nCount the number of elements in the arrays pnHandles, pNewValues and pOldValues.
529 @param bVetoable true means fire to VetoableChangeListener, false means fire to
530 XPropertyChangedListener and XMultiPropertyChangedListener.
533 sal_Int32
* pnHandles
,
534 const ::com::sun::star::uno::Any
* pNewValues
,
535 const ::com::sun::star::uno::Any
* pOldValues
,
537 sal_Bool bVetoable
);
540 Set multiple properties with the handles.
541 @param nSeqLen the length of the arrays pHandles and Values.
542 @param pHandles the handles of the properties. The number of elements
543 in the Values sequence is the length of the handle array. A value of -1
544 of a handle means invalid property. These are ignored.
545 @param pValues the values of the properties.
546 @param nHitCount the number of valid entries in the handle array.
548 void SAL_CALL
setFastPropertyValues(
550 sal_Int32
* pHandles
,
551 const ::com::sun::star::uno::Any
* pValues
,
552 sal_Int32 nHitCount
);
555 This abstract method must return the name to index table. This table contains all property
556 names and types of this object. The method is not implemented in this class.
558 virtual IPropertyArrayHelper
& SAL_CALL
getInfoHelper() = 0;
561 Converted the value rValue and return the result in rConvertedValue and the
562 old value in rOldValue. A IllegalArgumentException is thrown.
563 The method is not implemented in this class. After this call the vetoable
564 listeners are notified.
566 @param rConvertedValue the converted value. Only set if return is true.
567 @param rOldValue the old value. Only set if return is true.
568 @param nHandle the handle of the proberty.
569 @param rValue the value to be converted
570 @return true if the value converted.
572 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
573 ::com::sun::star::uno::Any
& rConvertedValue
,
574 ::com::sun::star::uno::Any
& rOldValue
,
576 const ::com::sun::star::uno::Any
& rValue
)
577 throw (css::lang::IllegalArgumentException
,
578 css::beans::UnknownPropertyException
,
579 css::uno::RuntimeException
, std::exception
) = 0;
581 /** The same as setFastProperyValue; nHandle is always valid.
582 The changes must not be broadcasted in this method.
583 The method is implemented in a derived class.
586 Although you are permitted to throw any UNO exception, only the following
588 -- com::sun::star::beans::UnknownPropertyException
589 -- com::sun::star::beans::PropertyVetoException
590 -- com::sun::star::lang::IllegalArgumentException
591 -- com::sun::star::lang::WrappedTargetException
592 -- com::sun::star::uno::RuntimeException
599 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
601 const ::com::sun::star::uno::Any
& rValue
)
602 throw (::com::sun::star::uno::Exception
,
605 The same as getFastProperyValue, but return the value through rValue and nHandle
607 The method is not implemented in this class.
609 virtual void SAL_CALL
getFastPropertyValue(
610 ::com::sun::star::uno::Any
& rValue
,
611 sal_Int32 nHandle
) const = 0;
613 /** sets an dependent property's value
615 <p>Sometimes setting a given property needs to implicitly modify another property's value. Calling |setPropertyValue|
616 from within |setFastPropertyValue_NoBroadcast| is not an option here, as it would notify the property listeners
617 while our mutex is still locked. Setting the dependent property's value directly (e.g. by calling |setFastPropertyValue_NoBroadcast|
618 recursively) is not an option, too, since it would miss firing the property change event.</p>
620 <p>So, in such cases, you use |setDependentFastPropertyValue| from within |setFastPropertyValue_NoBroadcast|.
621 It will convert and actually set the property value (invoking |convertFastPropertyValue| and |setFastPropertyValue_NoBroadcast|
622 for the given handle and value), and add the property change event to the list of events to be notified
623 when the bottom-most |setFastPropertyValue_NoBroadcast| on the stack returns.</p>
625 <p><strong>Note</strong>: The method will <em>not</em> invoke veto listeners for the property.</p>
627 <p><strong>Note</strong>: It's the caller's responsibility to ensure that our mutex is locked. This is
628 canonically given when the method is invoked from within |setFastPropertyValue_NoBroadcast|, in other
629 contexts, you might need to take own measures.</p>
631 void setDependentFastPropertyValue(
633 const ::com::sun::star::uno::Any
& i_value
636 /** The common data of a broadcaster. Use the mutex, disposing state and the listener container. */
637 OBroadcastHelper
&rBHelper
;
639 Container for the XProperyChangedListener. The listeners are inserted by handle.
641 OMultiTypeInterfaceContainerHelperInt32 aBoundLC
;
643 Container for the XPropertyVetoableListener. The listeners are inserted by handle.
645 OMultiTypeInterfaceContainerHelperInt32 aVetoableLC
;
649 /** reserved for future use. finally, the future has arrived...
651 Impl
* const m_pReserved
;
654 OPropertySetHelper( const OPropertySetHelper
& ) SAL_DELETED_FUNCTION
;
655 OPropertySetHelper
& operator = ( const OPropertySetHelper
& )
656 SAL_DELETED_FUNCTION
;
658 /** notifies the given changes in property's values, <em>plus</em> all property changes collected during recent
659 |setDependentFastPropertyValue| calls.
662 sal_Int32
* i_handles
,
663 const ::com::sun::star::uno::Any
* i_newValues
,
664 const ::com::sun::star::uno::Any
* i_oldValues
,
668 #if defined _MSC_VER // public -> protected changes mangled names there
673 // Suppress warning about virtual functions but non-virtual destructor:
675 #pragma warning(push)
676 #pragma warning(disable: 4265)
679 You must call disposing before destruction.
681 ~OPropertySetHelper();
688 OPropertySetHelper plus XPropertySetOption
691 The getTypes() inherited from OPropertysetHelper does not cover
694 class CPPUHELPER_DLLPUBLIC OPropertySetHelper2
: public OPropertySetHelper
,
695 public ::com::sun::star::beans::XPropertySetOption
700 See OPropertySetHelper constructors documentation
702 explicit OPropertySetHelper2(
703 OBroadcastHelper
& rBHelper
,
704 IEventNotificationHook
*i_pFireEvents
= NULL
,
705 bool bIgnoreRuntimeExceptionsWhileFiring
= false);
708 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
709 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
711 // XPropertySetOption
712 virtual void SAL_CALL
enableChangeListenerNotification( sal_Bool bEnable
)
713 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
718 OPropertySetHelper2( const OPropertySetHelper2
& ) SAL_DELETED_FUNCTION
;
719 OPropertySetHelper2
& operator = ( const OPropertySetHelper2
& )
720 SAL_DELETED_FUNCTION
;
722 #if defined _MSC_VER // public -> protected changes mangled names there
727 // Suppress warning about virtual functions but non-virtual destructor:
729 You must call disposing before destruction.
731 virtual ~OPropertySetHelper2();
734 } // end namespace cppuhelper
739 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */