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