23#include <com/sun/star/beans/XMultiPropertySet.hpp>
24#include <com/sun/star/uno/Reference.hxx>
26using com::sun::star::uno::Any;
28using com::sun::star::uno::Exception;
29using com::sun::star::lang::IllegalArgumentException;
30using com::sun::star::beans::Property;
31using com::sun::star::beans::XPropertySetInfo;
49 OSL_ENSURE( !
m_aProperties.empty(),
"PropertySetBase::getInfoHelper: no registered properties!" );
61 const ::rtl::Reference< PropertyAccessorBase >& rAccessor )
64 "PropertySetBase::registerProperty: invalid property accessor, this will crash!");
67 OSL_ENSURE( rAccessor->isWriteable()
68 == ( ( rProperty.Attributes & css::beans::PropertyAttribute::READONLY ) == 0 ),
69 "PropertySetBase::registerProperty: inconsistence!" );
76 ::osl::ClearableMutexGuard aGuard( GetMutex() );
89 Any aEmptyValue(
nullptr, aProperty.Type );
95 OSL_FAIL(
"PropertySetBase::notifyAndCachePropertyValue: this is not expected to fail!" );
98 Any aOldValue = aPos->second;
103 aPos->second = aNewValue;
106 if ( aNewValue != aOldValue )
107 firePropertyChange(
nHandle, aNewValue, aOldValue );
115 ::std::pair< PropertyValueCache::iterator, bool > aInsertResult =
117 OSL_ENSURE( aInsertResult.second,
"PropertySetBase::initializePropertyValueCache: already cached a value for this property!" );
123 OSL_ENSURE( aPropertyPos !=
m_aAccessors.end() && aPropertyPos->second,
124 "PropertySetBase::locatePropertyHandler: accessor map is corrupted!" );
127 return *aPropertyPos->second;
135 throw IllegalArgumentException( OUString(), *
this, 0 );
138 if ( rOldValue != rValue )
140 rConvertedValue = rValue;
base class which encapsulates accessing (reading/writing) concrete property values
virtual bool approveValue(const css::uno::Any &rValue) const =0
virtual ~PropertyAccessorBase() override
virtual void getValue(css::uno::Any &rValue) const =0
virtual void setValue(const css::uno::Any &rValue)=0
void registerProperty(const css::beans::Property &rProperty, const ::rtl::Reference< PropertyAccessorBase > &rAccessor)
registers a new property to be supported by this instance
virtual cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
PropertyAccessorBase & locatePropertyHandler(sal_Int32 nHandle) const
locates a property given by handle
void notifyAndCachePropertyValue(sal_Int32 nHandle)
notifies a change in a given property value, if necessary
PropertyValueCache m_aCache
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
OPropertysetHelper methods.
void initializePropertyValueCache(sal_Int32 nHandle)
initializes the property value cache for the given property, with its current value
virtual ~PropertySetBase() override
PropertyArray m_aProperties
std::unique_ptr< cppu::IPropertyArrayHelper > m_pProperties
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
PropertyAccessors m_aAccessors
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(::rtl::OUString *pPropName, sal_Int16 *pAttributes, sal_Int32 nHandle)=0
virtual css::beans::Property SAL_CALL getPropertyByName(const ::rtl::OUString &rPropertyName)=0
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)