Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Initial Developer of the Original Code is
16 : * Novell Inc.
17 : * Portions created by the Initial Developer are Copyright (C) 2010 the
18 : * Initial Developer. All Rights Reserved.
19 : *
20 : * Contributor(s): Pei Feng Lin <pflin@novell.com>
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : * instead of those above.
27 : */
28 : #include "vbamenubar.hxx"
29 : #include "vbamenus.hxx"
30 : #include <ooo/vba/XCommandBarControls.hpp>
31 :
32 : using namespace com::sun::star;
33 : using namespace ooo::vba;
34 :
35 0 : 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 )
36 : {
37 0 : }
38 :
39 : uno::Any SAL_CALL
40 0 : ScVbaMenuBar::Menus( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
41 : {
42 0 : uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBar->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
43 0 : uno::Reference< excel::XMenus > xMenus( new ScVbaMenus( this, mxContext, xCommandBarControls ) );
44 0 : if( aIndex.hasValue() )
45 : {
46 0 : return xMenus->Item( aIndex, uno::Any() );
47 : }
48 0 : return uno::makeAny( xMenus );
49 : }
50 :
51 : rtl::OUString
52 0 : ScVbaMenuBar::getServiceImplName()
53 : {
54 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBar"));
55 : }
56 :
57 : uno::Sequence<rtl::OUString>
58 0 : ScVbaMenuBar::getServiceNames()
59 : {
60 0 : static uno::Sequence< rtl::OUString > aServiceNames;
61 0 : if ( aServiceNames.getLength() == 0 )
62 : {
63 0 : aServiceNames.realloc( 1 );
64 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBar" ) );
65 : }
66 0 : return aServiceNames;
67 : }
68 :
69 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|