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 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef SC_VBA_COMMANDBAR_HXX
20 : #define SC_VBA_COMMANDBAR_HXX
21 :
22 : #include <ooo/vba/XCommandBar.hpp>
23 : #include <com/sun/star/ui/XUIConfigurationManager.hpp>
24 : #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
25 : #include <com/sun/star/container/XIndexContainer.hpp>
26 : #include <com/sun/star/beans/PropertyValues.hpp>
27 :
28 : #include <vbahelper/vbahelperinterface.hxx>
29 : #include "vbacommandbarhelper.hxx"
30 :
31 : #include <map>
32 :
33 : typedef InheritedHelperInterfaceImpl1< ov::XCommandBar > CommandBar_BASE;
34 :
35 0 : class ScVbaCommandBar : public CommandBar_BASE
36 : {
37 : private:
38 : VbaCommandBarHelperRef pCBarHelper;
39 : css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
40 : OUString m_sResourceUrl;
41 : sal_Bool m_bIsMenu;
42 :
43 : public:
44 : ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const OUString& sResourceUrl, sal_Bool bIsMenu ) throw( css::uno::RuntimeException );
45 :
46 : sal_Bool IsMenu() const { return m_bIsMenu; }
47 :
48 : // Attributes
49 : virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException);
50 : virtual void SAL_CALL setName( const OUString& _name ) throw (css::uno::RuntimeException);
51 : virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
52 : virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
53 : virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
54 : virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException);
55 :
56 : // Methods
57 : virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
58 : virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
59 : virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
60 : virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
61 :
62 : // XHelperInterface
63 : virtual OUString getServiceImplName();
64 : virtual css::uno::Sequence<OUString> getServiceNames();
65 : };
66 :
67 : /** Dummy command bar implementation. Does nothing but provide its name. */
68 0 : class VbaDummyCommandBar : public CommandBar_BASE
69 : {
70 : public:
71 : VbaDummyCommandBar(
72 : const css::uno::Reference< ov::XHelperInterface > xParent,
73 : const css::uno::Reference< css::uno::XComponentContext > xContext,
74 : const OUString& rName,
75 : sal_Int32 nType ) throw( css::uno::RuntimeException );
76 :
77 : // Attributes
78 : virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException);
79 : virtual void SAL_CALL setName( const OUString& _name ) throw (css::uno::RuntimeException);
80 : virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
81 : virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (css::uno::RuntimeException);
82 : virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
83 : virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException);
84 :
85 : // Methods
86 : virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
87 : virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
88 : virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
89 : virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
90 :
91 : // XHelperInterface
92 : virtual OUString getServiceImplName();
93 : virtual css::uno::Sequence<OUString> getServiceNames();
94 :
95 : private:
96 : OUString maName;
97 : sal_Int32 mnType;
98 : };
99 :
100 : #endif//SC_VBA_COMMANDBAR_HXX
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|