20#include <com/sun/star/beans/XPropertySet.hpp>
21#include <com/sun/star/beans/PropertyValue.hpp>
27SwVbaVariable::SwVbaVariable(
const uno::Reference< ooo::vba::XHelperInterface >& rParent,
const uno::Reference< uno::XComponentContext >& rContext,
28 uno::Reference< beans::XPropertyAccess > xUserDefined, OUString aVariableName ) :
29 SwVbaVariable_BASE( rParent, rContext ), mxUserDefined(
std::move( xUserDefined )), maVariableName(
std::move( aVariableName ))
46 throw uno::RuntimeException(
" Fail to set name" );
52 uno::Reference< beans::XPropertySet > xProp(
mxUserDefined, uno::UNO_QUERY_THROW );
60 uno::Reference< beans::XPropertySet > xProp(
mxUserDefined, uno::UNO_QUERY_THROW );
67 const uno::Sequence< beans::PropertyValue >
props =
mxUserDefined->getPropertyValues();
68 auto pProp = std::find_if(
props.begin(),
props.end(),
69 [
this](
const beans::PropertyValue& rProp) { return rProp.Name == maVariableName; });
70 if (pProp !=
props.end())
71 return static_cast<sal_Int32
>(std::distance(
props.begin(), pProp)) + 1;
79 return "SwVbaVariable";
82uno::Sequence< OUString >
87 "ooo.vba.word.Variable"
virtual ~SwVbaVariable() override
SwVbaVariable(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, css::uno::Reference< css::beans::XPropertyAccess > xUserDefined, OUString aName)
virtual void SAL_CALL setName(const OUString &) override
virtual css::uno::Any SAL_CALL getValue() override
css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined
virtual void SAL_CALL setValue(const css::uno::Any &rValue) override
virtual OUString getServiceImplName() override
virtual OUString SAL_CALL getName() override
virtual sal_Int32 SAL_CALL getIndex() override
virtual css::uno::Sequence< OUString > getServiceNames() override
Sequence< OUString > aServiceNames