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/XConnectionPointContainer.hpp> 23 #include <cppuhelper/weak.hxx> 24 #include <cppuhelper/interfacecontainer.hxx> 25 26 namespace com::sun::star::lang { class XConnectionPoint; } 27 28 namespace unocontrols { 29 30 class OConnectionPointContainerHelper final : public css::lang::XConnectionPointContainer 31 , public ::cppu::OWeakObject 32 { 33 public: 34 OConnectionPointContainerHelper( ::osl::Mutex& aMutex ); 35 36 virtual ~OConnectionPointContainerHelper() override; 37 38 // XInterface 39 40 /** 41 @short give answer, if interface is supported 42 @descr The interfaces are searched by type. 43 44 @seealso XInterface 45 46 @param "rType" is the type of searched interface. 47 48 @return Any information about found interface 49 50 @onerror A RuntimeException is thrown. 51 */ 52 53 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; 54 55 /** 56 @short increment refcount 57 @seealso XInterface 58 @seealso release() 59 @onerror A RuntimeException is thrown. 60 */ 61 62 virtual void SAL_CALL acquire() noexcept override; 63 64 /** 65 @short decrement refcount 66 @seealso XInterface 67 @seealso acquire() 68 @onerror A RuntimeException is thrown. 69 */ 70 71 virtual void SAL_CALL release() noexcept override; 72 73 // XConnectionPointContainer 74 75 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getConnectionPointTypes() override; 76 77 virtual css::uno::Reference< css::lang::XConnectionPoint > SAL_CALL queryConnectionPoint( 78 const css::uno::Type& aType 79 ) override; 80 81 virtual void SAL_CALL advise( 82 const css::uno::Type& aType , 83 const css::uno::Reference< css::uno::XInterface >& xListener 84 ) override; 85 86 virtual void SAL_CALL unadvise( 87 const css::uno::Type& aType , 88 const css::uno::Reference< css::uno::XInterface >& xListener 89 ) override; 90 91 // public but impl method! 92 // Is necessary to get container member at OConnectionPoint-instance. 93 // Impl methods are not threadsafe! 94 // "Parent" function must do this. impl_getMultiTypeContainer()95 ::cppu::OMultiTypeInterfaceContainerHelper& impl_getMultiTypeContainer() { return m_aMultiTypeContainer; } 96 97 private: 98 ::osl::Mutex& m_aSharedMutex; 99 ::cppu::OMultiTypeInterfaceContainerHelper m_aMultiTypeContainer; // Container to hold listener 100 }; 101 102 } 103 104 105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 106