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_VBACOMMANDBARCONTROL_HXX
20 : #define INCLUDED_VBAHELPER_SOURCE_VBAHELPER_VBACOMMANDBARCONTROL_HXX
21 :
22 : #include <ooo/vba/XCommandBarControl.hpp>
23 : #include <ooo/vba/XCommandBarPopup.hpp>
24 : #include <ooo/vba/XCommandBarButton.hpp>
25 : #include <ooo/vba/office/MsoControlType.hpp>
26 : #include <com/sun/star/awt/XMenu.hpp>
27 : #include <vbahelper/vbahelperinterface.hxx>
28 : #include "vbacommandbarhelper.hxx"
29 : #include <cppuhelper/implbase1.hxx>
30 :
31 : typedef InheritedHelperInterfaceImpl1< ov::XCommandBarControl > CommandBarControl_BASE;
32 :
33 0 : class ScVbaCommandBarControl : public CommandBarControl_BASE
34 : {
35 : protected:
36 : VbaCommandBarHelperRef pCBarHelper;
37 : OUString m_sResourceUrl;
38 : css::uno::Reference< css::container::XIndexAccess > m_xCurrentSettings;
39 : css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
40 : css::uno::Sequence< css::beans::PropertyValue > m_aPropertyValues;
41 :
42 : sal_Int32 m_nPosition;
43 : bool m_bTemporary;
44 :
45 : private:
46 : void ApplyChange() throw (css::uno::RuntimeException);
47 :
48 : public:
49 : ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const OUString& sResourceUrl ) throw (css::uno::RuntimeException);
50 :
51 : // Attributes
52 : virtual OUString SAL_CALL getCaption() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
53 : virtual void SAL_CALL setCaption( const OUString& _caption ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
54 : virtual OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
55 : virtual void SAL_CALL setOnAction( const OUString& _onaction ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
56 : virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 : virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
58 : virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
59 : virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
60 : virtual sal_Bool SAL_CALL getBeginGroup() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
61 : virtual void SAL_CALL setBeginGroup( sal_Bool _begin ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
62 0 : virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
63 : {
64 0 : return ov::office::MsoControlType::msoControlButton;
65 : }
66 :
67 : // Methods
68 : virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 : virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 :
71 : // XHelperInterface
72 : virtual OUString getServiceImplName() SAL_OVERRIDE;
73 : virtual css::uno::Sequence<OUString> getServiceNames() SAL_OVERRIDE;
74 : };
75 :
76 : typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPopup > CommandBarPopup_BASE;
77 0 : class ScVbaCommandBarPopup : public CommandBarPopup_BASE
78 : {
79 : public:
80 : ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const OUString& sResourceUrl, sal_Int32 nPosition, bool bTemporary ) throw (css::uno::RuntimeException);
81 :
82 0 : virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
83 : {
84 0 : return ov::office::MsoControlType::msoControlPopup;
85 : }
86 : // XHelperInterface
87 : virtual OUString getServiceImplName() SAL_OVERRIDE;
88 : virtual css::uno::Sequence<OUString> getServiceNames() SAL_OVERRIDE;
89 : };
90 :
91 : typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarButton > CommandBarButton_BASE;
92 0 : class ScVbaCommandBarButton : public CommandBarButton_BASE
93 : {
94 : public:
95 : ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const OUString& sResourceUrl, sal_Int32 nPosition, bool bTemporary ) throw (css::uno::RuntimeException);
96 :
97 0 : virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
98 : {
99 0 : return ov::office::MsoControlType::msoControlButton;
100 : }
101 : // XHelperInterface
102 : virtual OUString getServiceImplName() SAL_OVERRIDE;
103 : virtual css::uno::Sequence<OUString> getServiceNames() SAL_OVERRIDE;
104 : };
105 :
106 : #endif // INCLUDED_VBAHELPER_SOURCE_VBAHELPER_VBACOMMANDBARCONTROL_HXX
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|