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