Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _CPPUHELPER_COMPBASE2_HXX_
29 : : #define _CPPUHELPER_COMPBASE2_HXX_
30 : :
31 : : #include <cppuhelper/implbase2.hxx>
32 : : #include <cppuhelper/compbase_ex.hxx>
33 : :
34 : : namespace cppu
35 : : {
36 : :
37 : : // Suppress warnings about hidden functions in case any of the IfcN has
38 : : // functions named dispose, addEventListener, or removeEventListener:
39 : : #if defined __SUNPRO_CC
40 : : #pragma disable_warn
41 : : #endif
42 : :
43 : : /** Implementation helper supporting com::sun::star::lang::XTypeProvider and
44 : : com::sun::star::lang::XComponent.
45 : :
46 : : Upon disposing objects of this class, sub-classes receive a disposing()
47 : : call. Objects of this class can be held weakly, i.e. by a
48 : : com::sun::star::uno::WeakReference.
49 : :
50 : : @attention
51 : : The life-cycle of the passed mutex reference has to be longer than objects of this class.
52 : :
53 : : @derive
54 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
55 : : Your sub class defines method implementations for these interface(s).
56 : : */
57 : : template< class Ifc1, class Ifc2 >
58 [ - + ][ - + ]: 62859 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper2
59 : : : public WeakComponentImplHelperBase
60 : : , public ::com::sun::star::lang::XTypeProvider
61 : : , public Ifc1, public Ifc2
62 : : {
63 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakComponentImplHelper2<Ifc1, Ifc2> > > {};
64 : : public:
65 : 63571 : inline WeakComponentImplHelper2( ::osl::Mutex & rMutex ) throw ()
66 : 63571 : : WeakComponentImplHelperBase( rMutex )
67 : 63571 : {}
68 : 656609 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
69 : 656609 : { return WeakComponentImplHelper_query( rType, cd::get(), this, (WeakComponentImplHelperBase *)this ); }
70 : 2849086 : virtual void SAL_CALL acquire() throw ()
71 : 2849086 : { WeakComponentImplHelperBase::acquire(); }
72 : 2836370 : virtual void SAL_CALL release() throw ()
73 : 2836370 : { WeakComponentImplHelperBase::release(); }
74 : 63417 : virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException)
75 : 63417 : { WeakComponentImplHelperBase::dispose(); }
76 : 701 : virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
77 : 701 : { WeakComponentImplHelperBase::addEventListener(xListener); }
78 : 207 : virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
79 : 207 : { WeakComponentImplHelperBase::removeEventListener(xListener); }
80 : 543 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
81 : 543 : { return WeakComponentImplHelper_getTypes( cd::get() ); }
82 : 543 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
83 : 543 : { return ImplHelper_getImplementationId( cd::get() ); }
84 : : };
85 : :
86 : : #if defined __SUNPRO_CC
87 : : #pragma enable_warn
88 : : #endif
89 : :
90 : : /** Same as WeakComponentImplHelper2, except doesn't implement
91 : : addEventListener, removeEventListener and dispose.
92 : :
93 : : This requires derived classes to implement those three methods.
94 : : This makes it possible to implement classes which are required to
95 : : implement methods from multiple bases which have different
96 : : addEventListener/removeEventListener signatures without triggering
97 : : the g++ overloaded-virtual warning
98 : : */
99 : : template< class Ifc1, class Ifc2 >
100 [ - + ]: 30 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper2
101 : : : public WeakComponentImplHelperBase
102 : : , public ::com::sun::star::lang::XTypeProvider
103 : : , public Ifc1, public Ifc2
104 : : {
105 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, PartialWeakComponentImplHelper2<Ifc1, Ifc2> > > {};
106 : : public:
107 : 220 : inline PartialWeakComponentImplHelper2( ::osl::Mutex & rMutex ) throw ()
108 : 220 : : WeakComponentImplHelperBase( rMutex )
109 : 220 : {}
110 : 1080 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
111 : 1080 : { return WeakComponentImplHelper_query( rType, cd::get(), this, (WeakComponentImplHelperBase *)this ); }
112 : 3846 : virtual void SAL_CALL acquire() throw ()
113 : 3846 : { WeakComponentImplHelperBase::acquire(); }
114 : 3466 : virtual void SAL_CALL release() throw ()
115 : 3466 : { WeakComponentImplHelperBase::release(); }
116 : 0 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
117 : 0 : { return WeakComponentImplHelper_getTypes( cd::get() ); }
118 : 0 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
119 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
120 : : };
121 : :
122 : :
123 : : /** Implementation helper supporting com::sun::star::lang::XTypeProvider and
124 : : com::sun::star::lang::XComponent.
125 : :
126 : : Upon disposing objects of this class, sub-classes receive a disposing()
127 : : call. Objects of this class can be held weakly, i.e. by a
128 : : com::sun::star::uno::WeakReference. Object of this class can be
129 : : aggregated, i.e. incoming queryInterface() calls are delegated.
130 : :
131 : : @attention
132 : : The life-cycle of the passed mutex reference has to be longer than objects of this class.
133 : :
134 : : @derive
135 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
136 : : Your sub class defines method implementations for these interface(s).
137 : :
138 : : @deprecated
139 : : */
140 : : template< class Ifc1, class Ifc2 >
141 [ - + ]: 5476 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper2
142 : : : public WeakAggComponentImplHelperBase
143 : : , public ::com::sun::star::lang::XTypeProvider
144 : : , public Ifc1, public Ifc2
145 : : {
146 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggComponentImplHelper2<Ifc1, Ifc2> > > {};
147 : : public:
148 : 5576 : inline WeakAggComponentImplHelper2( ::osl::Mutex & rMutex ) throw ()
149 : 5576 : : WeakAggComponentImplHelperBase( rMutex )
150 : 5576 : {}
151 : 38117 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
152 : 38117 : { return WeakAggComponentImplHelperBase::queryInterface( rType ); }
153 : 38117 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
154 : 38117 : { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, (WeakAggComponentImplHelperBase *)this ); }
155 : 427423 : virtual void SAL_CALL acquire() throw ()
156 : 427423 : { WeakAggComponentImplHelperBase::acquire(); }
157 : 426677 : virtual void SAL_CALL release() throw ()
158 : 426677 : { WeakAggComponentImplHelperBase::release(); }
159 : 0 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
160 : 0 : { return WeakAggComponentImplHelper_getTypes( cd::get() ); }
161 : 0 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
162 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
163 : : };
164 : : }
165 : :
166 : : #endif
167 : :
168 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|