LibreOffice Module comphelper (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>
Public Member Functions | |
OPropertySetHelper () | |
OPropertySetHelper (bool bIgnoreRuntimeExceptionsWhileFiring) | |
Constructor. More... | |
virtual css::uno::Any SAL_CALL | queryInterface (const css::uno::Type &rType) override |
Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and XEventListener. More... | |
void | disposing (std::unique_lock< std::mutex > &rGuard) |
Send a disposing notification to the listeners. More... | |
virtual void SAL_CALL | setPropertyValue (const ::rtl::OUString &rPropertyName, const css::uno::Any &aValue) override final |
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) override final |
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) override final |
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) override final |
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) override final |
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) override final |
Ignored if the property is not constrained. More... | |
virtual void SAL_CALL | setFastPropertyValue (sal_Int32 nHandle, const css::uno::Any &rValue) override final |
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) override final |
virtual void SAL_CALL | setPropertyValues (const css::uno::Sequence<::rtl::OUString > &PropertyNames, const css::uno::Sequence< css::uno::Any > &Values) override |
virtual css::uno::Sequence< css::uno::Any > SAL_CALL | getPropertyValues (const css::uno::Sequence<::rtl::OUString > &PropertyNames) override final |
virtual void SAL_CALL | addPropertiesChangeListener (const css::uno::Sequence<::rtl::OUString > &PropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &Listener) override final |
virtual void SAL_CALL | removePropertiesChangeListener (const css::uno::Reference< css::beans::XPropertiesChangeListener > &Listener) override final |
virtual void SAL_CALL | firePropertiesChangeEvent (const css::uno::Sequence<::rtl::OUString > &PropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &Listener) override final |
Public Member Functions inherited from comphelper::UnoImplBase | |
virtual | ~UnoImplBase () |
Static Public Member Functions | |
static css::uno::Sequence< css::uno::Type > | getTypes () |
eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet More... | |
static css::uno::Reference< css::beans::XPropertySetInfo > | createPropertySetInfo (cppu::IPropertyArrayHelper &rProperties) |
The property sequence is created in the call. More... | |
Protected Member Functions | |
~OPropertySetHelper () | |
You must call disposing() before destruction. More... | |
virtual void | setFastPropertyValueImpl (std::unique_lock< std::mutex > &rGuard, sal_Int32 nHandle, const css::uno::Any &rValue) |
Override this if you need to do something special during setFastPropertyValue. More... | |
virtual css::uno::Any | getPropertyValueImpl (std::unique_lock< std::mutex > &rGuard, const ::rtl::OUString &aPropertyName) |
Override this if you need to do something special during getPropertyValue. More... | |
void | fire (std::unique_lock< std::mutex > &rGuard, sal_Int32 *pnHandles, const css::uno::Any *pNewValues, const css::uno::Any *pOldValues, sal_Int32 nCount, bool bVetoable) |
This method fire events to all registered property listeners. More... | |
void | setFastPropertyValues (std::unique_lock< std::mutex > &rGuard, sal_Int32 nSeqLen, sal_Int32 *pHandles, const css::uno::Any *pValues, sal_Int32 nHitCount) |
Set multiple properties with the handles. More... | |
virtual cppu::IPropertyArrayHelper & | getInfoHelper ()=0 |
This abstract method must return the name to index table. More... | |
virtual bool | convertFastPropertyValue (std::unique_lock< std::mutex > &rGuard, 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 | setFastPropertyValue_NoBroadcast (std::unique_lock< std::mutex > &rGuard, sal_Int32 nHandle, const css::uno::Any &rValue)=0 |
The same as setFastPropertyValue; nHandle is always valid. More... | |
virtual void | getFastPropertyValue (std::unique_lock< std::mutex > &rGuard, 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 (std::unique_lock< std::mutex > &rGuard, sal_Int32 i_handle, const css::uno::Any &i_value) |
sets an dependent property's value More... | |
Private Member Functions | |
void | impl_fireAll (std::unique_lock< std::mutex > &rGuard, 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... | |
void | fireVetoableChangeListeners (std::unique_lock< std::mutex > &rGuard, comphelper::OInterfaceContainerHelper4< css::beans::XVetoableChangeListener > *pListeners, const css::beans::PropertyChangeEvent &rChangeEvent) |
void | firePropertyChangeListeners (std::unique_lock< std::mutex > &rGuard, comphelper::OInterfaceContainerHelper4< css::beans::XPropertyChangeListener > *pListeners, const css::beans::PropertyChangeEvent &rChangeEvent) |
Private Attributes | |
OMultiTypeInterfaceContainerHelperVar4< sal_Int32, css::beans::XPropertyChangeListener > | aBoundLC |
Container for the XPropertyChangedListener. More... | |
OMultiTypeInterfaceContainerHelperVar4< sal_Int32, css::beans::XVetoableChangeListener > | aVetoableLC |
Container for the XPropertyVetoableListener. More... | |
comphelper::OInterfaceContainerHelper4< css::beans::XPropertyChangeListener > | maPropertyChangeListeners |
Container for the XPropertyChangedListener where the listeners want to listen to all properties. More... | |
comphelper::OInterfaceContainerHelper4< css::beans::XPropertiesChangeListener > | maPropertiesChangeListeners |
comphelper::OInterfaceContainerHelper4< css::beans::XVetoableChangeListener > | maVetoableChangeListeners |
Container for the XVetoableChangeListener where the listeners want to listen to all properties. More... | |
std::vector< sal_Int32 > | m_handles |
std::vector< css::uno::Any > | m_newValues |
std::vector< css::uno::Any > | m_oldValues |
bool | m_bIgnoreRuntimeExceptionsWhileFiring = false |
Additional Inherited Members | |
Protected Attributes inherited from comphelper::UnoImplBase | |
std::mutex | m_aMutex |
bool | m_bDisposed = false |
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.
This is a modified copy of the cppuhelper::OPropertySetHelper class, except that is uses std::mutex instead of osl::Mutex.
Definition at line 47 of file propshlp.hxx.
comphelper::OPropertySetHelper::OPropertySetHelper | ( | ) |
Definition at line 105 of file propshlp.cxx.
comphelper::OPropertySetHelper::OPropertySetHelper | ( | bool | bIgnoreRuntimeExceptionsWhileFiring | ) |
Constructor.
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 107 of file propshlp.cxx.
|
protected |
You must call disposing() before destruction.
You must call disposing before.
Definition at line 115 of file propshlp.cxx.
|
finaloverridevirtual |
|
finaloverridevirtual |
Ignored if the property is not bound.
|
finaloverridevirtual |
Ignored if the property is not constrained.
|
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(), and setFastPropertyValueImpl().
|
static |
The property sequence is created in the call.
The interface isn't used after the call.
Definition at line 150 of file propshlp.cxx.
void comphelper::OPropertySetHelper::disposing | ( | std::unique_lock< std::mutex > & | rGuard | ) |
Send a disposing notification to the listeners.
Definition at line 136 of file propshlp.cxx.
References aBoundLC, aVetoableLC, and comphelper::OMultiTypeInterfaceContainerHelperVar4< key, listener, equalImpl >::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. |
Referenced by setFastPropertyValueImpl().
|
finaloverridevirtual |
|
private |
Definition at line 659 of file propshlp.cxx.
References comphelper::OInterfaceContainerHelper4< ListenerT >::getLength(), comphelper::OInterfaceIteratorHelper4< ListenerT >::hasMoreElements(), m_bIgnoreRuntimeExceptionsWhileFiring, comphelper::OInterfaceIteratorHelper4< ListenerT >::next(), comphelper::OInterfaceIteratorHelper4< ListenerT >::remove(), and SAL_INFO.
|
private |
Definition at line 617 of file propshlp.cxx.
References comphelper::OInterfaceContainerHelper4< ListenerT >::getLength(), comphelper::OInterfaceIteratorHelper4< ListenerT >::hasMoreElements(), m_bIgnoreRuntimeExceptionsWhileFiring, comphelper::OInterfaceIteratorHelper4< ListenerT >::next(), comphelper::OInterfaceIteratorHelper4< ListenerT >::remove(), and SAL_INFO.
|
finaloverridevirtual |
css::beans::UnknownPropertyException | if the property with the handle nHandle does not exist. |
Definition at line 466 of file propshlp.cxx.
References Any, cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), getFastPropertyValue(), getInfoHelper(), comphelper::UnoImplBase::m_aMutex, and nHandle.
Referenced by getFastPropertyValue(), and getPropertyValueImpl().
|
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.
|
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 getFastPropertyValue(), getPropertyValueImpl(), setDependentFastPropertyValue(), and setFastPropertyValueImpl().
|
finaloverridevirtual |
Throw UnknownPropertyException if the property with the name rPropertyName does not exist.
|
protectedvirtual |
Override this if you need to do something special during getPropertyValue.
Definition at line 173 of file propshlp.cxx.
References Any, getFastPropertyValue(), cppu::IPropertyArrayHelper::getHandleByName(), getInfoHelper(), and nHandle.
|
finaloverridevirtual |
|
static |
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 128 of file propshlp.cxx.
|
private |
notifies the given changes in property's values, plus all property changes collected during recent |setDependentFastPropertyValue| calls.
Referenced by setFastPropertyValueImpl().
|
overridevirtual |
Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and XEventListener.
Definition at line 118 of file propshlp.cxx.
References Any, and XPropertySet.
|
finaloverridevirtual |
|
finaloverridevirtual |
Ignored if the property is not bound.
|
finaloverridevirtual |
Ignored if the property is not constrained.
|
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 321 of file propshlp.cxx.
References Any, convertFastPropertyValue(), Exception, cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), getInfoHelper(), m_handles, m_newValues, m_oldValues, nAttributes, setFastPropertyValue_NoBroadcast(), and XPropertySet.
|
finaloverridevirtual |
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.
|
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(), and setFastPropertyValueImpl().
|
protectedvirtual |
Override this if you need to do something special during setFastPropertyValue.
Definition at line 394 of file propshlp.cxx.
References Any, convertFastPropertyValue(), cppu::IPropertyArrayHelper::fillPropertyMembersByHandle(), fire(), getInfoHelper(), impl_fireAll(), comphelper::UnoImplBase::m_bDisposed, nAttributes, nHandle, and setFastPropertyValue_NoBroadcast().
|
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. |
|
finaloverridevirtual |
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.
|
overridevirtual |
|
private |
Container for the XPropertyChangedListener.
The listeners are inserted by handle.
Definition at line 283 of file propshlp.hxx.
Referenced by disposing().
|
private |
Container for the XPropertyVetoableListener.
The listeners are inserted by handle.
Definition at line 288 of file propshlp.hxx.
Referenced by disposing().
|
private |
Definition at line 304 of file propshlp.hxx.
Referenced by firePropertyChangeListeners(), and fireVetoableChangeListeners().
|
private |
Definition at line 301 of file propshlp.hxx.
Referenced by setDependentFastPropertyValue().
|
private |
Definition at line 302 of file propshlp.hxx.
Referenced by setDependentFastPropertyValue().
|
private |
Definition at line 303 of file propshlp.hxx.
Referenced by setDependentFastPropertyValue().
|
private |
Definition at line 295 of file propshlp.hxx.
|
private |
Container for the XPropertyChangedListener where the listeners want to listen to all properties.
Definition at line 293 of file propshlp.hxx.
|
private |
Container for the XVetoableChangeListener where the listeners want to listen to all properties.
Definition at line 300 of file propshlp.hxx.