12 #include <ooo/vba/office/MsoControlType.hpp>
13 #include <ooo/vba/XCommandBarControls.hpp>
24 uno::Reference< XHelperInterface > m_xParent;
25 uno::Reference< uno::XComponentContext >
m_xContext;
26 uno::Reference< container::XEnumeration > m_xEnumeration;
29 MenuEnumeration(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< container::XEnumeration >& xEnumeration) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
32 virtual sal_Bool SAL_CALL hasMoreElements()
override
34 return m_xEnumeration->hasMoreElements();
36 virtual uno::Any SAL_CALL nextElement()
override
39 if( !hasMoreElements() )
40 throw container::NoSuchElementException();
42 uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
43 if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
45 uno::Reference< excel::XMenu > xMenu(
new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
56 ScVbaMenus::ScVbaMenus(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< XCommandBarControls >& xCommandBarControls ) :
Menus_BASE( xParent, xContext,
uno::
Reference<
container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls )
67 uno::Reference< container::XEnumeration >
70 uno::Reference< container::XEnumerationAccess > xEnumAccess(
m_xCommandBarControls, uno::UNO_QUERY_THROW );
71 return uno::Reference< container::XEnumeration >(
new MenuEnumeration(
this,
mxContext, xEnumAccess->createEnumeration() ) );
93 if( xCommandBarControl->getType() != office::MsoControlType::msoControlPopup )
94 throw uno::RuntimeException();
95 return uno::makeAny( uno::Reference< excel::XMenu > (
new ScVbaMenu(
this,
mxContext, xCommandBarControl ) ) );
98 uno::Reference< excel::XMenu > SAL_CALL
ScVbaMenus::Add(
const OUString& Caption,
const css::uno::Any& Before,
const css::uno::Any& Restore )
101 uno::makeAny( office::MsoControlType::msoControlPopup ),
103 xCommandBarControl->setCaption( Caption );
104 return uno::Reference< excel::XMenu >(
new ScVbaMenu(
this,
mxContext, xCommandBarControl ) );
114 uno::Sequence<OUString>
119 "ooo.vba.excel.Menus"
Sequence< OUString > aServiceNames
exports com.sun.star. container
css::uno::Type const & get()
css::uno::Reference< css::uno::XComponentContext > mxContext
Any makeAny(Color const &value)
Reference< XComponentContext > m_xContext