merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / vba / vbamenu.cxx
blob58972b0bcd06a6734b3755573d73647efaaf64a6
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 "vbamenu.hxx"
36 #include "vbamenuitems.hxx"
38 using namespace com::sun::star;
39 using namespace ooo::vba;
41 ScVbaMenu::ScVbaMenu( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBarControl >& xCommandBarControl ) throw( uno::RuntimeException ) : Menu_BASE( xParent, xContext ), m_xCommandBarControl( xCommandBarControl )
45 ::rtl::OUString SAL_CALL
46 ScVbaMenu::getCaption() throw ( uno::RuntimeException )
48 return m_xCommandBarControl->getCaption();
51 void SAL_CALL
52 ScVbaMenu::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
54 m_xCommandBarControl->setCaption( _caption );
57 void SAL_CALL
58 ScVbaMenu::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
60 m_xCommandBarControl->Delete();
63 uno::Any SAL_CALL
64 ScVbaMenu::MenuItems( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
66 uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBarControl->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
67 uno::Reference< excel::XMenuItems > xMenuItems( new ScVbaMenuItems( this, mxContext, xCommandBarControls ) );
68 if( aIndex.hasValue() )
70 return xMenuItems->Item( aIndex, uno::Any() );
72 return uno::makeAny( xMenuItems );
75 rtl::OUString&
76 ScVbaMenu::getServiceImplName()
78 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenu") );
79 return sImplName;
81 uno::Sequence<rtl::OUString>
82 ScVbaMenu::getServiceNames()
84 static uno::Sequence< rtl::OUString > aServiceNames;
85 if ( aServiceNames.getLength() == 0 )
87 aServiceNames.realloc( 1 );
88 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menu" ) );
90 return aServiceNames;