1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include "vbamenu.hxx"
11 #include "vbamenuitems.hxx"
13 using namespace com::sun::star
;
14 using namespace ooo::vba
;
16 ScVbaMenu::ScVbaMenu( const uno::Reference
< ov::XHelperInterface
>& rParent
, const uno::Reference
< uno::XComponentContext
>& rContext
, const uno::Reference
< XCommandBarControl
>& rCommandBarControl
) throw( uno::RuntimeException
) : Menu_BASE( rParent
, rContext
), m_xCommandBarControl( rCommandBarControl
)
21 ScVbaMenu::getCaption() throw ( uno::RuntimeException
, std::exception
)
23 return m_xCommandBarControl
->getCaption();
27 ScVbaMenu::setCaption( const OUString
& _caption
) throw (uno::RuntimeException
, std::exception
)
29 m_xCommandBarControl
->setCaption( _caption
);
33 ScVbaMenu::Delete( ) throw (script::BasicErrorException
, uno::RuntimeException
, std::exception
)
35 m_xCommandBarControl
->Delete();
39 ScVbaMenu::MenuItems( const uno::Any
& aIndex
) throw (script::BasicErrorException
, uno::RuntimeException
, std::exception
)
41 uno::Reference
< XCommandBarControls
> xCommandBarControls( m_xCommandBarControl
->Controls( uno::Any() ), uno::UNO_QUERY_THROW
);
42 uno::Reference
< excel::XMenuItems
> xMenuItems( new ScVbaMenuItems( this, mxContext
, xCommandBarControls
) );
43 if( aIndex
.hasValue() )
45 return xMenuItems
->Item( aIndex
, uno::Any() );
47 return uno::makeAny( xMenuItems
);
51 ScVbaMenu::getServiceImplName()
53 return OUString("ScVbaMenu");
56 uno::Sequence
<OUString
>
57 ScVbaMenu::getServiceNames()
59 static uno::Sequence
< OUString
> aServiceNames
;
60 if ( aServiceNames
.getLength() == 0 )
62 aServiceNames
.realloc( 1 );
63 aServiceNames
[ 0 ] = "ooo.vba.excel.Menu";
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */