Line data Source code
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 0 : ScVbaMenuBar::ScVbaMenuBar( const uno::Reference< ov::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< XCommandBar >& rCommandBar ) throw( uno::RuntimeException ) : MenuBar_BASE(rParent, rContext), m_xCommandBar(rCommandBar)
17 : {
18 0 : }
19 :
20 : uno::Any SAL_CALL
21 0 : ScVbaMenuBar::Menus( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
22 : {
23 0 : uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBar->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
24 0 : uno::Reference< excel::XMenus > xMenus( new ScVbaMenus( this, mxContext, xCommandBarControls ) );
25 0 : if( aIndex.hasValue() )
26 : {
27 0 : return xMenus->Item( aIndex, uno::Any() );
28 : }
29 0 : return uno::makeAny( xMenus );
30 : }
31 :
32 : OUString
33 0 : ScVbaMenuBar::getServiceImplName()
34 : {
35 0 : return OUString("ScVbaMenuBar");
36 : }
37 :
38 : uno::Sequence<OUString>
39 0 : ScVbaMenuBar::getServiceNames()
40 : {
41 0 : static uno::Sequence< OUString > aServiceNames;
42 0 : if ( aServiceNames.getLength() == 0 )
43 : {
44 0 : aServiceNames.realloc( 1 );
45 0 : aServiceNames[ 0 ] = "ooo.vba.excel.MenuBar";
46 : }
47 0 : return aServiceNames;
48 : }
49 :
50 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|