1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef _CPPUHELPER_COMPBASE3_HXX_
20 #define _CPPUHELPER_COMPBASE3_HXX_
22 #include <cppuhelper/implbase3.hxx>
23 #include <cppuhelper/compbase_ex.hxx>
28 // Suppress warnings about hidden functions in case any of the IfcN has
29 // functions named dispose, addEventListener, or removeEventListener:
30 #if defined __SUNPRO_CC
34 /** Implementation helper supporting com::sun::star::lang::XTypeProvider and
35 com::sun::star::lang::XComponent.
37 Upon disposing objects of this class, sub-classes receive a disposing()
38 call. Objects of this class can be held weakly, i.e. by a
39 com::sun::star::uno::WeakReference.
42 The life-cycle of the passed mutex reference has to be longer than objects of this class.
45 Inherit from this class giving your interface(s) to be implemented as template argument(s).
46 Your sub class defines method implementations for these interface(s).
48 template< class Ifc1
, class Ifc2
, class Ifc3
>
49 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper3
50 : public WeakComponentImplHelperBase
51 , public ::com::sun::star::lang::XTypeProvider
52 , public Ifc1
, public Ifc2
, public Ifc3
54 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, WeakComponentImplHelper3
<Ifc1
, Ifc2
, Ifc3
> > > {};
56 inline WeakComponentImplHelper3( ::osl::Mutex
& rMutex
) throw ()
57 : WeakComponentImplHelperBase( rMutex
)
59 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( ::com::sun::star::uno::Type
const & rType
) throw (::com::sun::star::uno::RuntimeException
)
60 { return WeakComponentImplHelper_query( rType
, cd::get(), this, (WeakComponentImplHelperBase
*)this ); }
61 virtual void SAL_CALL
acquire() throw ()
62 { WeakComponentImplHelperBase::acquire(); }
63 virtual void SAL_CALL
release() throw ()
64 { WeakComponentImplHelperBase::release(); }
65 virtual void SAL_CALL
dispose()throw (::com::sun::star::uno::RuntimeException
)
66 { WeakComponentImplHelperBase::dispose(); }
67 virtual void SAL_CALL
addEventListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & xListener
)throw (::com::sun::star::uno::RuntimeException
)
68 { WeakComponentImplHelperBase::addEventListener(xListener
); }
69 virtual void SAL_CALL
removeEventListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & xListener
)throw (::com::sun::star::uno::RuntimeException
)
70 { WeakComponentImplHelperBase::removeEventListener(xListener
); }
71 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw (::com::sun::star::uno::RuntimeException
)
72 { return WeakComponentImplHelper_getTypes( cd::get() ); }
73 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (::com::sun::star::uno::RuntimeException
)
74 { return ImplHelper_getImplementationId( cd::get() ); }
77 #if defined __SUNPRO_CC
81 /** Same as WeakComponentImplHelper3, except doesn't implement
82 addEventListener, removeEventListener and dispose.
84 This requires derived classes to implement those three methods.
85 This makes it possible to implement classes which are required to
86 implement methods from multiple bases which have different
87 addEventListener/removeEventListener signatures without triggering
88 the g++ overloaded-virtual warning
90 template< class Ifc1
, class Ifc2
, class Ifc3
>
91 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper3
92 : public WeakComponentImplHelperBase
93 , public ::com::sun::star::lang::XTypeProvider
94 , public Ifc1
, public Ifc2
, public Ifc3
96 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, PartialWeakComponentImplHelper3
<Ifc1
, Ifc2
, Ifc3
> > > {};
98 inline PartialWeakComponentImplHelper3( ::osl::Mutex
& rMutex
) throw ()
99 : WeakComponentImplHelperBase( rMutex
)
101 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( ::com::sun::star::uno::Type
const & rType
) throw (::com::sun::star::uno::RuntimeException
)
102 { return WeakComponentImplHelper_query( rType
, cd::get(), this, (WeakComponentImplHelperBase
*)this ); }
103 virtual void SAL_CALL
acquire() throw ()
104 { WeakComponentImplHelperBase::acquire(); }
105 virtual void SAL_CALL
release() throw ()
106 { WeakComponentImplHelperBase::release(); }
107 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw (::com::sun::star::uno::RuntimeException
)
108 { return WeakComponentImplHelper_getTypes( cd::get() ); }
109 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (::com::sun::star::uno::RuntimeException
)
110 { return ImplHelper_getImplementationId( cd::get() ); }
113 /** Implementation helper supporting com::sun::star::lang::XTypeProvider and
114 com::sun::star::lang::XComponent.
116 Upon disposing objects of this class, sub-classes receive a disposing()
117 call. Objects of this class can be held weakly, i.e. by a
118 com::sun::star::uno::WeakReference. Object of this class can be
119 aggregated, i.e. incoming queryInterface() calls are delegated.
122 The life-cycle of the passed mutex reference has to be longer than objects of this class.
125 Inherit from this class giving your interface(s) to be implemented as template argument(s).
126 Your sub class defines method implementations for these interface(s).
130 template< class Ifc1
, class Ifc2
, class Ifc3
>
131 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper3
132 : public WeakAggComponentImplHelperBase
133 , public ::com::sun::star::lang::XTypeProvider
134 , public Ifc1
, public Ifc2
, public Ifc3
136 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, WeakAggComponentImplHelper3
<Ifc1
, Ifc2
, Ifc3
> > > {};
138 inline WeakAggComponentImplHelper3( ::osl::Mutex
& rMutex
) throw ()
139 : WeakAggComponentImplHelperBase( rMutex
)
141 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( ::com::sun::star::uno::Type
const & rType
) throw (::com::sun::star::uno::RuntimeException
)
142 { return WeakAggComponentImplHelperBase::queryInterface( rType
); }
143 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation( ::com::sun::star::uno::Type
const & rType
) throw (::com::sun::star::uno::RuntimeException
)
144 { return WeakAggComponentImplHelper_queryAgg( rType
, cd::get(), this, (WeakAggComponentImplHelperBase
*)this ); }
145 virtual void SAL_CALL
acquire() throw ()
146 { WeakAggComponentImplHelperBase::acquire(); }
147 virtual void SAL_CALL
release() throw ()
148 { WeakAggComponentImplHelperBase::release(); }
149 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw (::com::sun::star::uno::RuntimeException
)
150 { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
151 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (::com::sun::star::uno::RuntimeException
)
152 { return ImplHelper_getImplementationId( cd::get() ); }
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */