12#include <ooo/vba/office/MsoControlType.hpp>
13#include <ooo/vba/XCommandBarControls.hpp>
25 uno::Reference< XHelperInterface > m_xParent;
26 uno::Reference< uno::XComponentContext >
m_xContext;
27 uno::Reference< container::XEnumeration > m_xEnumeration;
30 MenuEnumeration( uno::Reference< XHelperInterface > xParent, uno::Reference< uno::XComponentContext > xContext, uno::Reference< container::XEnumeration > xEnumeration) : m_xParent(std::move( xParent )),
m_xContext(std::move( xContext )), m_xEnumeration(std::move( xEnumeration ))
33 virtual sal_Bool SAL_CALL hasMoreElements()
override
35 return m_xEnumeration->hasMoreElements();
37 virtual uno::Any SAL_CALL nextElement()
override
40 if( !hasMoreElements() )
41 throw container::NoSuchElementException();
43 uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
44 if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
46 uno::Reference< excel::XMenu > xMenu(
new ScVbaMenu( m_xParent,
m_xContext, xCommandBarControl ) );
57ScVbaMenus::ScVbaMenus(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< XCommandBarControls > xCommandBarControls ) :
Menus_BASE( xParent, xContext,
uno::
Reference< container::XIndexAccess>() ), m_xCommandBarControls(
std::move( xCommandBarControls ))
68uno::Reference< container::XEnumeration >
71 uno::Reference< container::XEnumerationAccess > xEnumAccess(
m_xCommandBarControls, uno::UNO_QUERY_THROW );
72 return uno::Reference< container::XEnumeration >(
new MenuEnumeration(
this,
mxContext, xEnumAccess->createEnumeration() ) );
94 if( xCommandBarControl->getType() != office::MsoControlType::msoControlPopup )
95 throw uno::RuntimeException();
99uno::Reference< excel::XMenu > SAL_CALL
ScVbaMenus::Add(
const OUString& Caption,
const css::uno::Any& Before,
const css::uno::Any& Restore )
102 uno::Any( office::MsoControlType::msoControlPopup ),
104 xCommandBarControl->setCaption(
Caption );
105 return uno::Reference< excel::XMenu >(
new ScVbaMenu(
this,
mxContext, xCommandBarControl ) );
115uno::Sequence<OUString>
120 "ooo.vba.excel.Menus"
Reference< XComponentContext > m_xContext
css::uno::Reference< css::uno::XComponentContext > mxContext
css::uno::Type const & get()
std::deque< AttacherIndex_Impl > aIndex
Sequence< OUString > aServiceNames