LibreOffice Module sc (master) 1
vbamenu.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
10#include "vbamenu.hxx"
11#include "vbamenuitems.hxx"
12#include <ooo/vba/XCommandBarControls.hpp>
13#include <utility>
14
15using namespace com::sun::star;
16using namespace ooo::vba;
17
18ScVbaMenu::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 ))
19{
20}
21
22OUString SAL_CALL
24{
25 return m_xCommandBarControl->getCaption();
26}
27
28void SAL_CALL
29ScVbaMenu::setCaption( const OUString& _caption )
30{
31 m_xCommandBarControl->setCaption( _caption );
32}
33
34void SAL_CALL
36{
37 m_xCommandBarControl->Delete();
38}
39
40uno::Any SAL_CALL
42{
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() )
46 {
47 return xMenuItems->Item( aIndex, uno::Any() );
48 }
49 return uno::Any( xMenuItems );
50}
51
52OUString
54{
55 return "ScVbaMenu";
56}
57
58uno::Sequence<OUString>
60{
61 static uno::Sequence< OUString > const aServiceNames
62 {
63 "ooo.vba.excel.Menu"
64 };
65 return aServiceNames;
66}
67
68/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XComponentContext > mxContext
css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl
Definition: vbamenu.hxx:20
ScVbaMenu(const css::uno::Reference< ov::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, css::uno::Reference< ov::XCommandBarControl > xCommandBarControl)
Definition: vbamenu.cxx:18
virtual void SAL_CALL Delete() override
Definition: vbamenu.cxx:35
virtual css::uno::Sequence< OUString > getServiceNames() override
Definition: vbamenu.cxx:59
virtual css::uno::Any SAL_CALL MenuItems(const css::uno::Any &aIndex) override
Definition: vbamenu.cxx:41
virtual OUString getServiceImplName() override
Definition: vbamenu.cxx:53
virtual OUString SAL_CALL getCaption() override
Definition: vbamenu.cxx:23
virtual void SAL_CALL setCaption(const OUString &_caption) override
Definition: vbamenu.cxx:29
std::deque< AttacherIndex_Impl > aIndex
Sequence< OUString > aServiceNames