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 INCLUDED_VBAHELPER_SOURCE_VBAHELPER_VBACOMMANDBAR_HXX
20 : #define INCLUDED_VBAHELPER_SOURCE_VBAHELPER_VBACOMMANDBAR_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 : typedef InheritedHelperInterfaceImpl1< ov::XCommandBar > CommandBar_BASE;
32 :
33 0 : class ScVbaCommandBar : public CommandBar_BASE
34 : {
35 : private:
36 : VbaCommandBarHelperRef pCBarHelper;
37 : css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
38 : OUString m_sResourceUrl;
39 : bool m_bIsMenu;
40 :
41 : public:
42 : 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, bool bIsMenu ) throw( css::uno::RuntimeException );
43 :
44 : bool IsMenu() const { return m_bIsMenu; }
45 :
46 : // Attributes
47 : virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
48 : virtual void SAL_CALL setName( const OUString& _name ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
49 : virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
50 : virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
51 : virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
52 : virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
53 :
54 : // Methods
55 : virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
56 : virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 : virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
58 : 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, std::exception) SAL_OVERRIDE;
59 :
60 : // XHelperInterface
61 : virtual OUString getServiceImplName() SAL_OVERRIDE;
62 : virtual css::uno::Sequence<OUString> getServiceNames() SAL_OVERRIDE;
63 : };
64 :
65 : /** Dummy command bar implementation. Does nothing but provide its name. */
66 0 : class VbaDummyCommandBar : public CommandBar_BASE
67 : {
68 : public:
69 : VbaDummyCommandBar(
70 : const css::uno::Reference< ov::XHelperInterface >& xParent,
71 : const css::uno::Reference< css::uno::XComponentContext >& xContext,
72 : const OUString& rName,
73 : sal_Int32 nType ) throw( css::uno::RuntimeException );
74 :
75 : // Attributes
76 : virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
77 : virtual void SAL_CALL setName( const OUString& _name ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
78 : virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 : virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 : virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
81 : virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 :
83 : // Methods
84 : virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 : virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 : virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 : 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, std::exception) SAL_OVERRIDE;
88 :
89 : // XHelperInterface
90 : virtual OUString getServiceImplName() SAL_OVERRIDE;
91 : virtual css::uno::Sequence<OUString> getServiceNames() SAL_OVERRIDE;
92 :
93 : private:
94 : OUString maName;
95 : sal_Int32 mnType;
96 : };
97 :
98 : #endif // INCLUDED_VBAHELPER_SOURCE_VBAHELPER_VBACOMMANDBAR_HXX
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|