LibreOffice Module cppuhelper (master) 1
|
This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet and XPropertySet to the methods getInfoHelper, convertFastPropertyValue, setFastPropertyValue_NoBroadcast and getFastPropertyValue. More...
#include <propshlp.hxx>
Classes | |
class | Impl |
Public Member Functions | |
OPropertySetHelper (OBroadcastHelper &rBHelper) | |
OPropertySetHelper (OBroadcastHelper &rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring) | |
Constructor. More... | |
OPropertySetHelper (OBroadcastHelper &rBHelper, IEventNotificationHook *i_pFireEvents, bool bIgnoreRuntimeExceptionsWhileFiring=false) | |
Constructor. More... | |
virtual css::uno::Any SAL_CALL | queryInterface (const css::uno::Type &rType) SAL_OVERRIDE |
Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and XEventListener. More... | |
css::uno::Sequence< css::uno::Type > | getTypes () |
eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet More... | |
void SAL_CALL | disposing () |
Send a disposing notification to the listeners in the containers aBoundLC and aVetoableLC. More... | |
virtual void SAL_CALL | setPropertyValue (const ::rtl::OUString &rPropertyName, const css::uno::Any &aValue) SAL_OVERRIDE |
Throw UnknownPropertyException or PropertyVetoException if the property with the name rPropertyName does not exist or is readonly. More... | |
virtual css::uno::Any SAL_CALL | getPropertyValue (const ::rtl::OUString &aPropertyName) SAL_OVERRIDE |
Throw UnknownPropertyException if the property with the name rPropertyName does not exist. More... | |
virtual void SAL_CALL | addPropertyChangeListener (const ::rtl::OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) SAL_OVERRIDE |
Ignored if the property is not bound. More... | |
virtual void SAL_CALL | removePropertyChangeListener (const ::rtl::OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) SAL_OVERRIDE |
Ignored if the property is not bound. More... | |
virtual void SAL_CALL | addVetoableChangeListener (const ::rtl::OUString &aPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) SAL_OVERRIDE |
Ignored if the property is not constrained. More... | |
virtual void SAL_CALL | removeVetoableChangeListener (const ::rtl::OUString &aPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) SAL_OVERRIDE |
Ignored if the property is not constrained. More... | |
virtual void SAL_CALL | setFastPropertyValue (sal_Int32 nHandle, const css::uno::Any &rValue) SAL_OVERRIDE |
Throw UnknownPropertyException or PropertyVetoException if the property with the name rPropertyName does not exist or is readonly. More... | |
virtual css::uno::Any SAL_CALL | getFastPropertyValue (sal_Int32 nHandle) SAL_OVERRIDE |
virtual void SAL_CALL | setPropertyValues (const css::uno::Sequence< ::rtl::OUString > &PropertyNames, const css::uno::Sequence< css::uno::Any > &Values) SAL_OVERRIDE |
The sequence may be contain not known properties. More... | |
virtual css::uno::Sequence< css::uno::Any > SAL_CALL | getPropertyValues (const css::uno::Sequence< ::rtl::OUString > &PropertyNames) SAL_OVERRIDE |
virtual void SAL_CALL | addPropertiesChangeListener (const css::uno::Sequence< ::rtl::OUString > &PropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &Listener) SAL_OVERRIDE |
virtual void SAL_CALL | removePropertiesChangeListener (const css::uno::Reference< css::beans::XPropertiesChangeListener > &Listener) SAL_OVERRIDE |
virtual void SAL_CALL | firePropertiesChangeEvent (const css::uno::Sequence< ::rtl::OUString > &PropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &Listener) SAL_OVERRIDE |
Static Public Member Functions | |
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL | createPropertySetInfo (IPropertyArrayHelper &rProperties) |
The property sequence is created in the call. More... | |
Protected Member Functions | |
void SAL_CALL | fire (sal_Int32 *pnHandles, const css::uno::Any *pNewValues, const css::uno::Any *pOldValues, sal_Int32 nCount, sal_Bool bVetoable) |
This method fire events to all registered property listeners. More... | |
void SAL_CALL | setFastPropertyValues (sal_Int32 nSeqLen, sal_Int32 *pHandles, const css::uno::Any *pValues, sal_Int32 nHitCount) |
Set multiple properties with the handles. More... | |
virtual IPropertyArrayHelper &SAL_CALL | getInfoHelper ()=0 |
This abstract method must return the name to index table. More... | |
virtual sal_Bool SAL_CALL | convertFastPropertyValue (css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue)=0 |
Converted the value rValue and return the result in rConvertedValue and the old value in rOldValue. More... | |
virtual void SAL_CALL | setFastPropertyValue_NoBroadcast (sal_Int32 nHandle, const css::uno::Any &rValue)=0 |
The same as setFastPropertyValue; nHandle is always valid. More... | |
virtual void SAL_CALL | getFastPropertyValue (css::uno::Any &rValue, sal_Int32 nHandle) const =0 |
The same as getFastPropertyValue, but return the value through rValue and nHandle is always valid. More... | |
void | setDependentFastPropertyValue (sal_Int32 i_handle, const css::uno::Any &i_value) |
sets an dependent property's value More... | |
~OPropertySetHelper () | |
You must call disposing before destruction. More... | |
Protected Attributes | |
OBroadcastHelper & | rBHelper |
The common data of a broadcaster. More... | |
OMultiTypeInterfaceContainerHelperInt32 | aBoundLC |
Container for the XPropertyChangedListener. More... | |
OMultiTypeInterfaceContainerHelperInt32 | aVetoableLC |
Container for the XPropertyVetoableListener. More... | |
Impl *const | m_pReserved |
reserved for future use. More... | |
Private Member Functions | |
OPropertySetHelper (const OPropertySetHelper &) SAL_DELETED_FUNCTION | |
OPropertySetHelper & | operator= (const OPropertySetHelper &) SAL_DELETED_FUNCTION |
void | impl_fireAll (sal_Int32 *i_handles, const css::uno::Any *i_newValues, const css::uno::Any *i_oldValues, sal_Int32 i_count) |
notifies the given changes in property's values, plus all property changes collected during recent |setDependentFastPropertyValue| calls. More... | |
This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet and XPropertySet to the methods getInfoHelper, convertFastPropertyValue, setFastPropertyValue_NoBroadcast and getFastPropertyValue.
You must derive from this class and override the methods. It provides a standard implementation of the XPropertySetInfo. The XPropertiesChangeListener are inserted in the rBHelper.aLC structure. The XPropertyChangeListener and XVetoableChangeListener with no names are inserted in the rBHelper.aLC structure. So it is possible to advise property listeners with the connection point interfaces. But only listeners that listen to all property changes.
Definition at line 362 of file propshlp.hxx.
cppu::OPropertySetHelper::OPropertySetHelper | ( | OBroadcastHelper & | rBHelper | ) |
rBHelper | this structure contains the basic members of a broadcaster. The lifetime must be longer than the lifetime of this object. Stored in the variable rBHelper. |
Definition at line 158 of file propshlp.cxx.
cppu::OPropertySetHelper::OPropertySetHelper | ( | OBroadcastHelper & | rBHelper, |
bool | bIgnoreRuntimeExceptionsWhileFiring | ||
) |
Constructor.
rBHelper | this structure contains the basic members of a broadcaster. The lifetime must be longer than the lifetime of this object. Stored in the variable rBHelper. |
bIgnoreRuntimeExceptionsWhileFiring | indicates whether occurring RuntimeExceptions will be ignored when firing notifications (vetoableChange(), propertyChange()) to listeners. PropertyVetoExceptions may still be thrown. This flag is useful in an inter-process scenario when remote bridges may break down (firing DisposedExceptions). |
Definition at line 167 of file propshlp.cxx.
cppu::OPropertySetHelper::OPropertySetHelper | ( | OBroadcastHelper & | rBHelper, |
IEventNotificationHook * | i_pFireEvents, | ||
bool | bIgnoreRuntimeExceptionsWhileFiring = false |
||
) |
Constructor.
rBHelper | this structure contains the basic members of a broadcaster. The lifetime must be longer than the lifetime of this object. Stored in the variable rBHelper. |
i_pFireEvents | additional event notifier |
bIgnoreRuntimeExceptionsWhileFiring | indicates whether occurring RuntimeExceptions will be ignored when firing notifications (vetoableChange(), propertyChange()) to listeners. PropertyVetoExceptions may still be thrown. This flag is useful in an inter-process scenario when remote bridges may break down (firing DisposedExceptions). |
Definition at line 176 of file propshlp.cxx.
|
private |
|
protected |
You must call disposing before destruction.
You must call disposing before.
Definition at line 198 of file propshlp.cxx.
References m_pReserved.
|
virtual |
Definition at line 902 of file propshlp.cxx.
References cppu::OBroadcastHelperVar< container, keyType >::addListener(), and rBHelper.
|
virtual |
Ignored if the property is not bound.
Definition at line 280 of file propshlp.cxx.
References aBoundLC, cppu::OMultiTypeInterfaceContainerHelperInt32::addInterface(), cppu::OBroadcastHelperVar< container, keyType >::aLC, cppu::OBroadcastHelperVar< container, keyType >::bDisposed, cppu::OBroadcastHelperVar< container, keyType >::bInDispose, cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), cppu::IPropertyArrayHelper::getHandleByName(), getInfoHelper(), cppu::getPropertyTypeIdentifier(), nAttributes, nHandle, rBHelper, and cppu::OBroadcastHelperVar< container, keyType >::rMutex.
|
virtual |
Ignored if the property is not constrained.
Definition at line 356 of file propshlp.cxx.
References cppu::OMultiTypeInterfaceContainerHelperInt32::addInterface(), cppu::OBroadcastHelperVar< container, keyType >::aLC, aVetoableLC, cppu::OBroadcastHelperVar< container, keyType >::bDisposed, cppu::OBroadcastHelperVar< container, keyType >::bInDispose, cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), cppu::IPropertyArrayHelper::getHandleByName(), getInfoHelper(), cppu::getVetoableTypeIdentifier(), nAttributes, nHandle, rBHelper, and cppu::OBroadcastHelperVar< container, keyType >::rMutex.
|
protectedpure virtual |
Converted the value rValue and return the result in rConvertedValue and the old value in rOldValue.
An IllegalArgumentException is thrown. The method is not implemented in this class. After this call the vetoable listeners are notified.
rConvertedValue | the converted value. Only set if return is true. |
rOldValue | the old value. Only set if return is true. |
nHandle | the handle of the property. |
rValue | the value to be converted |
css::lang::IllegalArgumentException | |
css::beans::UnknownPropertyException | |
css::uno::RuntimeException |
Referenced by setDependentFastPropertyValue(), setFastPropertyValue(), and setFastPropertyValues().
|
static |
The property sequence is created in the call.
The interface isn't used after the call.
Definition at line 249 of file propshlp.cxx.
void cppu::OPropertySetHelper::disposing | ( | ) |
Send a disposing notification to the listeners in the containers aBoundLC and aVetoableLC.
Definition at line 236 of file propshlp.cxx.
References aBoundLC, aVetoableLC, and cppu::OMultiTypeInterfaceContainerHelperInt32::disposeAndClear().
|
protected |
This method fire events to all registered property listeners.
pnHandles | the id's of the properties that changed. |
pNewValues | the new values of the properties. |
pOldValues | the old values of the properties. |
nCount | the number of elements in the arrays pnHandles, pNewValues and pOldValues. |
bVetoable | true means fire to VetoableChangeListener, false means fire to XPropertyChangedListener and XMultiPropertyChangedListener. |
Definition at line 597 of file propshlp.cxx.
References aBoundLC, cppu::OBroadcastHelperVar< container, keyType >::aLC, aPropName, aVetoableLC, cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), cppu::IEventNotificationHook::fireEvents(), cppu::OMultiTypeInterfaceContainerHelperInt32::getContainer(), getInfoHelper(), cppu::getPropertiesTypeIdentifier(), cppu::getPropertyTypeIdentifier(), cppu::getVetoableTypeIdentifier(), cppu::OInterfaceIteratorHelper::hasMoreElements(), i, cppu::OPropertySetHelper::Impl::m_bFireEvents, cppu::OPropertySetHelper::Impl::m_bIgnoreRuntimeExceptionsWhileFiring, cppu::OPropertySetHelper::Impl::m_pFireEvents, m_pReserved, nAttributes, cppu::OInterfaceIteratorHelper::next(), rBHelper, cppu::OInterfaceIteratorHelper::remove(), SAL_INFO, and XPropertySet.
Referenced by impl_fireAll(), setFastPropertyValue(), and setFastPropertyValues().
|
virtual |
Definition at line 917 of file propshlp.cxx.
References cppu::IPropertyArrayHelper::fillHandles(), getFastPropertyValue(), getInfoHelper(), i, rBHelper, cppu::OBroadcastHelperVar< container, keyType >::rMutex, and XPropertySet.
|
protectedpure virtual |
The same as getFastPropertyValue, but return the value through rValue and nHandle is always valid.
The method is not implemented in this class.
|
virtual |
css::beans::UnknownPropertyException | if the property with the handle nHandle does not exist. |
Definition at line 546 of file propshlp.cxx.
References Any, cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), getFastPropertyValue(), getInfoHelper(), nHandle, rBHelper, and cppu::OBroadcastHelperVar< container, keyType >::rMutex.
Referenced by firePropertiesChangeEvent(), getFastPropertyValue(), getPropertyValue(), and getPropertyValues().
|
protectedpure virtual |
This abstract method must return the name to index table.
This table contains all property names and types of this object. The method is not implemented in this class.
Referenced by addPropertyChangeListener(), addVetoableChangeListener(), fire(), firePropertiesChangeEvent(), getFastPropertyValue(), getPropertyValue(), getPropertyValues(), removePropertyChangeListener(), removeVetoableChangeListener(), setDependentFastPropertyValue(), setFastPropertyValue(), setFastPropertyValues(), setPropertyValue(), and setPropertyValues().
|
virtual |
Throw UnknownPropertyException if the property with the name rPropertyName does not exist.
Definition at line 268 of file propshlp.cxx.
References Any, getFastPropertyValue(), cppu::IPropertyArrayHelper::getHandleByName(), getInfoHelper(), and nHandle.
|
virtual |
Definition at line 880 of file propshlp.cxx.
References Any, cppu::IPropertyArrayHelper::fillHandles(), getFastPropertyValue(), getInfoHelper(), i, pValues, rBHelper, and cppu::OBroadcastHelperVar< container, keyType >::rMutex.
css::uno::Sequence< css::uno::Type > cppu::OPropertySetHelper::getTypes | ( | ) |
eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet
called from the derivee's XTypeProvider::getTypes implementation
css::uno::RuntimeException |
Definition at line 227 of file propshlp.cxx.
References cppu::UnoType< typename T >::get().
|
private |
notifies the given changes in property's values, plus all property changes collected during recent |setDependentFastPropertyValue| calls.
Definition at line 561 of file propshlp.cxx.
References fire(), cppu::OPropertySetHelper::Impl::m_handles, cppu::OPropertySetHelper::Impl::m_newValues, cppu::OPropertySetHelper::Impl::m_oldValues, m_pReserved, rBHelper, and cppu::OBroadcastHelperVar< container, keyType >::rMutex.
Referenced by setFastPropertyValue(), and setFastPropertyValues().
|
private |
|
virtual |
Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and XEventListener.
Reimplemented in cppu::OPropertySetHelper2.
Definition at line 207 of file propshlp.cxx.
References Any, cppu::queryInterface(), and XPropertySet.
Referenced by cppu::OPropertySetHelper2::queryInterface().
|
virtual |
Definition at line 910 of file propshlp.cxx.
References rBHelper, and cppu::OBroadcastHelperVar< container, keyType >::removeListener().
|
virtual |
Ignored if the property is not bound.
Definition at line 325 of file propshlp.cxx.
References aBoundLC, cppu::OBroadcastHelperVar< container, keyType >::aLC, cppu::OBroadcastHelperVar< container, keyType >::bDisposed, cppu::OBroadcastHelperVar< container, keyType >::bInDispose, cppu::IPropertyArrayHelper::getHandleByName(), getInfoHelper(), cppu::getPropertyTypeIdentifier(), nHandle, rBHelper, cppu::OMultiTypeInterfaceContainerHelperInt32::removeInterface(), and cppu::OBroadcastHelperVar< container, keyType >::rMutex.
|
virtual |
Ignored if the property is not constrained.
Definition at line 399 of file propshlp.cxx.
References cppu::OBroadcastHelperVar< container, keyType >::aLC, aVetoableLC, cppu::OBroadcastHelperVar< container, keyType >::bDisposed, cppu::OBroadcastHelperVar< container, keyType >::bInDispose, cppu::IPropertyArrayHelper::getHandleByName(), getInfoHelper(), cppu::getVetoableTypeIdentifier(), nHandle, rBHelper, cppu::OMultiTypeInterfaceContainerHelperInt32::removeInterface(), and cppu::OBroadcastHelperVar< container, keyType >::rMutex.
|
protected |
sets an dependent property's value
Sometimes setting a given property needs to implicitly modify another property's value. Calling |setPropertyValue| from within |setFastPropertyValue_NoBroadcast| is not an option here, as it would notify the property listeners while our mutex is still locked. Setting the dependent property's value directly (e.g. by calling |setFastPropertyValue_NoBroadcast| recursively) is not an option, too, since it would miss firing the property change event.
So, in such cases, you use |setDependentFastPropertyValue| from within |setFastPropertyValue_NoBroadcast|. It will convert and actually set the property value (invoking |convertFastPropertyValue| and |setFastPropertyValue_NoBroadcast| for the given handle and value), and add the property change event to the list of events to be notified when the bottom-most |setFastPropertyValue_NoBroadcast| on the stack returns.
Note: The method will not invoke veto listeners for the property.
Note: It's the caller's responsibility to ensure that our mutex is locked. This is canonically given when the method is invoked from within |setFastPropertyValue_NoBroadcast|, in other contexts, you might need to take own measures.
Definition at line 430 of file propshlp.cxx.
References Any, convertFastPropertyValue(), Exception, cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), cppu::getCaughtException(), getInfoHelper(), cppu::OPropertySetHelper::Impl::m_handles, cppu::OPropertySetHelper::Impl::m_newValues, cppu::OPropertySetHelper::Impl::m_oldValues, m_pReserved, nAttributes, setFastPropertyValue_NoBroadcast(), and XPropertySet.
|
virtual |
Throw UnknownPropertyException or PropertyVetoException if the property with the name rPropertyName does not exist or is readonly.
Otherwise the method convertFastPropertyValue is called, then the vetoable listeners are notified. After this the value of the property is changed with the setFastPropertyValue_NoBroadcast method and the bound listeners are notified.
Definition at line 481 of file propshlp.cxx.
References Any, cppu::OBroadcastHelperVar< container, keyType >::bDisposed, cppu::OBroadcastHelperVar< container, keyType >::bInDispose, convertFastPropertyValue(), cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), fire(), getInfoHelper(), impl_fireAll(), nAttributes, nHandle, rBHelper, cppu::OBroadcastHelperVar< container, keyType >::rMutex, and setFastPropertyValue_NoBroadcast().
Referenced by setPropertyValue().
|
protectedpure virtual |
The same as setFastPropertyValue; nHandle is always valid.
The changes must not be broadcasted in this method. The method is implemented in a derived class.
nHandle | handle |
rValue | value |
css::uno::Exception |
Referenced by setDependentFastPropertyValue(), setFastPropertyValue(), and setFastPropertyValues().
|
protected |
Set multiple properties with the handles.
nSeqLen | the length of the arrays pHandles and Values. |
pHandles | the handles of the properties. The number of elements in the Values sequence is the length of the handle array. A value of -1 of a handle means invalid property. These are ignored. |
pValues | the values of the properties. |
nHitCount | the number of valid entries in the handle array. |
Definition at line 799 of file propshlp.cxx.
References Any, cppu::OBroadcastHelperVar< container, keyType >::bDisposed, cppu::OBroadcastHelperVar< container, keyType >::bInDispose, convertFastPropertyValue(), cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), fire(), getInfoHelper(), i, impl_fireAll(), n, nAttributes, pValues, rBHelper, cppu::OBroadcastHelperVar< container, keyType >::rMutex, and setFastPropertyValue_NoBroadcast().
Referenced by setPropertyValues().
|
virtual |
Throw UnknownPropertyException or PropertyVetoException if the property with the name rPropertyName does not exist or is readonly.
Otherwise rPropertyName is changed to its handle value and setFastPropertyValue is called.
Definition at line 256 of file propshlp.cxx.
References cppu::IPropertyArrayHelper::getHandleByName(), getInfoHelper(), nHandle, and setFastPropertyValue().
|
virtual |
The sequence may be contain not known properties.
The implementation must ignore these properties.
Definition at line 865 of file propshlp.cxx.
References cppu::IPropertyArrayHelper::fillHandles(), getInfoHelper(), and setFastPropertyValues().
|
protected |
Container for the XPropertyChangedListener.
The listeners are inserted by handle.
Definition at line 631 of file propshlp.hxx.
Referenced by addPropertyChangeListener(), disposing(), fire(), and removePropertyChangeListener().
|
protected |
Container for the XPropertyVetoableListener.
The listeners are inserted by handle.
Definition at line 635 of file propshlp.hxx.
Referenced by addVetoableChangeListener(), disposing(), fire(), and removeVetoableChangeListener().
|
protected |
reserved for future use.
finally, the future has arrived...
Definition at line 641 of file propshlp.hxx.
Referenced by cppu::OPropertySetHelper2::enableChangeListenerNotification(), fire(), impl_fireAll(), setDependentFastPropertyValue(), and ~OPropertySetHelper().
|
protected |
The common data of a broadcaster.
Use the mutex, disposing state and the listener container.
Definition at line 627 of file propshlp.hxx.
Referenced by addPropertiesChangeListener(), addPropertyChangeListener(), addVetoableChangeListener(), fire(), firePropertiesChangeEvent(), getFastPropertyValue(), getPropertyValues(), impl_fireAll(), removePropertiesChangeListener(), removePropertyChangeListener(), removeVetoableChangeListener(), setFastPropertyValue(), and setFastPropertyValues().