LibreOffice Module UnoControls (master) 1
OConnectionPointHelper.hxx
Go to the documentation of this file.
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
20#pragma once
21
22#include <com/sun/star/lang/XConnectionPoint.hpp>
23#include <cppuhelper/weak.hxx>
25
26namespace com::sun::star::lang { class XConnectionPointContainer; }
27namespace unocontrols { class OConnectionPointContainerHelper; }
28
29namespace unocontrols {
30
31class OConnectionPointHelper final : public css::lang::XConnectionPoint
32 , public ::cppu::OWeakObject
33{
34public:
35 OConnectionPointHelper( ::osl::Mutex& aMutex ,
36 OConnectionPointContainerHelper* pContainerImplementation ,
37 css::uno::Type const & aType );
38
39 virtual ~OConnectionPointHelper() override;
40
41 // XInterface
42
56 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
57
65 virtual void SAL_CALL acquire() noexcept override;
66
74 virtual void SAL_CALL release() noexcept override;
75
76 // XConnectionPoint
77
78 virtual css::uno::Type SAL_CALL getConnectionType() override;
79
80 virtual css::uno::Reference< css::lang::XConnectionPointContainer > SAL_CALL getConnectionPointContainer() override;
81
82 virtual void SAL_CALL advise(
83 const css::uno::Reference< css::uno::XInterface >& xListener
84 ) override;
85
86 virtual void SAL_CALL unadvise( const css::uno::Reference< css::uno::XInterface >& xListener ) override;
87
88 virtual css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > SAL_CALL getConnections() override;
89
90private:
91 bool impl_LockContainer();
92
94
95private:
96
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!
101 css::uno::Type m_aInterfaceType;
102 css::uno::Reference< css::uno::XInterface > m_xLock;
103};
104
105}
106
107
108/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::lang::XConnectionPointContainer > SAL_CALL getConnectionPointContainer() override
virtual css::uno::Type SAL_CALL getConnectionType() override
virtual void SAL_CALL acquire() noexcept override
increment refcount @seealso XInterface @seealso release() @onerror A RuntimeException is thrown.
css::uno::WeakReference< css::lang::XConnectionPointContainer > m_oContainerWeakReference
css::uno::Reference< css::uno::XInterface > m_xLock
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
give answer, if interface is supported @descr The interfaces are searched by type.
virtual void SAL_CALL release() noexcept override
decrement refcount @seealso XInterface @seealso acquire() @onerror A RuntimeException is thrown.
virtual void SAL_CALL advise(const css::uno::Reference< css::uno::XInterface > &xListener) override
OConnectionPointContainerHelper * m_pContainerImplementation
virtual void SAL_CALL unadvise(const css::uno::Reference< css::uno::XInterface > &xListener) override
virtual css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > SAL_CALL getConnections() override
OConnectionPointHelper(::osl::Mutex &aMutex, OConnectionPointContainerHelper *pContainerImplementation, css::uno::Type const &aType)
std::mutex aMutex