UDK 3.2.7 C/C++ API Reference
Public Member Functions | Protected Member Functions | Protected Attributes
cppu::OPropertySetHelper Class Reference

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>

Inheritance diagram for cppu::OPropertySetHelper:
cppu::OPropertySetHelper2

List of all members.

Public Member Functions

 OPropertySetHelper (OBroadcastHelper &rBHelper) throw ()
 OPropertySetHelper (OBroadcastHelper &rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring)
 Constructor.
 OPropertySetHelper (OBroadcastHelper &rBHelper, IEventNotificationHook *i_pFireEvents, bool bIgnoreRuntimeExceptionsWhileFiring=false)
 Constructor.
virtual ::com::sun::star::uno::Any queryInterface (const ::com::sun::star::uno::Type &rType) throw (::com::sun::star::uno::RuntimeException)
 Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and XEventListener.
::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
getTypes () throw (::com::sun::star::uno::RuntimeException)
 eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet
void disposing () throw ()
 Send a disposing notification to the listeners in the conatiners aBoundLC and aVetoableLC.
virtual void setPropertyValue (const ::rtl::OUString &rPropertyName, const ::com::sun::star::uno::Any &aValue) 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)
 Throw UnknownPropertyException or PropertyVetoException if the property with the name rPropertyName does not exist or is readonly.
virtual ::com::sun::star::uno::Any getPropertyValue (const ::rtl::OUString &aPropertyName) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
 Throw UnknownPropertyException if the property with the name rPropertyName does not exist.
virtual void addPropertyChangeListener (const ::rtl::OUString &aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > &aListener) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
 Ignored if the property is not bound.
virtual void removePropertyChangeListener (const ::rtl::OUString &aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > &aListener) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
 Ignored if the property is not bound.
virtual void addVetoableChangeListener (const ::rtl::OUString &aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > &aListener) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
 Ignored if the property is not constrained.
virtual void removeVetoableChangeListener (const ::rtl::OUString &aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > &aListener) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
 Ignored if the property is not constrained.
virtual void setFastPropertyValue (sal_Int32 nHandle, const ::com::sun::star::uno::Any &rValue) 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)
 Throw UnknownPropertyException or PropertyVetoException if the property with the name rPropertyName does not exist or is readonly.
virtual ::com::sun::star::uno::Any getFastPropertyValue (sal_Int32 nHandle) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
 
Exceptions:
com::sun::star::beans::UnknownPropertyExceptionif the property with the handle nHandle does not exist.

virtual void setPropertyValues (const ::com::sun::star::uno::Sequence< ::rtl::OUString > &PropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &Values) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
virtual
::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
getPropertyValues (const ::com::sun::star::uno::Sequence< ::rtl::OUString > &PropertyNames) throw (::com::sun::star::uno::RuntimeException)
virtual void addPropertiesChangeListener (const ::com::sun::star::uno::Sequence< ::rtl::OUString > &PropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > &Listener) throw (::com::sun::star::uno::RuntimeException)
virtual void removePropertiesChangeListener (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > &Listener) throw (::com::sun::star::uno::RuntimeException)
virtual void firePropertiesChangeEvent (const ::com::sun::star::uno::Sequence< ::rtl::OUString > &PropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > &Listener) throw (::com::sun::star::uno::RuntimeException)
static::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo > 
createPropertySetInfo (IPropertyArrayHelper &rProperties) throw ()
 The property sequence is created in the call.

Protected Member Functions

void fire (sal_Int32 *pnHandles, const ::com::sun::star::uno::Any *pNewValues, const ::com::sun::star::uno::Any *pOldValues, sal_Int32 nCount, sal_Bool bVetoable)
 This method fire events to all registered property listeners.
void setFastPropertyValues (sal_Int32 nSeqLen, sal_Int32 *pHandles, const ::com::sun::star::uno::Any *pValues, sal_Int32 nHitCount) throw (::com::sun::star::uno::Exception)
 Set multiple properties with the handles.
virtual IPropertyArrayHelpergetInfoHelper ()=0
 This abstract method must return the name to index table.
virtual sal_Bool convertFastPropertyValue (::com::sun::star::uno::Any &rConvertedValue,::com::sun::star::uno::Any &rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any &rValue)=0 throw (::com::sun::star::lang::IllegalArgumentException)
 Converted the value rValue and return the result in rConvertedValue and the old value in rOldValue.
virtual void setFastPropertyValue_NoBroadcast (sal_Int32 nHandle, const ::com::sun::star::uno::Any &rValue)=0 throw (::com::sun::star::uno::Exception)
 The same as setFastProperyValue; nHandle is always valid.
virtual void getFastPropertyValue (::com::sun::star::uno::Any &rValue, sal_Int32 nHandle) const =0
 The same as getFastProperyValue, but return the value through rValue and nHandle is always valid.
void setDependentFastPropertyValue (sal_Int32 i_handle, const ::com::sun::star::uno::Any &i_value)
 sets an dependent property's value
 ~OPropertySetHelper () throw ()
 You must call disposing before destruction.

Protected Attributes

OBroadcastHelperrBHelper
 The common data of a broadcaster.
OMultiTypeInterfaceContainerHelperInt32 aBoundLC
 Container for the XProperyChangedListener.
OMultiTypeInterfaceContainerHelperInt32 aVetoableLC
 Container for the XPropertyVetoableListener.
const std::auto_ptr< Impl > m_pReserved
 reserved for future use.

Detailed Description

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 overload 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.


Constructor & Destructor Documentation

cppu::OPropertySetHelper::OPropertySetHelper ( OBroadcastHelper rBHelper) throw ()
Parameters:
rBHelperthis structure contains the basic members of a broadcaster. The lifetime must be longer than the lifetime of this object. Stored in the variable rBHelper.
cppu::OPropertySetHelper::OPropertySetHelper ( OBroadcastHelper rBHelper,
bool  bIgnoreRuntimeExceptionsWhileFiring 
)

Constructor.

Parameters:
rBHelperthis structure contains the basic members of a broadcaster. The lifetime must be longer than the lifetime of this object. Stored in the variable rBHelper.
bIgnoreRuntimeExceptionsWhileFiringindicates 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).
cppu::OPropertySetHelper::OPropertySetHelper ( OBroadcastHelper rBHelper,
IEventNotificationHook i_pFireEvents,
bool  bIgnoreRuntimeExceptionsWhileFiring = false 
)

Constructor.

Parameters:
rBHelperthis 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_pFireEventsadditional event notifier
bIgnoreRuntimeExceptionsWhileFiringindicates 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).
cppu::OPropertySetHelper::~OPropertySetHelper ( ) throw () [protected]

You must call disposing before destruction.


Member Function Documentation

virtual void cppu::OPropertySetHelper::addPropertiesChangeListener ( const ::com::sun::star::uno::Sequence< ::rtl::OUString > &  PropertyNames,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > &  Listener 
) throw (::com::sun::star::uno::RuntimeException) [virtual]
virtual void cppu::OPropertySetHelper::addPropertyChangeListener ( const ::rtl::OUString aPropertyName,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > &  aListener 
) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) [virtual]

Ignored if the property is not bound.

virtual void cppu::OPropertySetHelper::addVetoableChangeListener ( const ::rtl::OUString aPropertyName,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > &  aListener 
) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) [virtual]

Ignored if the property is not constrained.

virtual sal_Bool cppu::OPropertySetHelper::convertFastPropertyValue ( ::com::sun::star::uno::Any rConvertedValue,
::com::sun::star::uno::Any rOldValue,
sal_Int32  nHandle,
const ::com::sun::star::uno::Any rValue 
) throw (::com::sun::star::lang::IllegalArgumentException) [protected, pure virtual]

Converted the value rValue and return the result in rConvertedValue and the old value in rOldValue.

A IllegalArgumentException is thrown. The method is not implemented in this class. After this call the vetoable listeners are notified.

Parameters:
rConvertedValuethe converted value. Only set if return is true.
rOldValuethe old value. Only set if return is true.
nHandlethe handle of the proberty.
Returns:
true if the value converted.
static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > cppu::OPropertySetHelper::createPropertySetInfo ( IPropertyArrayHelper rProperties) throw ()

The property sequence is created in the call.

The interface isn't used after the call.

void cppu::OPropertySetHelper::disposing ( ) throw ()

Send a disposing notification to the listeners in the conatiners aBoundLC and aVetoableLC.

See also:
OComponentHelper
void cppu::OPropertySetHelper::fire ( sal_Int32 *  pnHandles,
const ::com::sun::star::uno::Any pNewValues,
const ::com::sun::star::uno::Any pOldValues,
sal_Int32  nCount,
sal_Bool  bVetoable 
) [protected]

This method fire events to all registered property listeners.

