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