26#include <rtl/ustring.hxx>
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/beans/XMultiPropertySet.hpp>
61 virtual void SetValue (
const css::uno::Any & rValue) = 0;
82 virtual void SetValue (
const css::uno::Any & rValue)
override
98 bool operator() (std::u16string_view a, std::u16string_view b)
const
100 return (
a.compare (b) < 0);
129 css::uno::XInterface> xObject);
137 template<
class T>
void Add (
const OUString & sName, T& rValue)
158 inline bool MultiGet (
const css::uno::Sequence<
159 OUString> & rNameList);
167 inline bool SingleGet (
const css::uno::Sequence<
168 OUString> & rNameList);
177 css::uno::Reference< css::uno::XInterface>
mxObject;
181 css::uno::XInterface> xObject)
182 : mxObject (
std::move(xObject))
188 css::uno::Sequence< OUString> aNameList (
aPropertyList.size());
189 auto aNameListRange = asNonConstRange(aNameList);
192 aNameListRange[
i++] = rProperty.second->msName;
200 OUString> & rNameList)
202 css::uno::Reference< css::beans::XMultiPropertySet> xMultiSet (
208 css::uno::Sequence< css::uno::Any> aValueList =
209 xMultiSet->getPropertyValues (rNameList);
211 rProperty.second->SetValue (aValueList[
i++]);
213 catch (
const css::beans::UnknownPropertyException&)
224 OUString> & rNameList)
226 css::uno::Reference< css::beans::XPropertySet> xSingleSet (
233 rProperty.second->SetValue (xSingleSet->getPropertyValue (rNameList[
i++]));
235 catch (
const css::beans::UnknownPropertyException&)
@descr This class lets you get the values from an object that either supports the interface XProperty...
void Add(const OUString &sName, T &rValue)
@descr Add a property to handle.
bool MultiGet(const css::uno::Sequence< OUString > &rNameList)
@descr Try to use the XMultiPropertySet interface to get the property values.
bool GetProperties()
@descr Try to get the values for all properties added with the Add method.
MultiPropertySetHandler(css::uno::Reference< css::uno::XInterface > xObject)
@descr Create a handler of the property set of the given object.
::std::map< OUString, std::unique_ptr< PropertyWrapperBase >, OUStringComparison > aPropertyList
@descr STL map that maps from property names to polymorphic instances of PropertyWrapper.
css::uno::Reference< css::uno::XInterface > mxObject
The object from which to get the property values.
bool SingleGet(const css::uno::Sequence< OUString > &rNameList)
@descr Try to use the XPropertySet interface to get the property values.
@descr Function object for comparing two OUStrings.
bool operator()(std::u16string_view a, std::u16string_view b) const
Compare two strings. Returns true if the first is before the second.
@descr MultiPropertySetHandler handles the two slightly different interfaces XPropertySet and XMultiP...
PropertyWrapperBase(OUString aName)
@descr Create a class instance and store the given name.
virtual ~PropertyWrapperBase()
virtual void SetValue(const css::uno::Any &rValue)=0
@descr Abstract interface of a method for setting a variables value to that of the property.
@descr For every property type there will be one instantiation of this template class with its own an...
PropertyWrapper(const OUString &rName, T &rValue)
@descr Create a wrapper for a property of type T.
virtual void SetValue(const css::uno::Any &rValue) override
descr Set the given value inside an Any to the variable referenced by the data member.
T & mrValue
Reference to a variable. Its value can be modified by a call to SetValue.