19 #ifndef INCLUDED_CPPUHELPER_IMPLBASE_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE_HXX
27 #include <com/sun/star/lang/XTypeProvider.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
62 sal_Int32 nType2Offset;
89 ClassDataBase( sal_Int32 nClassCode )
SAL_THROW(());
92 ~ClassDataBase() SAL_THROW(());
104 Type_Offset arType2Offset[1];
108 void SAL_CALL initTypeProvider() SAL_THROW(());
114 void SAL_CALL writeTypeOffset( const ::
com::sun::star::uno::Type & rType, sal_Int32 nOffset )
123 ::
com::sun::star::uno::Any SAL_CALL query(
124 const ::
com::sun::star::uno::Type & rType, ::
com::sun::star::lang::XTypeProvider * pBase )
130 ::
com::sun::star::uno::Sequence< ::
com::sun::star::uno::Type > SAL_CALL getTypes()
136 ::
com::sun::star::uno::Sequence<
sal_Int8 > SAL_CALL getImplementationId()
152 #if defined _MSC_VER // public -> protected changes mangled names there
153 #define CPPUHELPER_DETAIL_IMPLHELPER_PROTECTED public
155 #define CPPUHELPER_DETAIL_IMPLHELPER_PROTECTED protected
171 #define __DEF_IMPLHELPER_PRE( N ) \
174 struct ClassData##N : public ClassDataBase \
176 Type_Offset arType2Offset[ N ]; \
177 ClassData##N( sal_Int32 nInClassCode ) SAL_THROW(()) \
178 : ClassDataBase( nInClassCode ) \
181 template< __CLASS_IFC##N > \
182 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelperBase##N \
183 : public ::com::sun::star::lang::XTypeProvider \
186 CPPUHELPER_DETAIL_IMPLHELPER_PROTECTED: \
187 ~ImplHelperBase##N() throw () {} \
189 ClassData & SAL_CALL getClassData( ClassDataBase & s_aCD ) SAL_THROW(()) \
191 ClassData & rCD = * static_cast< ClassData * >( &s_aCD ); \
192 if (! rCD.bOffsetsInit) \
194 ::osl::MutexGuard aGuard( getImplHelperInitMutex() ); \
195 if (! rCD.bOffsetsInit) \
197 char * pBase = (char *)this;
200 #define __IFC_WRITEOFFSET( N ) \
201 rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< Ifc##N > *)0 ), \
202 (char *)(Ifc##N *)this - pBase );
205 #define __DEF_IMPLHELPER_POST_A( N ) \
206 rCD.bOffsetsInit = sal_True; \
212 template< __CLASS_IFC##N > \
213 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper##N \
214 : public ImplHelperBase##N< __IFC##N > \
216 static ClassData##N s_aCD; \
218 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) \
219 { return this->getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ); } \
220 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
221 { return this->getClassData( s_aCD ).getTypes(); } \
222 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
223 { return this->getClassData( s_aCD ).getImplementationId(); } \
224 CPPUHELPER_DETAIL_IMPLHELPER_PROTECTED: \
225 ~ImplHelper##N() throw () {} \
227 template< __CLASS_IFC##N > \
228 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper##N \
229 : public ::cppu::OWeakObject \
230 , public ImplHelperBase##N< __IFC##N > \
232 static ClassData##N s_aCD; \
234 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) \
236 ::com::sun::star::uno::Any aRet( this->getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
237 return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); \
239 virtual void SAL_CALL acquire() throw () \
240 { OWeakObject::acquire(); } \
241 virtual void SAL_CALL release() throw () \
242 { OWeakObject::release(); } \
243 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
244 { return this->getClassData( s_aCD ).getTypes(); } \
245 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
246 { return this->getClassData( s_aCD ).getImplementationId(); } \
248 template< __CLASS_IFC##N > \
249 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper##N \
250 : public ::cppu::OWeakAggObject \
251 , public ImplHelperBase##N< __IFC##N > \
253 static ClassData##N s_aCD; \
255 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) \
256 { return OWeakAggObject::queryInterface( rType ); } \
257 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) \
259 ::com::sun::star::uno::Any aRet( this->getClassData( s_aCD ).query( rType, (ImplHelperBase##N< __IFC##N > *)this ) ); \
260 return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType )); \
262 virtual void SAL_CALL acquire() throw () \
263 { OWeakAggObject::acquire(); } \
264 virtual void SAL_CALL release() throw () \
265 { OWeakAggObject::release(); } \
266 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
267 { return this->getClassData( s_aCD ).getTypes(); } \
268 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
269 { return this->getClassData( s_aCD ).getImplementationId(); } \
274 #define __DEF_IMPLHELPER_POST_B( N ) \
275 template< __CLASS_IFC##N > \
276 ClassData##N ImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 0 ); \
277 template< __CLASS_IFC##N > \
278 ClassData##N WeakImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 1 ); \
279 template< __CLASS_IFC##N > \
280 ClassData##N WeakAggImplHelper##N< __IFC##N >::s_aCD = ClassData##N( 2 );
283 #define __DEF_IMPLHELPER_POST_C( N ) \
288 #define __DEF_IMPLHELPER_POST( N ) \
289 __DEF_IMPLHELPER_POST_A( N ) \
290 __DEF_IMPLHELPER_POST_B( N ) \
291 __DEF_IMPLHELPER_POST_C( N )
unsigned char sal_Bool
Definition: types.h:46
signed char sal_Int8
Definition: types.h:51
Definition: conditn.hxx:30
Definition: Enterable.hxx:26
Type description of an interface.
Definition: typedescription.h:370
#define SAL_THROW(x)
Exception specification documentation.
Definition: types.h:361
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28