Parameters:
pnHandlesthe id's of the properties that changed.
pNewValuesthe new values of the properties.
pOldValuesthe old values of the properties.
nCountthe number of elements in the arrays pnHandles, pNewValues and pOldValues.
bVetoabletrue means fire to VetoableChangeListener, false means fire to XPropertyChangedListener and XMultiPropertyChangedListener.
virtual void cppu::OPropertySetHelper::firePropertiesChangeEvent ( const ::com::sun::star::uno::Sequence< ::rtl::OUString > &  PropertyNames,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > &  Listener 
) throw (::com::sun::star::uno::RuntimeException) [virtual]
virtual ::com::sun::star::uno::Any cppu::OPropertySetHelper::getFastPropertyValue ( sal_Int32  nHandle) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)

Exceptions:
com::sun::star::beans::UnknownPropertyExceptionif the property with the handle nHandle does not exist.

virtual void cppu::OPropertySetHelper::getFastPropertyValue ( ::com::sun::star::uno::Any rValue,
sal_Int32  nHandle 
) const [protected, pure virtual]

The same as getFastProperyValue, but return the value through rValue and nHandle is always valid.

The method is not implemented in this class.

virtual IPropertyArrayHelper& cppu::OPropertySetHelper::getInfoHelper ( ) [protected, pure 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.

virtual ::com::sun::star::uno::Any cppu::OPropertySetHelper::getPropertyValue ( const ::rtl::OUString aPropertyName) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)

Throw UnknownPropertyException if the property with the name rPropertyName does not exist.

virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > cppu::OPropertySetHelper::getPropertyValues ( const ::com::sun::star::uno::Sequence< ::rtl::OUString > &  PropertyNames) throw (::com::sun::star::uno::RuntimeException)
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > cppu::OPropertySetHelper::getTypes ( ) throw (::com::sun::star::uno::RuntimeException)

eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet

virtual ::com::sun::star::uno::Any cppu::OPropertySetHelper::queryInterface ( const ::com::sun::star::uno::Type rType) throw (::com::sun::star::uno::RuntimeException)

Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and XEventListener.

Reimplemented in cppu::OPropertySetHelper2.

virtual void cppu::OPropertySetHelper::removePropertiesChangeListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > &  Listener) throw (::com::sun::star::uno::RuntimeException) [virtual]
virtual void cppu::OPropertySetHelper::removePropertyChangeListener ( const ::rtl::OUString aPropertyName,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > &  aListener 
) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) [virtual]

Ignored if the property is not bound.

virtual void cppu::OPropertySetHelper::removeVetoableChangeListener ( const ::rtl::OUString aPropertyName,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > &  aListener 
) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) [virtual]

Ignored if the property is not constrained.

void cppu::OPropertySetHelper::setDependentFastPropertyValue ( sal_Int32  i_handle,
const ::com::sun::star::uno::Any i_value 
) [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.

virtual void cppu::OPropertySetHelper::setFastPropertyValue ( sal_Int32  nHandle,
const ::com::sun::star::uno::Any rValue 
) 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) [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.

virtual void cppu::OPropertySetHelper::setFastPropertyValue_NoBroadcast ( sal_Int32  nHandle,
const ::com::sun::star::uno::Any rValue 
) throw (::com::sun::star::uno::Exception) [protected, pure virtual]

The same as setFastProperyValue; nHandle is always valid.

The changes must not be broadcasted in this method. The method is implemented in a derived class.

Attention:
Although you are permitted to throw any UNO exception, only the following are valid for usage: -- ::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
Parameters:
nHandlehandle
rValuevalue
void cppu::OPropertySetHelper::setFastPropertyValues ( sal_Int32  nSeqLen,
sal_Int32 *  pHandles,
const ::com::sun::star::uno::Any pValues,
sal_Int32  nHitCount 
) throw (::com::sun::star::uno::Exception) [protected]

Set multiple properties with the handles.

Parameters:
nSeqLenthe length of the arrays pHandles and Values.
pHandlesthe 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.
pValuesthe values of the properties.
nHitCountthe number of valid entries in the handle array.
virtual void cppu::OPropertySetHelper::setPropertyValue ( const ::rtl::OUString rPropertyName,
const ::com::sun::star::uno::Any aValue 
) 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) [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.

virtual void cppu::OPropertySetHelper::setPropertyValues ( const ::com::sun::star::uno::Sequence< ::rtl::OUString > &  PropertyNames,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &  Values 
) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) [virtual]

Member Data Documentation

Container for the XProperyChangedListener.

The listeners are inserted by handle.

Container for the XPropertyVetoableListener.

The listeners are inserted by handle.

const std::auto_ptr<Impl> cppu::OPropertySetHelper::m_pReserved [protected]

reserved for future use.

finally, the future has arrived...

The common data of a broadcaster.

Use the mutex, disposing state and the listener container.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines