LibreOffice Module sc (master)  1
vbamenubar.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 #include "vbamenubar.hxx"
10 #include "vbamenus.hxx"
11 #include <ooo/vba/XCommandBarControls.hpp>
12 
13 using namespace com::sun::star;
14 using namespace ooo::vba;
15 
16 ScVbaMenuBar::ScVbaMenuBar( const uno::Reference< ov::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< XCommandBar >& rCommandBar ) : MenuBar_BASE(rParent, rContext), m_xCommandBar(rCommandBar)
17 {
18 }
19 
20 uno::Any SAL_CALL
21 ScVbaMenuBar::Menus( const uno::Any& aIndex )
22 {
23  uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBar->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
24  uno::Reference< excel::XMenus > xMenus( new ScVbaMenus( this, mxContext, xCommandBarControls ) );
25  if( aIndex.hasValue() )
26  {
27  return xMenus->Item( aIndex, uno::Any() );
28  }
29  return uno::makeAny( xMenus );
30 }
31 
32 OUString
34 {
35  return "ScVbaMenuBar";
36 }
37 
38 uno::Sequence<OUString>
40 {
41  static uno::Sequence< OUString > const aServiceNames
42  {
43  "ooo.vba.excel.MenuBar"
44  };
45  return aServiceNames;
46 }
47 
48 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool hasValue()
Sequence< OUString > aServiceNames
css::uno::Reference< ov::XCommandBar > m_xCommandBar
Definition: vbamenubar.hxx:21
virtual css::uno::Any SAL_CALL Menus(const css::uno::Any &aIndex) override
Definition: vbamenubar.cxx:21
virtual OUString getServiceImplName() override
Definition: vbamenubar.cxx:33
virtual css::uno::Sequence< OUString > getServiceNames() override
Definition: vbamenubar.cxx:39
css::uno::Reference< css::uno::XComponentContext > mxContext
ScVbaMenuBar(const css::uno::Reference< ov::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Reference< ov::XCommandBar > &rCommandBar)
Definition: vbamenubar.cxx:16