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