1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _CPPUHELPER_IMPLBASE6_HXX_
24 #define _CPPUHELPER_IMPLBASE6_HXX_
25 
26 #include <cppuhelper/implbase_ex.hxx>
27 #include <rtl/instance.hxx>
28 
29 namespace cppu
30 {
31     /** @internal */
32     struct class_data6
33     {
34         sal_Int16 m_nTypes;
35         sal_Bool m_storedTypeRefs;
36         sal_Bool m_storedId;
37         sal_Int8 m_id[ 16 ];
38         type_entry m_typeEntries[ 6 + 1 ];
39     };
40 
41     /** @internal */
42     template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Impl >
43         struct ImplClassData6
44     {
operator ()cppu::ImplClassData645         class_data* operator ()()
46         {
47             static class_data6 s_cd =
48             {
49                 6 +1, sal_False, sal_False,
50                 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
51                 {
52 					{ { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
53 					{ { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 },
54 					{ { Ifc3::static_type }, ((sal_IntPtr)(Ifc3 *) (Impl *) 16) - 16 },
55 					{ { Ifc4::static_type }, ((sal_IntPtr)(Ifc4 *) (Impl *) 16) - 16 },
56 					{ { Ifc5::static_type }, ((sal_IntPtr)(Ifc5 *) (Impl *) 16) - 16 },
57 					{ { Ifc6::static_type }, ((sal_IntPtr)(Ifc6 *) (Impl *) 16) - 16 },
58 					{ { ::com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(::com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
59                 }
60             };
61             return reinterpret_cast< class_data * >(&s_cd);
62         }
63     };
64 
65     /** Implementation helper implementing interface ::com::sun::star::lang::XTypeProvider
66         and method XInterface::queryInterface(), but no reference counting.
67 
68         @derive
69         Inherit from this class giving your interface(s) to be implemented as template argument(s).
70         Your sub class defines method implementations for these interface(s) including acquire()/
71         release() and delegates incoming queryInterface() calls to this base class.
72     */
73     template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
74     class SAL_NO_VTABLE ImplHelper6
75         : public ::com::sun::star::lang::XTypeProvider
76         , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
77     {
78         /** @internal */
79         struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, ImplHelper6<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
80     public:
queryInterface(::com::sun::star::uno::Type const & rType)81         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
82             { return ImplHelper_query( rType, cd::get(), this ); }
getTypes()83         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
84             { return ImplHelper_getTypes( cd::get() ); }
getImplementationId()85         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
86             { return ImplHelper_getImplementationId( cd::get() ); }
87     };
88     /** Implementation helper implementing interfaces ::com::sun::star::lang::XTypeProvider and
89         ::com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
90         (supporting ::com::sun::star::uno::XWeak thru ::cppu::OWeakObject).
91 
92         @derive
93         Inherit from this class giving your interface(s) to be implemented as template argument(s).
94         Your sub class defines method implementations for these interface(s).
95     */
96     template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
97     class SAL_NO_VTABLE WeakImplHelper6
98         : public OWeakObject
99         , public ::com::sun::star::lang::XTypeProvider
100         , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
101     {
102         /** @internal */
103         struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakImplHelper6<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
104     public:
queryInterface(::com::sun::star::uno::Type const & rType)105         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
106             { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
acquire()107         virtual void SAL_CALL acquire() throw ()
108             { OWeakObject::acquire(); }
release()109         virtual void SAL_CALL release() throw ()
110             { OWeakObject::release(); }
getTypes()111         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
112             { return WeakImplHelper_getTypes( cd::get() ); }
getImplementationId()113         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
114             { return ImplHelper_getImplementationId( cd::get() ); }
115     };
116     /** Implementation helper implementing interfaces ::com::sun::star::lang::XTypeProvider and
117         ::com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
118         (supporting ::com::sun::star::uno::XWeak thru ::cppu::OWeakAggObject).
119         In addition, it supports also aggregation meaning object of this class can be aggregated
120         (::com::sun::star::uno::XAggregation thru ::cppu::OWeakAggObject).
121         If a delegator is set (this object is aggregated), then incoming queryInterface()
122         calls are delegated to the delegator object. If the delegator does not support the
123         demanded interface, it calls queryAggregation() on its aggregated objects.
124 
125         @derive
126         Inherit from this class giving your interface(s) to be implemented as template argument(s).
127         Your sub class defines method implementations for these interface(s).
128     */
129     template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
130     class SAL_NO_VTABLE WeakAggImplHelper6
131         : public OWeakAggObject
132         , public ::com::sun::star::lang::XTypeProvider
133         , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
134     {
135         /** @internal */
136         struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakAggImplHelper6<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
137     public:
queryInterface(::com::sun::star::uno::Type const & rType)138         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
139             { return OWeakAggObject::queryInterface( rType ); }
queryAggregation(::com::sun::star::uno::Type const & rType)140         virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
141             { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
acquire()142         virtual void SAL_CALL acquire() throw ()
143             { OWeakAggObject::acquire(); }
release()144         virtual void SAL_CALL release() throw ()
145             { OWeakAggObject::release(); }
getTypes()146         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
147             { return WeakAggImplHelper_getTypes( cd::get() ); }
getImplementationId()148         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
149             { return ImplHelper_getImplementationId( cd::get() ); }
150     };
151     /** Implementation helper implementing interfaces ::com::sun::star::lang::XTypeProvider and
152         ::com::sun::star::uno::XInterface inherting from a BaseClass.
153         All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
154         if a demanded interface is not supported by this class directly, the request is
155         delegated to the BaseClass.
156 
157         @attention
158         The BaseClass has to be complete in a sense, that ::com::sun::star::uno::XInterface
159         and ::com::sun::star::lang::XTypeProvider are implemented properly.  The
160         BaseClass must have at least one ctor that can be called with six or
161         fewer arguments, of which none is of non-const reference type.
162 
163         @derive
164         Inherit from this class giving your additional interface(s) to be implemented as
165         template argument(s). Your sub class defines method implementations for these interface(s).
166     */
167     template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
168     class SAL_NO_VTABLE ImplInheritanceHelper6
169         : public BaseClass
170         , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
171     {
172         /** @internal */
173         struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, ImplInheritanceHelper6<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
174     protected:
175         template< typename T1 >
ImplInheritanceHelper6(T1 const & arg1)176         explicit ImplInheritanceHelper6(T1 const & arg1): BaseClass(arg1) {}
177         template< typename T1, typename T2 >
ImplInheritanceHelper6(T1 const & arg1,T2 const & arg2)178         ImplInheritanceHelper6(T1 const & arg1, T2 const & arg2):
179             BaseClass(arg1, arg2) {}
180         template< typename T1, typename T2, typename T3 >
ImplInheritanceHelper6(T1 const & arg1,T2 const & arg2,T3 const & arg3)181         ImplInheritanceHelper6(
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 >
ImplInheritanceHelper6(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4)185         ImplInheritanceHelper6(
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 >
ImplInheritanceHelper6(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5)190         ImplInheritanceHelper6(
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 >
ImplInheritanceHelper6(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5,T6 const & arg6)197         ImplInheritanceHelper6(
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:
ImplInheritanceHelper6()202         ImplInheritanceHelper6() {}
queryInterface(::com::sun::star::uno::Type const & rType)203         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
204             {
205                 ::com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
206                 if (aRet.hasValue())
207                     return aRet;
208                 return BaseClass::queryInterface( rType );
209             }
acquire()210         virtual void SAL_CALL acquire() throw ()
211             { BaseClass::acquire(); }
release()212         virtual void SAL_CALL release() throw ()
213             { BaseClass::release(); }
getTypes()214         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
215             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
getImplementationId()216         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
217             { 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 >
237     class SAL_NO_VTABLE AggImplInheritanceHelper6
238         : public BaseClass
239         , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
240     {
241         /** @internal */
242         struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, AggImplInheritanceHelper6<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6> > > {};
243     protected:
244         template< typename T1 >
AggImplInheritanceHelper6(T1 const & arg1)245         explicit AggImplInheritanceHelper6(T1 const & arg1): BaseClass(arg1) {}
246         template< typename T1, typename T2 >
AggImplInheritanceHelper6(T1 const & arg1,T2 const & arg2)247         AggImplInheritanceHelper6(T1 const & arg1, T2 const & arg2):
248             BaseClass(arg1, arg2) {}
249         template< typename T1, typename T2, typename T3 >
AggImplInheritanceHelper6(T1 const & arg1,T2 const & arg2,T3 const & arg3)250         AggImplInheritanceHelper6(
251             T1 const & arg1, T2 const & arg2, T3 const & arg3):
252             BaseClass(arg1, arg2, arg3) {}
253         template< typename T1, typename T2, typename T3, typename T4 >
AggImplInheritanceHelper6(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4)254         AggImplInheritanceHelper6(
255             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
256             BaseClass(arg1, arg2, arg3, arg4) {}
257         template<
258             typename T1, typename T2, typename T3, typename T4, typename T5 >
AggImplInheritanceHelper6(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5)259         AggImplInheritanceHelper6(
260             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
261             T5 const & arg5):
262             BaseClass(arg1, arg2, arg3, arg4, arg5) {}
263         template<
264             typename T1, typename T2, typename T3, typename T4, typename T5,
265             typename T6 >
AggImplInheritanceHelper6(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5,T6 const & arg6)266         AggImplInheritanceHelper6(
267             T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
268             T5 const & arg5, T6 const & arg6):
269             BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
270     public:
AggImplInheritanceHelper6()271         AggImplInheritanceHelper6() {}
queryInterface(::com::sun::star::uno::Type const & rType)272         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
273             { return BaseClass::queryInterface( rType ); }
queryAggregation(::com::sun::star::uno::Type const & rType)274         virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException)
275             {
276                 ::com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
277                 if (aRet.hasValue())
278                     return aRet;
279                 return BaseClass::queryAggregation( rType );
280             }
acquire()281         virtual void SAL_CALL acquire() throw ()
282             { BaseClass::acquire(); }
release()283         virtual void SAL_CALL release() throw ()
284             { BaseClass::release(); }
getTypes()285         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
286             { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
getImplementationId()287         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
288             { return ImplHelper_getImplementationId( cd::get() ); }
289     };
290 }
291 
292 #endif
293