28 using ::com::sun::star::uno::Type;
29 using ::com::sun::star::uno::Sequence;
30 using ::com::sun::star::lang::XTypeProvider;
31 using ::com::sun::star::uno::Any;
32 using ::com::sun::star::uno::cpp_queryInterface;
33 using ::com::sun::star::uno::cpp_release;
34 using ::com::sun::star::beans::PropertyState_DEFAULT_VALUE;
35 using ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
41 css::uno::Any SAL_CALL OPropertyStateHelper::queryInterface(
const css::uno::Type& _rType)
43 css::uno::Any aReturn = OPropertySetHelper2::queryInterface(_rType);
45 if ( !aReturn.hasValue() )
46 aReturn = ::cppu::queryInterface(_rType,
static_cast< css::beans::XPropertyState*
>(
this));
52 css::uno::Sequence<css::uno::Type> OPropertyStateHelper::getTypes()
62 OPropertyStateHelper::OPropertyStateHelper(
65 : ::
cppu::OPropertySetHelper2(rBHlp, i_pFireEvents) { }
67 OPropertyStateHelper::~OPropertyStateHelper() {}
70 void OPropertyStateHelper::firePropertyChange(sal_Int32 nHandle,
const css::uno::Any& aNewValue,
const css::uno::Any& aOldValue)
72 fire(&nHandle, &aNewValue, &aOldValue, 1,
false);
77 css::beans::PropertyState SAL_CALL OPropertyStateHelper::getPropertyState(
const OUString& _rsName)
83 throw css::beans::UnknownPropertyException(_rsName);
85 return getPropertyStateByHandle(nHandle);
89 void SAL_CALL OPropertyStateHelper::setPropertyToDefault(
const OUString& _rsName)
95 throw css::beans::UnknownPropertyException(_rsName);
97 setPropertyToDefaultByHandle(nHandle);
101 css::uno::Any SAL_CALL OPropertyStateHelper::getPropertyDefault(
const OUString& _rsName)
107 throw css::beans::UnknownPropertyException(_rsName);
109 return getPropertyDefaultByHandle(nHandle);
113 css::uno::Sequence< css::beans::PropertyState> SAL_CALL OPropertyStateHelper::getPropertyStates(
const css::uno::Sequence< OUString >& _rPropertyNames)
115 sal_Int32 nLen = _rPropertyNames.getLength();
116 css::uno::Sequence< css::beans::PropertyState> aRet(nLen);
117 css::beans::PropertyState*
pValues = aRet.getArray();
118 const OUString* pNames = _rPropertyNames.getConstArray();
122 css::uno::Sequence< css::beans::Property> aProps = rHelper.
getProperties();
123 const css::beans::Property* pProps = aProps.getConstArray();
124 sal_Int32 nPropCount = aProps.getLength();
126 osl::MutexGuard aGuard(rBHelper.rMutex);
127 for (sal_Int32 i=0, j=0;
i<nPropCount && j<nLen; ++
i, ++pProps)
130 if (pProps->Name == *pNames)
132 *
pValues = getPropertyState(*pNames);
143 css::beans::PropertyState OPropertyStateHelper::getPropertyStateByHandle( sal_Int32 _nHandle )
146 Any aCurrentValue = getPropertyDefaultByHandle( _nHandle );
148 getFastPropertyValue( aDefaultValue, _nHandle );
151 const_cast< void*
>( aCurrentValue.getValue() ), aCurrentValue.getValueType().getTypeLibType(),
152 const_cast< void*
>( aDefaultValue.getValue() ), aDefaultValue.getValueType().getTypeLibType(),
153 reinterpret_cast< uno_QueryInterfaceFunc
>(cpp_queryInterface),
154 reinterpret_cast< uno_ReleaseFunc
>(cpp_release)
156 return bEqual ? PropertyState_DEFAULT_VALUE : PropertyState_DIRECT_VALUE;
160 void OPropertyStateHelper::setPropertyToDefaultByHandle( sal_Int32 _nHandle )
162 setFastPropertyValue( _nHandle, getPropertyDefaultByHandle( _nHandle ) );
166 css::uno::Any OPropertyStateHelper::getPropertyDefaultByHandle( sal_Int32 )
const
168 return css::uno::Any();
175 OStatefulPropertySet::OStatefulPropertySet()
176 :OPropertyStateHelper( GetBroadcastHelper() )
181 OStatefulPropertySet::~OStatefulPropertySet()
186 Sequence< Type > SAL_CALL OStatefulPropertySet::getTypes()
192 OPropertyStateHelper::getTypes()
198 return css::uno::Sequence<sal_Int8>();
202 Any SAL_CALL OStatefulPropertySet::queryInterface(
const Type& _rType )
204 Any aReturn = OWeakObject::queryInterface( _rType );
205 if ( !aReturn.hasValue() )
206 aReturn = ::cppu::queryInterface( _rType,
static_cast< XTypeProvider*
>(
this ) );
207 if ( !aReturn.hasValue() )
208 aReturn = OPropertyStateHelper::queryInterface( _rType );
213 void SAL_CALL OStatefulPropertySet::acquire() noexcept
219 void SAL_CALL OStatefulPropertySet::release() noexcept
const PropertyValue * pValues
virtual sal_Int32 SAL_CALL getHandleByName(const ::rtl::OUString &rPropertyName)=0
virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties()=0
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
css::uno::Type const & get()
sal_Bool SAL_CALL uno_type_equalData(void *pVal1, typelib_TypeDescriptionReference *pVal1Type, void *pVal2, typelib_TypeDescriptionReference *pVal2Type, uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &_rLeft, const css::uno::Sequence< T > &_rRight)