diff options
author | Andreas Schlüns <as@openoffice.org> | 2000-10-31 10:29:34 +0000 |
---|---|---|
committer | Andreas Schlüns <as@openoffice.org> | 2000-10-31 10:29:34 +0000 |
commit | 997dc30b30941ddeb56e83b72e68ec575e9a784e (patch) | |
tree | 9f8dfb7ad2a2f33071bbb8c814b56af88a65103c /framework | |
parent | af8cd235395a4056de6c23eefb8d60e641ab9e92 (diff) |
#79873# repair getTypes() mechanism for baseclass ...
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/macros/xtypeprovider.hxx | 267 |
1 files changed, 141 insertions, 126 deletions
diff --git a/framework/inc/macros/xtypeprovider.hxx b/framework/inc/macros/xtypeprovider.hxx index 1b13e59476b2..6b8050adebae 100644 --- a/framework/inc/macros/xtypeprovider.hxx +++ b/framework/inc/macros/xtypeprovider.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xtypeprovider.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:29:23 $ + * last change: $Author: as $ $Date: 2000-10-31 11:29:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -136,7 +136,7 @@ ________________________________________________________________________________ // private // implementation of XTypeProvider::getImplementationId() //***************************************************************************************************************** -#define PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CLASS::getImplementationId() throw( ::com::sun::star::uno::RuntimeException ) \ { \ /* Create one Id for all instances of this class. */ \ @@ -165,7 +165,7 @@ ________________________________________________________________________________ // private // implementation of XTypeProvider::getTypes() with max. 12 interfaces! //***************************************************************************************************************** -#define PRIVATE_DEFINE_XTYPEPROVIDER_TYPES( CLASS, TYPES ) \ +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES( CLASS, TYPES ) \ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ { \ /* Optimize this method ! */ \ @@ -181,7 +181,8 @@ ________________________________________________________________________________ /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ if ( pTypeCollection == NULL ) \ { \ - /* Create a static typecollection ... */ \ + /* Create a static typecollection ... */ \ + /* Attention: "TYPES" will expand to "(...)"! */ \ static ::cppu::OTypeCollection aTypeCollection TYPES ; \ /* ... and set his address to static pointer! */ \ pTypeCollection = &aTypeCollection ; \ @@ -194,7 +195,7 @@ ________________________________________________________________________________ // private // implementation of XTypeProvider::getTypes() with more then 12 interfaces! //***************************************************************************************************************** -#define PRIVATE_DEFINE_XTYPEPROVIDER_TYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) \ +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) \ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ { \ /* Optimize this method ! */ \ @@ -246,7 +247,7 @@ ________________________________________________________________________________ // private // implementation of XTypeProvider::getTypes() with using max. 12 interfaces + baseclass! //***************************************************************************************************************** -#define PRIVATE_DEFINE_XTYPEPROVIDER_TYPES_BASECLASS( CLASS, BASECLASS, TYPES ) \ +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_BASECLASS( CLASS, BASECLASS, TYPES ) \ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ { \ /* Optimize this method ! */ \ @@ -254,7 +255,7 @@ ________________________________________________________________________________ /* And we don't must use a mutex at every call! */ \ /* For the first call; pTypeCollection is NULL - */ \ /* for the second call pTypeCollection is different from NULL! */ \ - static ::cppu::OTypeCollection* pTypeCollection = NULL ; \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >* pTypeCollection = NULL ; \ if ( pTypeCollection == NULL ) \ { \ /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ @@ -262,27 +263,43 @@ ________________________________________________________________________________ /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ if ( pTypeCollection == NULL ) \ { \ - /* Create two static typecollections ... */ \ - static ::cppu::OTypeCollection aTypeCollection( TYPES, BASECLASS::getTypes() ); \ + /* Create static typecollection for my own interfaces! */ \ + static ::cppu::OTypeCollection aTypeCollection TYPES ; \ + /* Copy all items from my list sequences and from my baseclass */ \ + /* to one result list! */ \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes1 = aTypeCollection.getTypes(); \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes2 = BASECLASS::getTypes(); \ + sal_Int32 nCount1 = seqTypes1.getLength(); \ + sal_Int32 nCount2 = seqTypes2.getLength(); \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqResult ( nCount1+nCount2 ); \ + sal_Int32 nSource = 0; \ + sal_Int32 nDestination= 0; \ + while( nSource<nCount1 ) \ + { \ + seqResult[nDestination] = seqTypes1[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + nSource = 0; \ + while( nSource<nCount2 ) \ + { \ + seqResult[nDestination] = seqTypes2[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ /* ... and set his address to static pointer! */ \ - pTypeCollection = &aTypeCollection; \ + pTypeCollection = &seqResult; \ } \ } \ - return pTypeCollection->getTypes(); \ + return *pTypeCollection; \ } //***************************************************************************************************************** // private // help macros to replace TYPES in getTypes() [see before] //***************************************************************************************************************** -//#ifdef ENABLE_SERVICEDEBUG -//#define PRIVATE_DEFINE_TYPE_1( TYPE1 ) \ -// ::getCppuType(( const ::com::sun::star::uno::Reference< XSPECIALDEBUGINTERFACE >*)NULL ), \ -// ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE1 >*)NULL ) -//#else #define PRIVATE_DEFINE_TYPE_1( TYPE1 ) \ ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE1 >*)NULL ) -//#endif // #ifdef ENABLE_SERVICEDEBUG #define PRIVATE_DEFINE_TYPE_2( TYPE1, TYPE2 ) \ PRIVATE_DEFINE_TYPE_1( TYPE1 ), \ @@ -333,20 +350,20 @@ ________________________________________________________________________________ // complete implementation of XTypeProvider //***************************************************************************************************************** #define PRIVATE_DEFINE_XTYPEPROVIDER_PURE( CLASS ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_TYPES( CLASS, ::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >*)NULL ) ) + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES( CLASS, ::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >*)NULL ) ) #define PRIVATE_DEFINE_XTYPEPROVIDER( CLASS, TYPES ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_TYPES( CLASS, TYPES ) + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES( CLASS, TYPES ) #define PRIVATE_DEFINE_XTYPEPROVIDER_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_TYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) #define PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS( CLASS, BASECLASS, TYPES ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_TYPES_BASECLASS( CLASS, BASECLASS, TYPES ) + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_BASECLASS( CLASS, BASECLASS, TYPES ) //***************************************************************************************************************** // public @@ -483,125 +500,123 @@ ________________________________________________________________________________ // implementation of XTypeProvider with 11 additional interfaces for getTypes() #define DEFINE_XTYPEPROVIDER_11( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ - (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ - TYPE2 , \ - TYPE3 , \ - TYPE4 , \ - TYPE5 , \ - TYPE6 , \ - TYPE7 , \ - TYPE8 , \ - TYPE9 , \ - TYPE10 \ - )), \ - (PRIVATE_DEFINE_TYPE_1 ( TYPE11 \ - )) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_11 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 \ + )) \ ) // implementation of XTypeProvider with 12 additional interfaces for getTypes() #define DEFINE_XTYPEPROVIDER_12( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ - (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ - TYPE2 , \ - TYPE3 , \ - TYPE4 , \ - TYPE5 , \ - TYPE6 , \ - TYPE7 , \ - TYPE8 , \ - TYPE9 , \ - TYPE10 \ - )), \ - (PRIVATE_DEFINE_TYPE_2 ( TYPE11 , \ - TYPE12 \ - )) \ - ) + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )) \ + ) // implementation of XTypeProvider with 13 additional interfaces for getTypes() #define DEFINE_XTYPEPROVIDER_13( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ - (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ - TYPE2 , \ - TYPE3 , \ - TYPE4 , \ - TYPE5 , \ - TYPE6 , \ - TYPE7 , \ - TYPE8 , \ - TYPE9 , \ - TYPE10 \ - )), \ - (PRIVATE_DEFINE_TYPE_3 ( TYPE11 , \ - TYPE12 , \ - TYPE13 \ - )) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE13 \ + )) \ ) // implementation of XTypeProvider with 14 additional interfaces for getTypes() #define DEFINE_XTYPEPROVIDER_14( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14 ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ - (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ - TYPE2 , \ - TYPE3 , \ - TYPE4 , \ - TYPE5 , \ - TYPE6 , \ - TYPE7 , \ - TYPE8 , \ - TYPE9 , \ - TYPE10 \ - )), \ - (PRIVATE_DEFINE_TYPE_4 ( TYPE11 , \ - TYPE12 , \ - TYPE13 , \ - TYPE14 \ - )) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE13 , \ + TYPE14 \ + )) \ ) // implementation of XTypeProvider with 15 additional interfaces for getTypes() #define DEFINE_XTYPEPROVIDER_15( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15 ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ - (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ - TYPE2 , \ - TYPE3 , \ - TYPE4 , \ - TYPE5 , \ - TYPE6 , \ - TYPE7 , \ - TYPE8 , \ - TYPE9 , \ - TYPE10 \ - )), \ - (PRIVATE_DEFINE_TYPE_5 ( TYPE11 , \ - TYPE12 , \ - TYPE13 , \ - TYPE14 , \ - TYPE15 \ - )) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE13 , \ + TYPE14 , \ + TYPE15 \ + )) \ ) // implementation of XTypeProvider with 16 additional interfaces for getTypes() #define DEFINE_XTYPEPROVIDER_16( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16 ) \ - PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ - (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ - TYPE2 , \ - TYPE3 , \ - TYPE4 , \ - TYPE5 , \ - TYPE6 , \ - TYPE7 , \ - TYPE8 , \ - TYPE9 , \ - TYPE10 \ - )), \ - (PRIVATE_DEFINE_TYPE_6 ( TYPE11 , \ - TYPE12 , \ - TYPE13 , \ - TYPE14 , \ - TYPE15 , \ - TYPE16 \ - )) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 \ + )) \ ) // implementation of XTypeProvider with 1 additional interface for getTypes() AND using 1 baseclass |