23#include <com/sun/star/uno/Sequence.hxx>
24#include <com/sun/star/style/XStyle.hpp>
31using ::com::sun::star::uno::Reference;
32using ::com::sun::star::uno::Sequence;
33using ::com::sun::star::uno::Any;
34using ::osl::MutexGuard;
37using ::cppu::OBroadcastHelper;
38using ::cppu::OPropertySetHelper;
47 m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false)
55 css::lang::XTypeProvider(),
56 css::beans::XPropertyState(),
57 css::beans::XMultiPropertyStates(),
58 css::style::XStyleSupplier(),
59 m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false)
68 if( rProp.second.hasValue() &&
69 rProp.second.getValueType().getTypeClass() == uno::TypeClass_INTERFACE )
71 Reference< util::XCloneable > xCloneable;
72 if( rProp.second >>= xCloneable )
73 rProp.second <<= xCloneable->createClone();
90 return ::cppu::queryInterface(
92 static_cast< lang::XTypeProvider *
>(
this ),
93 static_cast< beans::XPropertySet *
>(
this ),
94 static_cast< beans::XMultiPropertySet *
>(
this ),
95 static_cast< beans::XFastPropertySet *
>(
this ),
96 static_cast< beans::XPropertyState *
>(
this ),
97 static_cast< beans::XMultiPropertyStates *
>(
this ),
98 static_cast< style::XStyleSupplier *
>(
this ) );
102Sequence< uno::Type > SAL_CALL
105 static const Sequence< uno::Type > aTypeList{
120 return css::uno::Sequence<sal_Int8>();
124beans::PropertyState SAL_CALL
133Sequence< beans::PropertyState > SAL_CALL
138 std::unique_ptr<sal_Int32[]> pHandles(
new sal_Int32[ aPropertyName.getLength() ]);
141 std::vector< sal_Int32 > aHandles( pHandles.get(), pHandles.get() + aPropertyName.getLength());
183 std::unique_ptr<sal_Int32[]> pHandles(
new sal_Int32[ aPropertyNames.getLength() ]);
186 std::vector< sal_Int32 > aHandles( pHandles.get(), pHandles.get() + aPropertyNames.getLength());
192Sequence< Any > SAL_CALL
196 const sal_Int32
nElements = aPropertyNames.getLength();
199 Any * pResultArray = aResult.getArray();
213 ( Any & rConvertedValue,
224 sal_Int32 n32Value = 0;
225 if( rValue>>=n32Value )
227 rConvertedValue <<= static_cast<sal_Int16>(n32Value);
231 sal_Int64 n64Value = 0;
232 if( rValue>>=n64Value )
234 rConvertedValue <<= static_cast<sal_Int16>(n64Value);
239 rConvertedValue = rValue;
249#if OSL_DEBUG_LEVEL > 0
250 if( rValue.hasValue())
256 "Property type is wrong" );
265 catch(
const beans::UnknownPropertyException& )
278 sal_Int32 nHandle )
const
284 uno::Reference< beans::XFastPropertySet > xStylePropSet(
m_xStyle, uno::UNO_QUERY );
285 if( xStylePropSet.is() )
291 uno::Reference< beans::XPropertySet > xPropSet( xStylePropSet, uno::UNO_QUERY );
294 uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
303 Sequence< beans::Property > aProps( xInfo->getProperties() );
304 sal_Int32 nI = aProps.getLength() - 1;
313 OSL_ENSURE(
nHandle == aProp.Handle,
314 "HandleCheck: Handles for same property differ!" );
318 OSL_ENSURE( aProp.Type == aProps[nI].Type,
319 "HandleCheck: Types differ!" );
320 OSL_ENSURE( aProp.Attributes == aProps[nI].Attributes,
321 "HandleCheck: Attributes differ!" );
326 OSL_FAIL(
"HandleCheck: Handle not found in Style" );
330 OSL_FAIL(
"HandleCheck: Invalid XPropertySetInfo returned" );
333 OSL_FAIL(
"HandleCheck: XPropertySet not supported" );
336 rValue = xStylePropSet->getFastPropertyValue(
nHandle );
346 catch(
const beans::UnknownPropertyException& )
367 throw lang::IllegalArgumentException(
369 static_cast< beans::XPropertySet *
>(
this ),
375 const Sequence< OUString >& PropertyNames,
const Sequence< Any >& Values )
393 return beans::PropertyState_DEFAULT_VALUE;
394 return beans::PropertyState_DIRECT_VALUE;
398 const std::vector< sal_Int32 > & aHandles )
const
400 Sequence< beans::PropertyState > aResult( aHandles.size());
402 std::transform( aHandles.begin(), aHandles.end(),
404 [
this](sal_Int32
nHandle) { return GetPropertyStateByHandle(nHandle); });
420 const std::vector< sal_Int32 > & aHandles )
433 sal_Int32 nHandle )
const
435 bool bResult =
false;
441 rValue = (*aFoundIter).second;
449 sal_Int32 nHandle,
const Any & rValue )
mutable::osl::Mutex m_aMutex
virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(::rtl::OUString *pPropName, sal_Int16 *pAttributes, sal_Int32 nHandle)=0
virtual sal_Int32 SAL_CALL fillHandles(sal_Int32 *pHandles, const css::uno::Sequence< ::rtl::OUString > &rPropNames)=0
virtual sal_Int32 SAL_CALL getHandleByName(const ::rtl::OUString &rPropertyName)=0
virtual css::beans::Property SAL_CALL getPropertyByName(const ::rtl::OUString &rPropertyName)=0
virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const css::uno::Any &rValue) SAL_OVERRIDE
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< ::rtl::OUString > &PropertyNames, const css::uno::Sequence< css::uno::Any > &Values) SAL_OVERRIDE
css::uno::Type const & get()
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override final
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override final
css::uno::Reference< css::style::XStyle > m_xStyle
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
The same as getFastPropertyValue, but return the value through rValue and nHandle is always valid.
css::uno::Sequence< css::beans::PropertyState > GetPropertyStatesByHandle(const std::vector< sal_Int32 > &aHandles) const
void SetNewValuesExplicitlyEvenIfTheyEqualDefault()
bool GetPropertyValueByHandle(css::uno::Any &rValue, sal_Int32 nHandle) const
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override final
Try to convert the value rValue to the type required by the property associated with nHandle.
void SetAllPropertiesToDefault()
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override=0
The InfoHelper table contains all property names and types of this object.
virtual css::uno::Reference< css::style::XStyle > SAL_CALL getStyle() override final
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
The same as setFastPropertyValue; nHandle is always valid.
virtual void SAL_CALL setAllPropertiesToDefault() override final
css::beans::PropertyState GetPropertyStateByHandle(sal_Int32 nHandle) const
supports states DIRECT_VALUE and DEFAULT_VALUE
virtual void firePropertyChangeEvent()
implement this method in derived classes to get called when properties change.
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override final
void SetPropertyValueByHandle(sal_Int32 nHandle, const css::uno::Any &rValue)
virtual void SAL_CALL setPropertiesToDefault(const css::uno::Sequence< OUString > &aPropertyNames) override final
virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any &rAny) const =0
implement this method to provide default values for all properties supporting defaults.
std::unordered_map< sal_Int32, css::uno::Any > m_aProperties
void SetPropertiesToDefault(const std::vector< sal_Int32 > &aHandles)
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const css::uno::Any &rValue) override final
void SetPropertyToDefault(sal_Int32 nHandle)
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override final
bool SetStyle(const css::uno::Reference< css::style::XStyle > &xStyle)
bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual void SAL_CALL setStyle(const css::uno::Reference< css::style::XStyle > &xStyle) override final
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults(const css::uno::Sequence< OUString > &aPropertyNames) override final
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &PropertyNames, const css::uno::Sequence< css::uno::Any > &Values) override final
OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper, OMultiTypeInterfaceContainerHelper::keyType > OBroadcastHelper
functor that clones a UNO-Reference