Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / framework / inc / helper / uiconfigelementwrapperbase.hxx
blob5b561bef5db58940c58dce15f084f96b68678b35
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <com/sun/star/ui/XUIElement.hpp>
23 #include <com/sun/star/ui/XUIElementSettings.hpp>
24 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
25 #include <com/sun/star/ui/XUIConfigurationListener.hpp>
26 #include <com/sun/star/frame/XFrame.hpp>
27 #include <com/sun/star/awt/XMenuBar.hpp>
28 #include <com/sun/star/util/XUpdatable.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/lang/XComponent.hpp>
32 #include <rtl/ustring.hxx>
33 #include <comphelper/multicontainer2.hxx>
34 #include <cppuhelper/basemutex.hxx>
35 #include <cppuhelper/propshlp.hxx>
36 #include <cppuhelper/implbase.hxx>
37 #include <cppuhelper/weakref.hxx>
39 namespace framework
42 typedef ::cppu::WeakImplHelper<
43 css::ui::XUIElement,
44 css::ui::XUIElementSettings,
45 css::lang::XInitialization,
46 css::lang::XComponent,
47 css::util::XUpdatable,
48 css::ui::XUIConfigurationListener > UIConfigElementWrapperBase_BASE;
50 class UIConfigElementWrapperBase : private cppu::BaseMutex,
51 public ::cppu::OBroadcastHelper ,
52 public ::cppu::OPropertySetHelper ,
53 public UIConfigElementWrapperBase_BASE
56 // public methods
58 public:
59 UIConfigElementWrapperBase( sal_Int16 nType );
60 virtual ~UIConfigElementWrapperBase() override;
62 // XInterface
63 virtual void SAL_CALL acquire() noexcept override
64 { OWeakObject::acquire(); }
65 virtual void SAL_CALL release() noexcept override
66 { OWeakObject::release(); }
67 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& type) override;
69 // XTypeProvider
70 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
72 // XComponent
73 virtual void SAL_CALL dispose() override = 0;
74 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
75 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
77 // XInitialization
78 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
80 // XUIElementSettings
81 virtual void SAL_CALL updateSettings() override = 0;
82 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) override;
83 virtual void SAL_CALL setSettings( const css::uno::Reference< css::container::XIndexAccess >& UISettings ) override;
85 // XUIElement
86 virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() override;
87 virtual OUString SAL_CALL getResourceURL() override;
88 virtual ::sal_Int16 SAL_CALL getType() override;
89 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getRealInterface() override = 0;
91 // XUpdatable
92 virtual void SAL_CALL update() override;
94 // XUIConfigurationListener
95 virtual void SAL_CALL elementInserted( const css::ui::ConfigurationEvent& Event ) override;
96 virtual void SAL_CALL elementRemoved( const css::ui::ConfigurationEvent& Event ) override;
97 virtual void SAL_CALL elementReplaced( const css::ui::ConfigurationEvent& Event ) override;
99 // XEventListener
100 using cppu::OPropertySetHelper::disposing;
101 virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override;
103 // protected methods
105 protected:
107 // OPropertySetHelper
108 virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue ,
109 css::uno::Any& aOldValue ,
110 sal_Int32 nHandle ,
111 const css::uno::Any& aValue ) override;
112 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
113 const css::uno::Any& aValue ) override;
114 using cppu::OPropertySetHelper::getFastPropertyValue;
115 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& aValue ,
116 sal_Int32 nHandle ) const override;
117 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
118 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
120 virtual void impl_fillNewData();
122 static css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor();
124 sal_Int16 m_nType;
125 bool m_bPersistent : 1,
126 m_bInitialized : 1,
127 m_bConfigListener : 1,
128 m_bConfigListening : 1,
129 m_bDisposed : 1,
130 m_bNoClose : 1;
131 OUString m_aResourceURL;
132 css::uno::Reference< css::ui::XUIConfigurationManager > m_xConfigSource;
133 css::uno::Reference< css::container::XIndexAccess > m_xConfigData;
134 css::uno::WeakReference< css::frame::XFrame > m_xWeakFrame;
135 css::uno::Reference< css::awt::XMenuBar > m_xMenuBar;
136 comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener
139 } // namespace framework
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */