Update ooo320-m1
[ooovba.git] / sc / source / ui / vba / vbamenubar.cxx
blob938602886ac5d9970cac5c1d34fc560e22c6d3b1
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile$
7 * $Revision$
9 * last change: $Author$ $Date$
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA
34 ************************************************************************/
35 #include "vbamenubar.hxx"
36 #include "vbamenus.hxx"
37 #include <ooo/vba/XCommandBarControls.hpp>
39 using namespace com::sun::star;
40 using namespace ooo::vba;
42 ScVbaMenuBar::ScVbaMenuBar( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBar >& xCommandBar ) throw( uno::RuntimeException ) : MenuBar_BASE( xParent, xContext ), m_xCommandBar( xCommandBar )
46 uno::Any SAL_CALL
47 ScVbaMenuBar::Menus( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
49 uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBar->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
50 uno::Reference< excel::XMenus > xMenus( new ScVbaMenus( this, mxContext, xCommandBarControls ) );
51 if( aIndex.hasValue() )
53 return xMenus->Item( aIndex, uno::Any() );
55 return uno::makeAny( xMenus );
58 rtl::OUString&
59 ScVbaMenuBar::getServiceImplName()
61 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBar") );
62 return sImplName;
64 uno::Sequence<rtl::OUString>
65 ScVbaMenuBar::getServiceNames()
67 static uno::Sequence< rtl::OUString > aServiceNames;
68 if ( aServiceNames.getLength() == 0 )
70 aServiceNames.realloc( 1 );
71 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBar" ) );
73 return aServiceNames;