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 :
29 : #include "vbamenu.hxx"
30 : #include "vbamenuitems.hxx"
31 :
32 : using namespace com::sun::star;
33 : using namespace ooo::vba;
34 :
35 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 )
36 : {
37 0 : }
38 :
39 : ::rtl::OUString SAL_CALL
40 0 : ScVbaMenu::getCaption() throw ( uno::RuntimeException )
41 : {
42 0 : return m_xCommandBarControl->getCaption();
43 : }
44 :
45 : void SAL_CALL
46 0 : ScVbaMenu::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
47 : {
48 0 : m_xCommandBarControl->setCaption( _caption );
49 0 : }
50 :
51 : void SAL_CALL
52 0 : ScVbaMenu::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
53 : {
54 0 : m_xCommandBarControl->Delete();
55 0 : }
56 :
57 : uno::Any SAL_CALL
58 0 : ScVbaMenu::MenuItems( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
59 : {
60 0 : uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBarControl->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
61 0 : uno::Reference< excel::XMenuItems > xMenuItems( new ScVbaMenuItems( this, mxContext, xCommandBarControls ) );
62 0 : if( aIndex.hasValue() )
63 : {
64 0 : return xMenuItems->Item( aIndex, uno::Any() );
65 : }
66 0 : return uno::makeAny( xMenuItems );
67 : }
68 :
69 : rtl::OUString
70 0 : ScVbaMenu::getServiceImplName()
71 : {
72 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaMenu"));
73 : }
74 :
75 : uno::Sequence<rtl::OUString>
76 0 : ScVbaMenu::getServiceNames()
77 : {
78 0 : static uno::Sequence< rtl::OUString > aServiceNames;
79 0 : if ( aServiceNames.getLength() == 0 )
80 : {
81 0 : aServiceNames.realloc( 1 );
82 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menu" ) );
83 : }
84 0 : return aServiceNames;
85 : }
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|