1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include "vbamenu.hxx"
11 #include "vbamenuitems.hxx"
12 #include <ooo/vba/XCommandBarControls.hpp>
15 using namespace com::sun::star
;
16 using namespace ooo::vba
;
18 ScVbaMenu::ScVbaMenu( const uno::Reference
< ov::XHelperInterface
>& rParent
, const uno::Reference
< uno::XComponentContext
>& rContext
, uno::Reference
< XCommandBarControl
> xCommandBarControl
) : Menu_BASE( rParent
, rContext
), m_xCommandBarControl(std::move( xCommandBarControl
))
23 ScVbaMenu::getCaption()
25 return m_xCommandBarControl
->getCaption();
29 ScVbaMenu::setCaption( const OUString
& _caption
)
31 m_xCommandBarControl
->setCaption( _caption
);
37 m_xCommandBarControl
->Delete();
41 ScVbaMenu::MenuItems( const uno::Any
& aIndex
)
43 uno::Reference
< XCommandBarControls
> xCommandBarControls( m_xCommandBarControl
->Controls( uno::Any() ), uno::UNO_QUERY_THROW
);
44 uno::Reference
< excel::XMenuItems
> xMenuItems( new ScVbaMenuItems( this, mxContext
, xCommandBarControls
) );
45 if( aIndex
.hasValue() )
47 return xMenuItems
->Item( aIndex
, uno::Any() );
49 return uno::Any( xMenuItems
);
53 ScVbaMenu::getServiceImplName()
55 return u
"ScVbaMenu"_ustr
;
58 uno::Sequence
<OUString
>
59 ScVbaMenu::getServiceNames()
61 static uno::Sequence
< OUString
> const aServiceNames
63 u
"ooo.vba.excel.Menu"_ustr
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */