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_IMPLBASE11_HXX_ 24 #define _CPPUHELPER_IMPLBASE11_HXX_ 25 26 #include <cppuhelper/implbase_ex.hxx> 27 #include <rtl/instance.hxx> 28 29 namespace cppu 30 { 31 /** @internal */ 32 struct class_data11 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[ 11 + 1 ]; 39 }; 40 41 /** @internal */ 42 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 > 43 struct ImplClassData11 44 { operator ()cppu::ImplClassData1145 class_data* operator ()() 46 { 47 static class_data11 s_cd = 48 { 49 11 +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 { { Ifc7::static_type }, ((sal_IntPtr)(Ifc7 *) (Impl *) 16) - 16 }, 59 { { Ifc8::static_type }, ((sal_IntPtr)(Ifc8 *) (Impl *) 16) - 16 }, 60 { { Ifc9::static_type }, ((sal_IntPtr)(Ifc9 *) (Impl *) 16) - 16 }, 61 { { Ifc10::static_type }, ((sal_IntPtr)(Ifc10 *) (Impl *) 16) - 16 }, 62 { { Ifc11::static_type }, ((sal_IntPtr)(Ifc11 *) (Impl *) 16) - 16 }, 63 { { ::com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(::com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 } 64 } 65 }; 66 return reinterpret_cast< class_data * >(&s_cd); 67 } 68 }; 69 70 /** Implementation helper implementing interface ::com::sun::star::lang::XTypeProvider 71 and method XInterface::queryInterface(), but no reference counting. 72 73 @derive 74 Inherit from this class giving your interface(s) to be implemented as template argument(s). 75 Your sub class defines method implementations for these interface(s) including acquire()/ 76 release() and delegates incoming queryInterface() calls to this base class. 77 */ 78 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > 79 class SAL_NO_VTABLE ImplHelper11 80 : public ::com::sun::star::lang::XTypeProvider 81 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 82 { 83 /** @internal */ 84 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> > > {}; 85 public: queryInterface(::com::sun::star::uno::Type const & rType)86 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 87 { return ImplHelper_query( rType, cd::get(), this ); } getTypes()88 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 89 { return ImplHelper_getTypes( cd::get() ); } getImplementationId()90 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 91 { return ImplHelper_getImplementationId( cd::get() ); } 92 }; 93 /** Implementation helper implementing interfaces ::com::sun::star::lang::XTypeProvider and 94 ::com::sun::star::uno::XInterface which supports weak mechanism to be held weakly 95 (supporting ::com::sun::star::uno::XWeak thru ::cppu::OWeakObject). 96 97 @derive 98 Inherit from this class giving your interface(s) to be implemented as template argument(s). 99 Your sub class defines method implementations for these interface(s). 100 */ 101 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > 102 class SAL_NO_VTABLE WeakImplHelper11 103 : public OWeakObject 104 , public ::com::sun::star::lang::XTypeProvider 105 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 106 { 107 /** @internal */ 108 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> > > {}; 109 public: queryInterface(::com::sun::star::uno::Type const & rType)110 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 111 { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); } acquire()112 virtual void SAL_CALL acquire() throw () 113 { OWeakObject::acquire(); } release()114 virtual void SAL_CALL release() throw () 115 { OWeakObject::release(); } getTypes()116 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 117 { return WeakImplHelper_getTypes( cd::get() ); } getImplementationId()118 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 119 { return ImplHelper_getImplementationId( cd::get() ); } 120 }; 121 /** Implementation helper implementing interfaces ::com::sun::star::lang::XTypeProvider and 122 ::com::sun::star::uno::XInterface which supports weak mechanism to be held weakly 123 (supporting ::com::sun::star::uno::XWeak thru ::cppu::OWeakAggObject). 124 In addition, it supports also aggregation meaning object of this class can be aggregated 125 (::com::sun::star::uno::XAggregation thru ::cppu::OWeakAggObject). 126 If a delegator is set (this object is aggregated), then incoming queryInterface() 127 calls are delegated to the delegator object. If the delegator does not support the 128 demanded interface, it calls queryAggregation() on its aggregated objects. 129 130 @derive 131 Inherit from this class giving your interface(s) to be implemented as template argument(s). 132 Your sub class defines method implementations for these interface(s). 133 */ 134 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > 135 class SAL_NO_VTABLE WeakAggImplHelper11 136 : public OWeakAggObject 137 , public ::com::sun::star::lang::XTypeProvider 138 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 139 { 140 /** @internal */ 141 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> > > {}; 142 public: queryInterface(::com::sun::star::uno::Type const & rType)143 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 144 { return OWeakAggObject::queryInterface( rType ); } queryAggregation(::com::sun::star::uno::Type const & rType)145 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 146 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); } acquire()147 virtual void SAL_CALL acquire() throw () 148 { OWeakAggObject::acquire(); } release()149 virtual void SAL_CALL release() throw () 150 { OWeakAggObject::release(); } getTypes()151 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 152 { return WeakAggImplHelper_getTypes( cd::get() ); } getImplementationId()153 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 154 { 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 168 @derive 169 Inherit from this class giving your additional interface(s) to be implemented as 170 template argument(s). Your sub class defines method implementations for these interface(s). 171 */ 172 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 > 173 class SAL_NO_VTABLE ImplInheritanceHelper11 174 : public BaseClass 175 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 176 { 177 /** @internal */ 178 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> > > {}; 179 protected: 180 template< typename T1 > ImplInheritanceHelper11(T1 const & arg1)181 explicit ImplInheritanceHelper11(T1 const & arg1): BaseClass(arg1) {} 182 template< typename T1, typename T2 > ImplInheritanceHelper11(T1 const & arg1,T2 const & arg2)183 ImplInheritanceHelper11(T1 const & arg1, T2 const & arg2): 184 BaseClass(arg1, arg2) {} 185 template< typename T1, typename T2, typename T3 > ImplInheritanceHelper11(T1 const & arg1,T2 const & arg2,T3 const & arg3)186 ImplInheritanceHelper11( 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 > ImplInheritanceHelper11(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4)190 ImplInheritanceHelper11( 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 > ImplInheritanceHelper11(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5)195 ImplInheritanceHelper11( 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 > ImplInheritanceHelper11(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5,T6 const & arg6)202 ImplInheritanceHelper11( 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: ImplInheritanceHelper11()207 ImplInheritanceHelper11() {} queryInterface(::com::sun::star::uno::Type const & rType)208 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 209 { 210 ::com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); 211 if (aRet.hasValue()) 212 return aRet; 213 return BaseClass::queryInterface( rType ); 214 } acquire()215 virtual void SAL_CALL acquire() throw () 216 { BaseClass::acquire(); } release()217 virtual void SAL_CALL release() throw () 218 { BaseClass::release(); } getTypes()219 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 220 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } getImplementationId()221 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 222 { 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, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > 242 class SAL_NO_VTABLE AggImplInheritanceHelper11 243 : public BaseClass 244 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 245 { 246 /** @internal */ 247 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> > > {}; 248 protected: 249 template< typename T1 > AggImplInheritanceHelper11(T1 const & arg1)250 explicit AggImplInheritanceHelper11(T1 const & arg1): BaseClass(arg1) {} 251 template< typename T1, typename T2 > AggImplInheritanceHelper11(T1 const & arg1,T2 const & arg2)252 AggImplInheritanceHelper11(T1 const & arg1, T2 const & arg2): 253 BaseClass(arg1, arg2) {} 254 template< typename T1, typename T2, typename T3 > AggImplInheritanceHelper11(T1 const & arg1,T2 const & arg2,T3 const & arg3)255 AggImplInheritanceHelper11( 256 T1 const & arg1, T2 const & arg2, T3 const & arg3): 257 BaseClass(arg1, arg2, arg3) {} 258 template< typename T1, typename T2, typename T3, typename T4 > AggImplInheritanceHelper11(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4)259 AggImplInheritanceHelper11( 260 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): 261 BaseClass(arg1, arg2, arg3, arg4) {} 262 template< 263 typename T1, typename T2, typename T3, typename T4, typename T5 > AggImplInheritanceHelper11(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5)264 AggImplInheritanceHelper11( 265 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 266 T5 const & arg5): 267 BaseClass(arg1, arg2, arg3, arg4, arg5) {} 268 template< 269 typename T1, typename T2, typename T3, typename T4, typename T5, 270 typename T6 > AggImplInheritanceHelper11(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5,T6 const & arg6)271 AggImplInheritanceHelper11( 272 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 273 T5 const & arg5, T6 const & arg6): 274 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} 275 public: AggImplInheritanceHelper11()276 AggImplInheritanceHelper11() {} queryInterface(::com::sun::star::uno::Type const & rType)277 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 278 { return BaseClass::queryInterface( rType ); } queryAggregation(::com::sun::star::uno::Type const & rType)279 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 280 { 281 ::com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); 282 if (aRet.hasValue()) 283 return aRet; 284 return BaseClass::queryAggregation( rType ); 285 } acquire()286 virtual void SAL_CALL acquire() throw () 287 { BaseClass::acquire(); } release()288 virtual void SAL_CALL release() throw () 289 { BaseClass::release(); } getTypes()290 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 291 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } getImplementationId()292 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 293 { return ImplHelper_getImplementationId( cd::get() ); } 294 }; 295 } 296 297 #endif 298