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