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