LibreOffice Module sc (master)  1
vbamenu.cxx
Go to the documentation of this file.
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 #include <ooo/vba/XCommandBarControls.hpp>
13 
14 using namespace com::sun::star;
15 using namespace ooo::vba;
16 
17 ScVbaMenu::ScVbaMenu( const uno::Reference< ov::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< XCommandBarControl >& rCommandBarControl ) : Menu_BASE( rParent, rContext ), m_xCommandBarControl( rCommandBarControl )
18 {
19 }
20 
21 OUString SAL_CALL
23 {
24  return m_xCommandBarControl->getCaption();
25 }
26 
27 void SAL_CALL
28 ScVbaMenu::setCaption( const OUString& _caption )
29 {
30  m_xCommandBarControl->setCaption( _caption );
31 }
32 
33 void SAL_CALL
35 {
36  m_xCommandBarControl->Delete();
37 }
38 
39 uno::Any SAL_CALL
41 {
42  uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBarControl->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
43  uno::Reference< excel::XMenuItems > xMenuItems( new ScVbaMenuItems( this, mxContext, xCommandBarControls ) );
44  if( aIndex.hasValue() )
45  {
46  return xMenuItems->Item( aIndex, uno::Any() );
47  }
48  return uno::makeAny( xMenuItems );
49 }
50 
51 OUString
53 {
54  return "ScVbaMenu";
55 }
56 
57 uno::Sequence<OUString>
59 {
60  static uno::Sequence< OUString > const aServiceNames
61  {
62  "ooo.vba.excel.Menu"
63  };
64  return aServiceNames;
65 }
66 
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScVbaMenu(const css::uno::Reference< ov::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Reference< ov::XCommandBarControl > &rCommandBarControl)
Definition: vbamenu.cxx:17
bool hasValue()
Sequence< OUString > aServiceNames
virtual void SAL_CALL setCaption(const OUString &_caption) override
Definition: vbamenu.cxx:28
virtual void SAL_CALL Delete() override
Definition: vbamenu.cxx:34
virtual OUString SAL_CALL getCaption() override
Definition: vbamenu.cxx:22
virtual css::uno::Any SAL_CALL MenuItems(const css::uno::Any &aIndex) override
Definition: vbamenu.cxx:40
css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl
Definition: vbamenu.hxx:20
virtual css::uno::Sequence< OUString > getServiceNames() override
Definition: vbamenu.cxx:58
virtual OUString getServiceImplName() override
Definition: vbamenu.cxx:52
css::uno::Reference< css::uno::XComponentContext > mxContext