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_IMPLBASE3_HXX_
29 : : #define _CPPUHELPER_IMPLBASE3_HXX_
30 : :
31 : : #include <cppuhelper/implbase_ex.hxx>
32 : : #include <rtl/instance.hxx>
33 : :
34 : : namespace cppu
35 : : {
36 : : /// @cond INTERNAL
37 : :
38 : : struct class_data3
39 : : {
40 : : sal_Int16 m_nTypes;
41 : : sal_Bool m_storedTypeRefs;
42 : : sal_Bool m_storedId;
43 : : sal_Int8 m_id[ 16 ];
44 : : type_entry m_typeEntries[ 3 + 1 ];
45 : : };
46 : :
47 : : template< typename Ifc1, typename Ifc2, typename Ifc3, typename Impl > struct ImplClassData3
48 : : {
49 : 3645 : class_data* operator ()()
50 : : {
51 : : static class_data3 s_cd =
52 : : {
53 : : 3 +1, sal_False, sal_False,
54 : : { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
55 : : {
56 : : { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
57 : : { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 },
58 : : { { Ifc3::static_type }, ((sal_IntPtr)(Ifc3 *) (Impl *) 16) - 16 },
59 : : { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
60 : : }
61 : : };
62 : 3645 : return reinterpret_cast< class_data * >(&s_cd);
63 : : }
64 : : };
65 : :
66 : : /// @endcond
67 : :
68 : : /** Implementation helper implementing interface com::sun::star::lang::XTypeProvider
69 : : and method XInterface::queryInterface(), but no reference counting.
70 : :
71 : : @derive
72 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
73 : : Your sub class defines method implementations for these interface(s) including acquire()/
74 : : release() and delegates incoming queryInterface() calls to this base class.
75 : : */
76 : : template< class Ifc1, class Ifc2, class Ifc3 >
77 : 4349 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper3
78 : : : public com::sun::star::lang::XTypeProvider
79 : : , public Ifc1, public Ifc2, public Ifc3
80 : : {
81 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
82 : : public:
83 : 68744 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
84 : 68744 : { return ImplHelper_query( rType, cd::get(), this ); }
85 : 124 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
86 : 124 : { return ImplHelper_getTypes( cd::get() ); }
87 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
88 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
89 : :
90 : : #if !defined _MSC_VER // public -> protected changes mangled names there
91 : : protected:
92 : : #endif
93 : 4314 : ~ImplHelper3() throw () {}
94 : : };
95 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
96 : : com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
97 : : (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakObject).
98 : :
99 : : @derive
100 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
101 : : Your sub class defines method implementations for these interface(s).
102 : : */
103 : : template< class Ifc1, class Ifc2, class Ifc3 >
104 [ - + ][ - + ]: 531942 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper3
[ - + ][ - + ]
105 : : : public OWeakObject
106 : : , public com::sun::star::lang::XTypeProvider
107 : : , public Ifc1, public Ifc2, public Ifc3
108 : : {
109 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
110 : : public:
111 : 1308297 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
112 : 1308297 : { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
113 : 10290737 : virtual void SAL_CALL acquire() throw ()
114 : 10290737 : { OWeakObject::acquire(); }
115 : 10287068 : virtual void SAL_CALL release() throw ()
116 : 10287068 : { OWeakObject::release(); }
117 : 2 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
118 : 2 : { return WeakImplHelper_getTypes( cd::get() ); }
119 : 2 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
120 : 2 : { return ImplHelper_getImplementationId( cd::get() ); }
121 : : };
122 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
123 : : com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
124 : : (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakAggObject).
125 : : In addition, it supports also aggregation meaning object of this class can be aggregated
126 : : (com::sun::star::uno::XAggregation thru ::cppu::OWeakAggObject).
127 : : If a delegator is set (this object is aggregated), then incoming queryInterface()
128 : : calls are delegated to the delegator object. If the delegator does not support the
129 : : demanded interface, it calls queryAggregation() on its aggregated objects.
130 : :
131 : : @derive
132 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
133 : : Your sub class defines method implementations for these interface(s).
134 : : */
135 : : template< class Ifc1, class Ifc2, class Ifc3 >
136 [ - + ]: 1354 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper3
137 : : : public OWeakAggObject
138 : : , public com::sun::star::lang::XTypeProvider
139 : : , public Ifc1, public Ifc2, public Ifc3
140 : : {
141 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakAggImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
142 : : public:
143 : 876 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
144 : 876 : { return OWeakAggObject::queryInterface( rType ); }
145 : 2042 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
146 : 2042 : { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
147 : 6934 : virtual void SAL_CALL acquire() throw ()
148 : 6934 : { OWeakAggObject::acquire(); }
149 : 6848 : virtual void SAL_CALL release() throw ()
150 : 6848 : { OWeakAggObject::release(); }
151 : 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
152 : 0 : { return WeakAggImplHelper_getTypes( cd::get() ); }
153 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
154 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
155 : : };
156 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
157 : : com::sun::star::uno::XInterface inherting from a BaseClass.
158 : : All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
159 : : if a demanded interface is not supported by this class directly, the request is
160 : : delegated to the BaseClass.
161 : :
162 : : @attention
163 : : The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface
164 : : and com::sun::star::lang::XTypeProvider are implemented properly. The
165 : : BaseClass must have at least one ctor that can be called with six or
166 : : fewer arguments, of which none is of non-const reference type.
167 : : also has to have a default ctor.
168 : :
169 : : @derive
170 : : Inherit from this class giving your additional interface(s) to be implemented as
171 : : template argument(s). Your sub class defines method implementations for these interface(s).
172 : : */
173 : : template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
174 [ - + ]: 614 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper3
175 : : : public BaseClass
176 : : , public Ifc1, public Ifc2, public Ifc3
177 : : {
178 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
179 : : protected:
180 : : template< typename T1 >
181 : : explicit ImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {}
182 : : template< typename T1, typename T2 >
183 : : ImplInheritanceHelper3(T1 const & arg1, T2 const & arg2):
184 : : BaseClass(arg1, arg2) {}
185 : : template< typename T1, typename T2, typename T3 >
186 : : ImplInheritanceHelper3(
187 : : T1 const & arg1, T2 const & arg2, T3 const & arg3):
188 : : BaseClass(arg1, arg2, arg3) {}
189 : : template< typename T1, typename T2, typename T3, typename T4 >
190 : : ImplInheritanceHelper3(
191 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
192 : : BaseClass(arg1, arg2, arg3, arg4) {}
193 : : template<
194 : : typename T1, typename T2, typename T3, typename T4, typename T5 >
195 : : ImplInheritanceHelper3(
196 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
197 : : T5 const & arg5):
198 : : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
199 : : template<
200 : : typename T1, typename T2, typename T3, typename T4, typename T5,
201 : : typename T6 >
202 : : ImplInheritanceHelper3(
203 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
204 : : T5 const & arg5, T6 const & arg6):
205 : : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
206 : : public:
207 : 622 : ImplInheritanceHelper3() {}
208 : 7657 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
209 : : {
210 [ + - ][ + - ]: 7657 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
211 [ + + ]: 7657 : if (aRet.hasValue())
212 : 463 : return aRet;
213 [ + - ]: 7657 : return BaseClass::queryInterface( rType );
214 : : }
215 : 95795 : virtual void SAL_CALL acquire() throw ()
216 : 95795 : { BaseClass::acquire(); }
217 : 95755 : virtual void SAL_CALL release() throw ()
218 : 95755 : { BaseClass::release(); }
219 : 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
220 [ # # ][ # # ]: 0 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
221 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
222 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
223 : : };
224 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
225 : : com::sun::star::uno::XInterface inherting from a BaseClass.
226 : : All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
227 : : Upon queryAggregation(), if a demanded interface is not supported by this class directly,
228 : : the request is delegated to the BaseClass.
229 : :
230 : : @attention
231 : : The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface,
232 : : com::sun::star::uno::XAggregation and com::sun::star::lang::XTypeProvider
233 : : are implemented properly. The BaseClass must have at least one ctor
234 : : that can be called with six or fewer arguments, of which none is of
235 : : non-const reference type.
236 : :
237 : : @derive
238 : : Inherit from this class giving your additional interface(s) to be implemented as
239 : : template argument(s). Your sub class defines method implementations for these interface(s).
240 : : */
241 : : template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
242 [ - + ]: 48 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper3
243 : : : public BaseClass
244 : : , public Ifc1, public Ifc2, public Ifc3
245 : : {
246 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, AggImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
247 : : protected:
248 : : template< typename T1 >
249 : 56 : explicit AggImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {}
250 : : template< typename T1, typename T2 >
251 : : AggImplInheritanceHelper3(T1 const & arg1, T2 const & arg2):
252 : : BaseClass(arg1, arg2) {}
253 : : template< typename T1, typename T2, typename T3 >
254 : : AggImplInheritanceHelper3(
255 : : T1 const & arg1, T2 const & arg2, T3 const & arg3):
256 : : BaseClass(arg1, arg2, arg3) {}
257 : : template< typename T1, typename T2, typename T3, typename T4 >
258 : : AggImplInheritanceHelper3(
259 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
260 : : BaseClass(arg1, arg2, arg3, arg4) {}
261 : : template<
262 : : typename T1, typename T2, typename T3, typename T4, typename T5 >
263 : : AggImplInheritanceHelper3(
264 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
265 : : T5 const & arg5):
266 : : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
267 : : template<
268 : : typename T1, typename T2, typename T3, typename T4, typename T5,
269 : : typename T6 >
270 : : AggImplInheritanceHelper3(
271 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
272 : : T5 const & arg5, T6 const & arg6):
273 : : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
274 : : public:
275 : : AggImplInheritanceHelper3() {}
276 : 418 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
277 : 418 : { return BaseClass::queryInterface( rType ); }
278 : 446 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
279 : : {
280 [ + - ][ + - ]: 446 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
281 [ + + ]: 446 : if (aRet.hasValue())
282 : 102 : return aRet;
283 [ + - ]: 446 : return BaseClass::queryAggregation( rType );
284 : : }
285 : 11747 : virtual void SAL_CALL acquire() throw ()
286 : 11747 : { BaseClass::acquire(); }
287 : 11691 : virtual void SAL_CALL release() throw ()
288 : 11691 : { BaseClass::release(); }
289 : 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
290 [ # # ][ # # ]: 0 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
291 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
292 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
293 : : };
294 : : }
295 : :
296 : : #endif
297 : :
298 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|