UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 #ifndef _CPPUHELPER_IMPLBASE1_HXX_ 00029 #define _CPPUHELPER_IMPLBASE1_HXX_ 00030 00031 #include <cppuhelper/implbase_ex.hxx> 00032 #include <rtl/instance.hxx> 00033 #include <com/sun/star/uno/XComponentContext.hpp> 00034 00035 namespace cppu 00036 { 00038 00039 struct class_data1 00040 { 00041 sal_Int16 m_nTypes; 00042 sal_Bool m_storedTypeRefs; 00043 sal_Bool m_storedId; 00044 sal_Int8 m_id[ 16 ]; 00045 type_entry m_typeEntries[ 1 + 1 ]; 00046 }; 00047 00048 template< typename Ifc1, typename Impl > struct ImplClassData1 00049 { 00050 class_data* operator ()() 00051 { 00052 static class_data1 s_cd = 00053 { 00054 1 +1, sal_False, sal_False, 00055 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 00056 { 00057 { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 }, 00058 { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 } 00059 } 00060 }; 00061 return reinterpret_cast< class_data * >(&s_cd); 00062 } 00063 }; 00064 00066 00075 template< class Ifc1 > 00076 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1 00077 : public com::sun::star::lang::XTypeProvider 00078 , public Ifc1 00079 { 00080 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1<Ifc1> > > {}; 00081 public: 00082 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00083 { return ImplHelper_query( rType, cd::get(), this ); } 00084 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00085 { return ImplHelper_getTypes( cd::get() ); } 00086 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00087 { return ImplHelper_getImplementationId( cd::get() ); } 00088 00089 #if !defined _MSC_VER // public -> protected changes mangled names there 00090 protected: 00091 #endif 00092 ~ImplHelper1() throw () {} 00093 }; 00106 template< class Ifc1 > 00107 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper1 00108 : public OWeakObject 00109 , public com::sun::star::lang::XTypeProvider 00110 , public Ifc1 00111 { 00112 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {}; 00113 public: 00114 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00115 { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); } 00116 virtual void SAL_CALL acquire() throw () 00117 { OWeakObject::acquire(); } 00118 virtual void SAL_CALL release() throw () 00119 { OWeakObject::release(); } 00120 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00121 { return WeakImplHelper_getTypes( cd::get() ); } 00122 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00123 { return ImplHelper_getImplementationId( cd::get() ); } 00124 }; 00138 template< class Ifc1 > 00139 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1 00140 : public OWeakAggObject 00141 , public com::sun::star::lang::XTypeProvider 00142 , public Ifc1 00143 { 00144 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {}; 00145 public: 00146 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00147 { return OWeakAggObject::queryInterface( rType ); } 00148 virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00149 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); } 00150 virtual void SAL_CALL acquire() throw () 00151 { OWeakAggObject::acquire(); } 00152 virtual void SAL_CALL release() throw () 00153 { OWeakAggObject::release(); } 00154 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00155 { return WeakAggImplHelper_getTypes( cd::get() ); } 00156 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00157 { return ImplHelper_getImplementationId( cd::get() ); } 00158 }; 00175 template< class BaseClass, class Ifc1 > 00176 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1 00177 : public BaseClass 00178 , public Ifc1 00179 { 00180 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {}; 00181 protected: 00182 #if (defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) 00183 // Hack, to get comphelper::service_decl to work for non-trivial impl classes 00184 ImplInheritanceHelper1( com::sun::star::uno::Sequence<com::sun::star::uno::Any> const& args, 00185 com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const& xContext ) : BaseClass(args,xContext) {} 00186 #endif 00187 template< typename T1 > 00188 explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {} 00189 template< typename T1, typename T2 > 00190 ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2): 00191 BaseClass(arg1, arg2) {} 00192 template< typename T1, typename T2, typename T3 > 00193 ImplInheritanceHelper1( 00194 T1 const & arg1, T2 const & arg2, T3 const & arg3): 00195 BaseClass(arg1, arg2, arg3) {} 00196 template< typename T1, typename T2, typename T3, typename T4 > 00197 ImplInheritanceHelper1( 00198 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): 00199 BaseClass(arg1, arg2, arg3, arg4) {} 00200 template< 00201 typename T1, typename T2, typename T3, typename T4, typename T5 > 00202 ImplInheritanceHelper1( 00203 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 00204 T5 const & arg5): 00205 BaseClass(arg1, arg2, arg3, arg4, arg5) {} 00206 template< 00207 typename T1, typename T2, typename T3, typename T4, typename T5, 00208 typename T6 > 00209 ImplInheritanceHelper1( 00210 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 00211 T5 const & arg5, T6 const & arg6): 00212 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} 00213 public: 00214 ImplInheritanceHelper1() {} 00215 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00216 { 00217 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); 00218 if (aRet.hasValue()) 00219 return aRet; 00220 return BaseClass::queryInterface( rType ); 00221 } 00222 virtual void SAL_CALL acquire() throw () 00223 { BaseClass::acquire(); } 00224 virtual void SAL_CALL release() throw () 00225 { BaseClass::release(); } 00226 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00227 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } 00228 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00229 { return ImplHelper_getImplementationId( cd::get() ); } 00230 }; 00248 template< class BaseClass, class Ifc1 > 00249 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1 00250 : public BaseClass 00251 , public Ifc1 00252 { 00253 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {}; 00254 protected: 00255 template< typename T1 > 00256 explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {} 00257 template< typename T1, typename T2 > 00258 AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2): 00259 BaseClass(arg1, arg2) {} 00260 template< typename T1, typename T2, typename T3 > 00261 AggImplInheritanceHelper1( 00262 T1 const & arg1, T2 const & arg2, T3 const & arg3): 00263 BaseClass(arg1, arg2, arg3) {} 00264 template< typename T1, typename T2, typename T3, typename T4 > 00265 AggImplInheritanceHelper1( 00266 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): 00267 BaseClass(arg1, arg2, arg3, arg4) {} 00268 template< 00269 typename T1, typename T2, typename T3, typename T4, typename T5 > 00270 AggImplInheritanceHelper1( 00271 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 00272 T5 const & arg5): 00273 BaseClass(arg1, arg2, arg3, arg4, arg5) {} 00274 template< 00275 typename T1, typename T2, typename T3, typename T4, typename T5, 00276 typename T6 > 00277 AggImplInheritanceHelper1( 00278 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, 00279 T5 const & arg5, T6 const & arg6): 00280 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} 00281 public: 00282 AggImplInheritanceHelper1() {} 00283 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00284 { return BaseClass::queryInterface( rType ); } 00285 virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) 00286 { 00287 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); 00288 if (aRet.hasValue()) 00289 return aRet; 00290 return BaseClass::queryAggregation( rType ); 00291 } 00292 virtual void SAL_CALL acquire() throw () 00293 { BaseClass::acquire(); } 00294 virtual void SAL_CALL release() throw () 00295 { BaseClass::release(); } 00296 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) 00297 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } 00298 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) 00299 { return ImplHelper_getImplementationId( cd::get() ); } 00300 }; 00301 } 00302 00303 #endif 00304 00305 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */