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 :
10 : #include "vbamenu.hxx"
11 : #include "vbamenuitems.hxx"
12 :
13 : using namespace com::sun::star;
14 : using namespace ooo::vba;
15 :
16 0 : 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 )
17 : {
18 0 : }
19 :
20 : OUString SAL_CALL
21 0 : ScVbaMenu::getCaption() throw ( uno::RuntimeException, std::exception )
22 : {
23 0 : return m_xCommandBarControl->getCaption();
24 : }
25 :
26 : void SAL_CALL
27 0 : ScVbaMenu::setCaption( const OUString& _caption ) throw (uno::RuntimeException, std::exception)
28 : {
29 0 : m_xCommandBarControl->setCaption( _caption );
30 0 : }
31 :
32 : void SAL_CALL
33 0 : ScVbaMenu::Delete( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
34 : {
35 0 : m_xCommandBarControl->Delete();
36 0 : }
37 :
38 : uno::Any SAL_CALL
39 0 : ScVbaMenu::MenuItems( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
40 : {
41 0 : uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBarControl->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
42 0 : uno::Reference< excel::XMenuItems > xMenuItems( new ScVbaMenuItems( this, mxContext, xCommandBarControls ) );
43 0 : if( aIndex.hasValue() )
44 : {
45 0 : return xMenuItems->Item( aIndex, uno::Any() );
46 : }
47 0 : return uno::makeAny( xMenuItems );
48 : }
49 :
50 : OUString
51 0 : ScVbaMenu::getServiceImplName()
52 : {
53 0 : return OUString("ScVbaMenu");
54 : }
55 :
56 : uno::Sequence<OUString>
57 0 : ScVbaMenu::getServiceNames()
58 : {
59 0 : static uno::Sequence< OUString > aServiceNames;
60 0 : if ( aServiceNames.getLength() == 0 )
61 : {
62 0 : aServiceNames.realloc( 1 );
63 0 : aServiceNames[ 0 ] = "ooo.vba.excel.Menu";
64 : }
65 0 : return aServiceNames;
66 12 : }
67 :
68 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|