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