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_IMPLBASE12_HXX_ 24 #define _CPPUHELPER_IMPLBASE12_HXX_ 25 26 #include <cppuhelper/implbase_ex.hxx> 27 #include <rtl/instance.hxx> 28 29 namespace cppu 30 { 31 /** @internal */ 32 struct class_data12 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[ 12 + 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 Ifc12, typename Impl > 43 struct ImplClassData12 44 { operator ()cppu::ImplClassData1245 class_data* operator ()() 46 { 47 static class_data12 s_cd = 48 { 49 12 +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 { { Ifc12::static_type }, ((sal_IntPtr)(Ifc12 *) (Impl *) 16) - 16 }, 64 { { ::com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(::com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 } 65 } 66 }; 67 return reinterpret_cast< class_data * >(&s_cd); 68 } 69 }; 70 71 /** Implementation helper implementing interface ::com::sun::star::lang::XTypeProvider 72 and method XInterface::queryInterface(), but no reference counting. 73 74 @derive 75 Inherit from this class giving your interface(s) to be implemented as template argument(s). 76 Your sub class defines method implementations for these interface(s) including acquire()/ 77 release() and delegates incoming queryInterface() calls to this base class. 78 */ 79 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > 80 class SAL_NO_VTABLE ImplHelper12 81 : public ::com::sun::star::lang::XTypeProvider 82 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 83 { 84 /** @internal */ 85 struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, ImplHelper12<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {}; 86 public: queryInterface(::com::sun::star::uno::Type const & rType)87 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 88 { return ImplHelper_query( rType, cd::get(), this ); } getTypes()89 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 90 { return ImplHelper_getTypes( cd::get() ); } getImplementationId()91 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 92 { return ImplHelper_getImplementationId( cd::get() ); } 93 }; 94 /** Implementation helper implementing interfaces ::com::sun::star::lang::XTypeProvider and 95 ::com::sun::star::uno::XInterface which supports weak mechanism to be held weakly 96 (supporting ::com::sun::star::uno::XWeak thru ::cppu::OWeakObject). 97 98 @derive 99 Inherit from this class giving your interface(s) to be implemented as template argument(s). 100 Your sub class defines method implementations for these interface(s). 101 */ 102 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > 103 class SAL_NO_VTABLE WeakImplHelper12 104 : public OWeakObject 105 , public ::com::sun::star::lang::XTypeProvider 106 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 107 { 108 /** @internal */ 109 struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakImplHelper12<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {}; 110 public: queryInterface(::com::sun::star::uno::Type const & rType)111 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 112 { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); } acquire()113 virtual void SAL_CALL acquire() throw () 114 { OWeakObject::acquire(); } release()115 virtual void SAL_CALL release() throw () 116 { OWeakObject::release(); } getTypes()117 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 118 { return WeakImplHelper_getTypes( cd::get() ); } getImplementationId()119 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 120 { 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, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > 136 class SAL_NO_VTABLE WeakAggImplHelper12 137 : public OWeakAggObject 138 , public ::com::sun::star::lang::XTypeProvider 139 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 140 { 141 /** @internal */ 142 struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakAggImplHelper12<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {}; 143 public: queryInterface(::com::sun::star::uno::Type const & rType)144 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 145 { return OWeakAggObject::queryInterface( rType ); } queryAggregation(::com::sun::star::uno::Type const & rType)146 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 147 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); } acquire()148 virtual void SAL_CALL acquire() throw () 149 { OWeakAggObject::acquire(); } release()150 virtual void SAL_CALL release() throw () 151 { OWeakAggObject::release(); } getTypes()152 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 153 { return WeakAggImplHelper_getTypes( cd::get() ); } getImplementationId()154 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 155 { return ImplHelper_getImplementationId( cd::get() ); } 156 }; 157 /** Implementation helper implementing interfaces ::com::sun::star::lang::XTypeProvider and 158 ::com::sun::star::uno::XInterface inherting from a BaseClass. 159 All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), 160 if a demanded interface is not supported by this class directly, the request is 161 delegated to the BaseClass. 162 163 @attention 164 The BaseClass has to be complete in a sense, that ::com::sun::star::uno::XInterface 165 and ::com::sun::star::lang::XTypeProvider are implemented properly. The 166 BaseClass must have at least one ctor that can be called with six or 167 fewer arguments, of which none is of non-const reference type. 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, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > 174 class SAL_NO_VTABLE ImplInheritanceHelper12 175 : public BaseClass 176 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 177 { 178 /** @internal */ 179 struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, ImplInheritanceHelper12<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {}; 180 protected: 181 template< typename T1 > ImplInheritanceHelper12(T1 const & arg1)182 explicit ImplInheritanceHelper12(T1 const & arg1): BaseClass(arg1) {} 183 template< typename T1, typename T2 > ImplInheritanceHelper12(T1 const & arg1,T2 const & arg2)184 ImplInheritanceHelper12(T1 const & arg1, T2 const & arg2): 185 BaseClass(arg1, arg2) {} 186 template< typename T1, typename T2, typename T3 > ImplInheritanceHelper12(T1 const & arg1,T2 const & arg2,T3 const & arg3)187 ImplInheritanceHelper12( 188 T1 const & arg1, T2 const & arg2, T3 const & arg3): 189 BaseClass(arg1, arg2, arg3) {} 190 template< typename T1, typename T2, typename T3, typename T4 > ImplInheritanceHelper12(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4)191 ImplInheritanceHelper12( 192 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): 193 BaseClass(arg1, arg2, arg3, arg4) {} 194 template< 195 typename T1, typename T2, typename T3, typename T4, typename T5 > ImplInheritanceHelper12(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5)196 ImplInheritanceHelper12( 197 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 198 T5 const & arg5): 199 BaseClass(arg1, arg2, arg3, arg4, arg5) {} 200 template< 201 typename T1, typename T2, typename T3, typename T4, typename T5, 202 typename T6 > ImplInheritanceHelper12(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5,T6 const & arg6)203 ImplInheritanceHelper12( 204 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 205 T5 const & arg5, T6 const & arg6): 206 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} 207 public: ImplInheritanceHelper12()208 ImplInheritanceHelper12() {} queryInterface(::com::sun::star::uno::Type const & rType)209 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 210 { 211 ::com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); 212 if (aRet.hasValue()) 213 return aRet; 214 return BaseClass::queryInterface( rType ); 215 } acquire()216 virtual void SAL_CALL acquire() throw () 217 { BaseClass::acquire(); } release()218 virtual void SAL_CALL release() throw () 219 { BaseClass::release(); } getTypes()220 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 221 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } getImplementationId()222 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 223 { return ImplHelper_getImplementationId( cd::get() ); } 224 }; 225 /** Implementation helper implementing interfaces ::com::sun::star::lang::XTypeProvider and 226 ::com::sun::star::uno::XInterface inherting from a BaseClass. 227 All acquire(), release() and queryInterface() calls are delegated to the BaseClass. 228 Upon queryAggregation(), if a demanded interface is not supported by this class directly, 229 the request is delegated to the BaseClass. 230 231 @attention 232 The BaseClass has to be complete in a sense, that ::com::sun::star::uno::XInterface, 233 ::com::sun::star::uno::XAggregation and ::com::sun::star::lang::XTypeProvider 234 are implemented properly. The BaseClass must have at least one ctor 235 that can be called with six or fewer arguments, of which none is of 236 non-const reference type. 237 238 @derive 239 Inherit from this class giving your additional interface(s) to be implemented as 240 template argument(s). Your sub class defines method implementations for these interface(s). 241 */ 242 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, class Ifc12 > 243 class SAL_NO_VTABLE AggImplInheritanceHelper12 244 : public BaseClass 245 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 246 { 247 /** @internal */ 248 struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, AggImplInheritanceHelper12<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12> > > {}; 249 protected: 250 template< typename T1 > AggImplInheritanceHelper12(T1 const & arg1)251 explicit AggImplInheritanceHelper12(T1 const & arg1): BaseClass(arg1) {} 252 template< typename T1, typename T2 > AggImplInheritanceHelper12(T1 const & arg1,T2 const & arg2)253 AggImplInheritanceHelper12(T1 const & arg1, T2 const & arg2): 254 BaseClass(arg1, arg2) {} 255 template< typename T1, typename T2, typename T3 > AggImplInheritanceHelper12(T1 const & arg1,T2 const & arg2,T3 const & arg3)256 AggImplInheritanceHelper12( 257 T1 const & arg1, T2 const & arg2, T3 const & arg3): 258 BaseClass(arg1, arg2, arg3) {} 259 template< typename T1, typename T2, typename T3, typename T4 > AggImplInheritanceHelper12(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4)260 AggImplInheritanceHelper12( 261 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): 262 BaseClass(arg1, arg2, arg3, arg4) {} 263 template< 264 typename T1, typename T2, typename T3, typename T4, typename T5 > AggImplInheritanceHelper12(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5)265 AggImplInheritanceHelper12( 266 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 267 T5 const & arg5): 268 BaseClass(arg1, arg2, arg3, arg4, arg5) {} 269 template< 270 typename T1, typename T2, typename T3, typename T4, typename T5, 271 typename T6 > AggImplInheritanceHelper12(T1 const & arg1,T2 const & arg2,T3 const & arg3,T4 const & arg4,T5 const & arg5,T6 const & arg6)272 AggImplInheritanceHelper12( 273 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 274 T5 const & arg5, T6 const & arg6): 275 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} 276 public: AggImplInheritanceHelper12()277 AggImplInheritanceHelper12() {} queryInterface(::com::sun::star::uno::Type const & rType)278 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 279 { return BaseClass::queryInterface( rType ); } queryAggregation(::com::sun::star::uno::Type const & rType)280 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) 281 { 282 ::com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); 283 if (aRet.hasValue()) 284 return aRet; 285 return BaseClass::queryAggregation( rType ); 286 } acquire()287 virtual void SAL_CALL acquire() throw () 288 { BaseClass::acquire(); } release()289 virtual void SAL_CALL release() throw () 290 { BaseClass::release(); } getTypes()291 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) 292 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } getImplementationId()293 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) 294 { return ImplHelper_getImplementationId( cd::get() ); } 295 }; 296 } 297 298 #endif 299