notebookbar: Simplify logic to detect whether hidden children
[LibreOffice.git] / framework / inc / helper / uielementwrapperbase.hxx
blob573755f2020dfd9b3ac8031637773852c759c576
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/lang/XInitialization.hpp>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <com/sun/star/frame/XFrame.hpp>
26 #include <com/sun/star/util/XUpdatable.hpp>
28 #include <rtl/ustring.hxx>
29 #include <comphelper/multicontainer2.hxx>
30 #include <cppuhelper/basemutex.hxx>
31 #include <cppuhelper/propshlp.hxx>
32 #include <cppuhelper/implbase.hxx>
33 #include <cppuhelper/weakref.hxx>
35 namespace framework
38 typedef ::cppu::WeakImplHelper<
39 css::ui::XUIElement,
40 css::lang::XInitialization,
41 css::lang::XComponent,
42 css::util::XUpdatable > UIElementWrapperBase_BASE;
44 class UIElementWrapperBase : private cppu::BaseMutex,
45 public ::cppu::OBroadcastHelper ,
46 public ::cppu::OPropertySetHelper ,
47 public UIElementWrapperBase_BASE
50 // public methods
52 public:
53 UIElementWrapperBase( sal_Int16 nType );
54 virtual ~UIElementWrapperBase() override;
56 // XInterface
57 virtual void SAL_CALL acquire() noexcept override
58 { OWeakObject::acquire(); }
59 virtual void SAL_CALL release() noexcept override
60 { OWeakObject::release(); }
61 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& type) override;
63 // XTypeProvider
64 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
66 // XComponent
67 virtual void SAL_CALL dispose() override = 0;
68 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
69 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
71 // XInitialization
72 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
74 // XUpdatable
75 virtual void SAL_CALL update() override;
77 // XUIElement
78 virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() override;
79 virtual OUString SAL_CALL getResourceURL() override;
80 virtual ::sal_Int16 SAL_CALL getType() override;
81 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getRealInterface() override = 0;
83 // protected methods
85 protected:
87 // OPropertySetHelper
88 virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue ,
89 css::uno::Any& aOldValue ,
90 sal_Int32 nHandle ,
91 const css::uno::Any& aValue ) override;
92 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
93 const css::uno::Any& aValue ) override;
94 using cppu::OPropertySetHelper::getFastPropertyValue;
95 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& aValue ,
96 sal_Int32 nHandle ) const override;
97 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
98 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
100 static css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor();
102 comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer; /// container for ALL Listener
103 OUString m_aResourceURL;
104 css::uno::WeakReference< css::frame::XFrame > m_xWeakFrame;
105 sal_Int16 m_nType;
106 bool m_bInitialized : 1,
107 m_bDisposed;
110 } // namespace framework
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */