13#include <ooo/vba/office/MsoControlType.hpp>
14#include <ooo/vba/XCommandBarControls.hpp>
26 uno::Reference< XHelperInterface > m_xParent;
27 uno::Reference< uno::XComponentContext >
m_xContext;
28 uno::Reference< container::XEnumeration > m_xEnumeration;
31 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 ))
34 virtual sal_Bool SAL_CALL hasMoreElements()
override
36 return m_xEnumeration->hasMoreElements();
38 virtual uno::Any SAL_CALL nextElement()
override
41 if( !hasMoreElements() )
42 throw container::NoSuchElementException();
44 uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
45 if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
47 uno::Reference< excel::XMenu > xMenu(
new ScVbaMenu( m_xParent,
m_xContext, xCommandBarControl ) );
50 else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
63ScVbaMenuItems::ScVbaMenuItems(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< XCommandBarControls > xCommandBarControls ) :
MenuItems_BASE( xParent, xContext,
uno::
Reference< container::XIndexAccess>() ), m_xCommandBarControls(
std::move( xCommandBarControls ))
74uno::Reference< container::XEnumeration >
77 uno::Reference< container::XEnumerationAccess > xEnumAccess(
m_xCommandBarControls, uno::UNO_QUERY_THROW );
78 return uno::Reference< container::XEnumeration >(
new MenuEnumeration(
this,
mxContext, xEnumAccess->createEnumeration() ) );
100 if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
102 else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
104 throw uno::RuntimeException();
107uno::Reference< excel::XMenuItem > SAL_CALL
ScVbaMenuItems::Add(
const OUString& Caption,
const css::uno::Any& OnAction,
const css::uno::Any& ,
const css::uno::Any& Before,
const css::uno::Any& Restore,
const css::uno::Any& ,
const css::uno::Any& ,
const css::uno::Any& )
110 uno::Any( office::MsoControlType::msoControlButton ),
112 xCommandBarControl->setCaption(
Caption );
113 if( OnAction.hasValue() )
116 OnAction >>= sAction;
117 xCommandBarControl->setOnAction( sAction );
126 return "ScVbaMenuItems";
129uno::Sequence<OUString>
134 "ooo.vba.excel.MenuItems"
Reference< XComponentContext > m_xContext
css::uno::Reference< css::uno::XComponentContext > mxContext
css::uno::Type const & get()
std::deque< AttacherIndex_Impl > aIndex
Sequence< OUString > aServiceNames