21#include <com/sun/star/beans/XPropertyContainer.hpp>
22#include <com/sun/star/beans/PropertyAttribute.hpp>
28static uno::Reference< container::XIndexAccess >
createVariablesAccess(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< beans::XPropertyAccess >& xUserDefined )
32 const uno::Sequence< beans::PropertyValue >
props = xUserDefined->getPropertyValues();
34 aVariables.reserve(
nCount );
35 std::transform(
props.begin(),
props.end(), std::back_inserter(aVariables),
36 [&xParent, &xContext, &xUserDefined](
const beans::PropertyValue& rProp) -> uno::Reference< word::XVariable > {
37 return uno::Reference< word::XVariable > ( new SwVbaVariable( xParent, xContext, xUserDefined, rProp.Name ) ); });
52uno::Reference< container::XEnumeration >
55 uno::Reference< container::XEnumerationAccess > xEnumerationAccess(
m_xIndexAccess, uno::UNO_QUERY_THROW );
56 return xEnumerationAccess->createEnumeration();
72 aValue <<= OUString();
73 uno::Reference< beans::XPropertyContainer > xPropertyContainer(
mxUserDefined, uno::UNO_QUERY_THROW );
74 xPropertyContainer->addProperty( rName, beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::REMOVABLE, aValue );
82 return "SwVbaVariables";
85css::uno::Sequence<OUString>
88 static uno::Sequence< OUString >
const sNames
90 "ooo.vba.word.Variables"
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent() override
css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess
css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined
virtual css::uno::Type SAL_CALL getElementType() override
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual css::uno::Any SAL_CALL Add(const OUString &rName, const css::uno::Any &rValue) override
SwVbaVariables(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::beans::XPropertyAccess > &rUserDefined)
virtual OUString getServiceImplName() override
virtual css::uno::Any createCollectionObject(const css::uno::Any &aSource) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
css::uno::Type const & get()
static uno::Reference< container::XIndexAccess > createVariablesAccess(const uno::Reference< XHelperInterface > &xParent, const uno::Reference< uno::XComponentContext > &xContext, const uno::Reference< beans::XPropertyAccess > &xUserDefined)