Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / UnoControls / source / inc / OConnectionPointHelper.hxx
blob96529b20e7959de1409d36be4c6c59509695c31a
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/lang/XConnectionPoint.hpp>
23 #include <cppuhelper/weak.hxx>
24 #include <cppuhelper/weakref.hxx>
26 namespace com::sun::star::lang { class XConnectionPointContainer; }
27 namespace unocontrols { class OConnectionPointContainerHelper; }
29 namespace unocontrols {
31 class OConnectionPointHelper final : public css::lang::XConnectionPoint
32 , public ::cppu::OWeakObject
34 public:
35 OConnectionPointHelper( ::osl::Mutex& aMutex ,
36 OConnectionPointContainerHelper* pContainerImplementation ,
37 css::uno::Type const & aType );
39 virtual ~OConnectionPointHelper() override;
41 // XInterface
43 /**
44 @short give answer, if interface is supported
45 @descr The interfaces are searched by type.
47 @seealso XInterface
49 @param "rType" is the type of searched interface.
51 @return Any information about found interface
53 @onerror A RuntimeException is thrown.
56 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
58 /**
59 @short increment refcount
60 @seealso XInterface
61 @seealso release()
62 @onerror A RuntimeException is thrown.
65 virtual void SAL_CALL acquire() noexcept override;
67 /**
68 @short decrement refcount
69 @seealso XInterface
70 @seealso acquire()
71 @onerror A RuntimeException is thrown.
74 virtual void SAL_CALL release() noexcept override;
76 // XConnectionPoint
78 virtual css::uno::Type SAL_CALL getConnectionType() override;
80 virtual css::uno::Reference< css::lang::XConnectionPointContainer > SAL_CALL getConnectionPointContainer() override;
82 virtual void SAL_CALL advise(
83 const css::uno::Reference< css::uno::XInterface >& xListener
84 ) override;
86 virtual void SAL_CALL unadvise( const css::uno::Reference< css::uno::XInterface >& xListener ) override;
88 virtual css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > SAL_CALL getConnections() override;
90 private:
91 bool impl_LockContainer();
93 void impl_UnlockContainer();
95 private:
97 ::osl::Mutex& m_aSharedMutex;
98 css::uno::WeakReference< css::lang::XConnectionPointContainer > m_oContainerWeakReference; // Reference to container-class!. Don't use Reference<...>
99 // It is a ring-reference => and must be a wekreference!
100 OConnectionPointContainerHelper* m_pContainerImplementation;
101 css::uno::Type m_aInterfaceType;
102 css::uno::Reference< css::uno::XInterface > m_xLock;
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */