1*b3b486c3SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*b3b486c3SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*b3b486c3SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*b3b486c3SAndrew Rist * distributed with this work for additional information 6*b3b486c3SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*b3b486c3SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*b3b486c3SAndrew Rist * "License"); you may not use this file except in compliance 9*b3b486c3SAndrew Rist * with the License. You may obtain a copy of the License at 10*b3b486c3SAndrew Rist * 11*b3b486c3SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*b3b486c3SAndrew Rist * 13*b3b486c3SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*b3b486c3SAndrew Rist * software distributed under the License is distributed on an 15*b3b486c3SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b3b486c3SAndrew Rist * KIND, either express or implied. See the License for the 17*b3b486c3SAndrew Rist * specific language governing permissions and limitations 18*b3b486c3SAndrew Rist * under the License. 19*b3b486c3SAndrew Rist * 20*b3b486c3SAndrew Rist *************************************************************/ 21*b3b486c3SAndrew Rist 22*b3b486c3SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _UCBHELPER_MACROS_HXX 25cdf0e10cSrcweir #define _UCBHELPER_MACROS_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <sal/types.h> 28cdf0e10cSrcweir #include <cppuhelper/queryinterface.hxx> 29cdf0e10cSrcweir #include <cppuhelper/factory.hxx> 30cdf0e10cSrcweir #include <cppuhelper/weakref.hxx> 31cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include "osl/mutex.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir //========================================================================= 36cdf0e10cSrcweir 37cdf0e10cSrcweir #define CPPU_TYPE( T ) getCppuType( static_cast< T * >( 0 ) ) 38cdf0e10cSrcweir #define CPPU_TYPE_REF( T ) CPPU_TYPE( com::sun::star::uno::Reference< T > ) 39cdf0e10cSrcweir 40cdf0e10cSrcweir //========================================================================= 41cdf0e10cSrcweir // 42cdf0e10cSrcweir // XInterface decl. 43cdf0e10cSrcweir // 44cdf0e10cSrcweir //========================================================================= 45cdf0e10cSrcweir 46cdf0e10cSrcweir #define XINTERFACE_DECL() \ 47cdf0e10cSrcweir virtual com::sun::star::uno::Any SAL_CALL \ 48cdf0e10cSrcweir queryInterface( const com::sun::star::uno::Type & rType ) \ 49cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); \ 50cdf0e10cSrcweir virtual void SAL_CALL \ 51cdf0e10cSrcweir acquire() \ 52cdf0e10cSrcweir throw(); \ 53cdf0e10cSrcweir virtual void SAL_CALL \ 54cdf0e10cSrcweir release() \ 55cdf0e10cSrcweir throw(); 56cdf0e10cSrcweir 57cdf0e10cSrcweir //========================================================================= 58cdf0e10cSrcweir // 59cdf0e10cSrcweir // XInterface impl. internals. 60cdf0e10cSrcweir // 61cdf0e10cSrcweir //========================================================================= 62cdf0e10cSrcweir 63cdf0e10cSrcweir #define XINTERFACE_COMMON_IMPL( Class ) \ 64cdf0e10cSrcweir void SAL_CALL Class::acquire() \ 65cdf0e10cSrcweir throw() \ 66cdf0e10cSrcweir { \ 67cdf0e10cSrcweir OWeakObject::acquire(); \ 68cdf0e10cSrcweir } \ 69cdf0e10cSrcweir \ 70cdf0e10cSrcweir void SAL_CALL Class::release() \ 71cdf0e10cSrcweir throw() \ 72cdf0e10cSrcweir { \ 73cdf0e10cSrcweir OWeakObject::release(); \ 74cdf0e10cSrcweir } 75cdf0e10cSrcweir 76cdf0e10cSrcweir #define QUERYINTERFACE_IMPL_START( Class ) \ 77cdf0e10cSrcweir com::sun::star::uno::Any SAL_CALL Class::queryInterface( \ 78cdf0e10cSrcweir const com::sun::star::uno::Type & rType ) \ 79cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ) \ 80cdf0e10cSrcweir { \ 81cdf0e10cSrcweir com::sun::star::uno::Any aRet = cppu::queryInterface( rType, 82cdf0e10cSrcweir 83cdf0e10cSrcweir #define QUERYINTERFACE_IMPL_END \ 84cdf0e10cSrcweir ); \ 85cdf0e10cSrcweir return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ); \ 86cdf0e10cSrcweir } 87cdf0e10cSrcweir 88cdf0e10cSrcweir //========================================================================= 89cdf0e10cSrcweir // 90cdf0e10cSrcweir // XInterface impl. 91cdf0e10cSrcweir // 92cdf0e10cSrcweir //========================================================================= 93cdf0e10cSrcweir 94cdf0e10cSrcweir // 1 interface implemented 95cdf0e10cSrcweir #define XINTERFACE_IMPL_1( Class, Ifc1 ) \ 96cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 97cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 98cdf0e10cSrcweir SAL_STATIC_CAST( Ifc1*, this ) \ 99cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 100cdf0e10cSrcweir 101cdf0e10cSrcweir // 2 interfaces implemented 102cdf0e10cSrcweir #define XINTERFACE_IMPL_2( Class, Ifc1, Ifc2 ) \ 103cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 104cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 105cdf0e10cSrcweir SAL_STATIC_CAST( Ifc1*, this ), \ 106cdf0e10cSrcweir SAL_STATIC_CAST( Ifc2*, this ) \ 107cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 108cdf0e10cSrcweir 109cdf0e10cSrcweir // 3 interfaces implemented 110cdf0e10cSrcweir #define XINTERFACE_IMPL_3( Class, Ifc1, Ifc2, Ifc3 ) \ 111cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 112cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 113cdf0e10cSrcweir SAL_STATIC_CAST( Ifc1*, this ), \ 114cdf0e10cSrcweir SAL_STATIC_CAST( Ifc2*, this ), \ 115cdf0e10cSrcweir SAL_STATIC_CAST( Ifc3*, this ) \ 116cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 117cdf0e10cSrcweir 118cdf0e10cSrcweir // 4 interfaces implemented 119cdf0e10cSrcweir #define XINTERFACE_IMPL_4( Class, Ifc1, Ifc2, Ifc3, Ifc4 ) \ 120cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 121cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 122cdf0e10cSrcweir SAL_STATIC_CAST( Ifc1*, this ), \ 123cdf0e10cSrcweir SAL_STATIC_CAST( Ifc2*, this ), \ 124cdf0e10cSrcweir SAL_STATIC_CAST( Ifc3*, this ), \ 125cdf0e10cSrcweir SAL_STATIC_CAST( Ifc4*, this ) \ 126cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 127cdf0e10cSrcweir 128cdf0e10cSrcweir // 5 interfaces implemented 129cdf0e10cSrcweir #define XINTERFACE_IMPL_5( Class, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5 ) \ 130cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 131cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 132cdf0e10cSrcweir SAL_STATIC_CAST( Ifc1*, this ), \ 133cdf0e10cSrcweir SAL_STATIC_CAST( Ifc2*, this ), \ 134cdf0e10cSrcweir SAL_STATIC_CAST( Ifc3*, this ), \ 135cdf0e10cSrcweir SAL_STATIC_CAST( Ifc4*, this ), \ 136cdf0e10cSrcweir SAL_STATIC_CAST( Ifc5*, this ) \ 137cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 138cdf0e10cSrcweir 139cdf0e10cSrcweir // 6 interfaces implemented 140cdf0e10cSrcweir #define XINTERFACE_IMPL_6( Class,I1,I2,I3,I4,I5,I6 ) \ 141cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 142cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 143cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 144cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 145cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 146cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 147cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 148cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ) \ 149cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 150cdf0e10cSrcweir 151cdf0e10cSrcweir // 7 interfaces implemented 152cdf0e10cSrcweir #define XINTERFACE_IMPL_7( Class,I1,I2,I3,I4,I5,I6,I7 ) \ 153cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 154cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 155cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 156cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 157cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 158cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 159cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 160cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ), \ 161cdf0e10cSrcweir SAL_STATIC_CAST( I7*, this ) \ 162cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 163cdf0e10cSrcweir 164cdf0e10cSrcweir // 8 interfaces implemented 165cdf0e10cSrcweir #define XINTERFACE_IMPL_8( Class,I1,I2,I3,I4,I5,I6,I7,I8 ) \ 166cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 167cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 168cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 169cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 170cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 171cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 172cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 173cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ), \ 174cdf0e10cSrcweir SAL_STATIC_CAST( I7*, this ), \ 175cdf0e10cSrcweir SAL_STATIC_CAST( I8*, this ) \ 176cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 177cdf0e10cSrcweir 178cdf0e10cSrcweir // 9 interfaces implemented 179cdf0e10cSrcweir #define XINTERFACE_IMPL_9( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \ 180cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 181cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 182cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 183cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 184cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 185cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 186cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 187cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ), \ 188cdf0e10cSrcweir SAL_STATIC_CAST( I7*, this ), \ 189cdf0e10cSrcweir SAL_STATIC_CAST( I8*, this ), \ 190cdf0e10cSrcweir SAL_STATIC_CAST( I9*, this ) \ 191cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 192cdf0e10cSrcweir 193cdf0e10cSrcweir // 10 interfaces implemented 194cdf0e10cSrcweir #define XINTERFACE_IMPL_10( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \ 195cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 196cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 197cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 198cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 199cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 200cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 201cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 202cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ), \ 203cdf0e10cSrcweir SAL_STATIC_CAST( I7*, this ), \ 204cdf0e10cSrcweir SAL_STATIC_CAST( I8*, this ), \ 205cdf0e10cSrcweir SAL_STATIC_CAST( I9*, this ), \ 206cdf0e10cSrcweir SAL_STATIC_CAST( I10*, this ) \ 207cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 208cdf0e10cSrcweir 209cdf0e10cSrcweir // 11 interfaces implemented 210cdf0e10cSrcweir #define XINTERFACE_IMPL_11( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \ 211cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 212cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 213cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 214cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 215cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 216cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 217cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 218cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ), \ 219cdf0e10cSrcweir SAL_STATIC_CAST( I7*, this ), \ 220cdf0e10cSrcweir SAL_STATIC_CAST( I8*, this ), \ 221cdf0e10cSrcweir SAL_STATIC_CAST( I9*, this ), \ 222cdf0e10cSrcweir SAL_STATIC_CAST( I10*, this ), \ 223cdf0e10cSrcweir SAL_STATIC_CAST( I11*, this ) \ 224cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 225cdf0e10cSrcweir 226cdf0e10cSrcweir // 12 interfaces implemented 227cdf0e10cSrcweir #define XINTERFACE_IMPL_12( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12 ) \ 228cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 229cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 230cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 231cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 232cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 233cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 234cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 235cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ), \ 236cdf0e10cSrcweir SAL_STATIC_CAST( I7*, this ), \ 237cdf0e10cSrcweir SAL_STATIC_CAST( I8*, this ), \ 238cdf0e10cSrcweir SAL_STATIC_CAST( I9*, this ), \ 239cdf0e10cSrcweir SAL_STATIC_CAST( I10*, this ), \ 240cdf0e10cSrcweir SAL_STATIC_CAST( I11*, this ), \ 241cdf0e10cSrcweir SAL_STATIC_CAST( I12*, this ) \ 242cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 243cdf0e10cSrcweir 244cdf0e10cSrcweir // 13 interfaces implemented 245cdf0e10cSrcweir #define XINTERFACE_IMPL_13( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13 ) \ 246cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 247cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 248cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 249cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 250cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 251cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 252cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 253cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ), \ 254cdf0e10cSrcweir SAL_STATIC_CAST( I7*, this ), \ 255cdf0e10cSrcweir SAL_STATIC_CAST( I8*, this ), \ 256cdf0e10cSrcweir SAL_STATIC_CAST( I9*, this ), \ 257cdf0e10cSrcweir SAL_STATIC_CAST( I10*, this ), \ 258cdf0e10cSrcweir SAL_STATIC_CAST( I11*, this ), \ 259cdf0e10cSrcweir SAL_STATIC_CAST( I12*, this ), \ 260cdf0e10cSrcweir SAL_STATIC_CAST( I13*, this ) \ 261cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 262cdf0e10cSrcweir 263cdf0e10cSrcweir // 14 interfaces implemented 264cdf0e10cSrcweir #define XINTERFACE_IMPL_14( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14 ) \ 265cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 266cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 267cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 268cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 269cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 270cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 271cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 272cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ), \ 273cdf0e10cSrcweir SAL_STATIC_CAST( I7*, this ), \ 274cdf0e10cSrcweir SAL_STATIC_CAST( I8*, this ), \ 275cdf0e10cSrcweir SAL_STATIC_CAST( I9*, this ), \ 276cdf0e10cSrcweir SAL_STATIC_CAST( I10*, this ), \ 277cdf0e10cSrcweir SAL_STATIC_CAST( I11*, this ), \ 278cdf0e10cSrcweir SAL_STATIC_CAST( I12*, this ), \ 279cdf0e10cSrcweir SAL_STATIC_CAST( I13*, this ), \ 280cdf0e10cSrcweir SAL_STATIC_CAST( I14*, this ) \ 281cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 282cdf0e10cSrcweir 283cdf0e10cSrcweir // 15 interfaces implemented 284cdf0e10cSrcweir #define XINTERFACE_IMPL_15( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15 ) \ 285cdf0e10cSrcweir XINTERFACE_COMMON_IMPL( Class ) \ 286cdf0e10cSrcweir QUERYINTERFACE_IMPL_START( Class ) \ 287cdf0e10cSrcweir SAL_STATIC_CAST( I1*, this ), \ 288cdf0e10cSrcweir SAL_STATIC_CAST( I2*, this ), \ 289cdf0e10cSrcweir SAL_STATIC_CAST( I3*, this ), \ 290cdf0e10cSrcweir SAL_STATIC_CAST( I4*, this ), \ 291cdf0e10cSrcweir SAL_STATIC_CAST( I5*, this ), \ 292cdf0e10cSrcweir SAL_STATIC_CAST( I6*, this ), \ 293cdf0e10cSrcweir SAL_STATIC_CAST( I7*, this ), \ 294cdf0e10cSrcweir SAL_STATIC_CAST( I8*, this ), \ 295cdf0e10cSrcweir SAL_STATIC_CAST( I9*, this ), \ 296cdf0e10cSrcweir SAL_STATIC_CAST( I10*, this ), \ 297cdf0e10cSrcweir SAL_STATIC_CAST( I11*, this ), \ 298cdf0e10cSrcweir SAL_STATIC_CAST( I12*, this ), \ 299cdf0e10cSrcweir SAL_STATIC_CAST( I13*, this ), \ 300cdf0e10cSrcweir SAL_STATIC_CAST( I14*, this ), \ 301cdf0e10cSrcweir SAL_STATIC_CAST( I15*, this ) \ 302cdf0e10cSrcweir QUERYINTERFACE_IMPL_END 303cdf0e10cSrcweir 304cdf0e10cSrcweir //========================================================================= 305cdf0e10cSrcweir // 306cdf0e10cSrcweir // XTypeProvider decl. 307cdf0e10cSrcweir // 308cdf0e10cSrcweir //========================================================================= 309cdf0e10cSrcweir 310cdf0e10cSrcweir #define XTYPEPROVIDER_DECL() \ 311cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL \ 312cdf0e10cSrcweir getImplementationId() \ 313cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); \ 314cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL \ 315cdf0e10cSrcweir getTypes() \ 316cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 317cdf0e10cSrcweir 318cdf0e10cSrcweir //========================================================================= 319cdf0e10cSrcweir // 320cdf0e10cSrcweir // XTypeProvider impl. internals 321cdf0e10cSrcweir // 322cdf0e10cSrcweir //========================================================================= 323cdf0e10cSrcweir 324cdf0e10cSrcweir #define XTYPEPROVIDER_COMMON_IMPL( Class ) \ 325cdf0e10cSrcweir com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL \ 326cdf0e10cSrcweir Class::getImplementationId() \ 327cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ) \ 328cdf0e10cSrcweir { \ 329cdf0e10cSrcweir static cppu::OImplementationId* pId = NULL; \ 330cdf0e10cSrcweir if ( !pId ) \ 331cdf0e10cSrcweir { \ 332cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); \ 333cdf0e10cSrcweir if ( !pId ) \ 334cdf0e10cSrcweir { \ 335cdf0e10cSrcweir static cppu::OImplementationId id( sal_False ); \ 336cdf0e10cSrcweir pId = &id; \ 337cdf0e10cSrcweir } \ 338cdf0e10cSrcweir } \ 339cdf0e10cSrcweir return (*pId).getImplementationId(); \ 340cdf0e10cSrcweir } 341cdf0e10cSrcweir 342cdf0e10cSrcweir #define GETTYPES_IMPL_START( Class ) \ 343cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL \ 344cdf0e10cSrcweir Class::getTypes() \ 345cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ) \ 346cdf0e10cSrcweir { \ 347cdf0e10cSrcweir static cppu::OTypeCollection* pCollection = NULL; \ 348cdf0e10cSrcweir if ( !pCollection ) \ 349cdf0e10cSrcweir { \ 350cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); \ 351cdf0e10cSrcweir if ( !pCollection ) \ 352cdf0e10cSrcweir { \ 353cdf0e10cSrcweir static cppu::OTypeCollection collection( 354cdf0e10cSrcweir 355cdf0e10cSrcweir #define GETTYPES_IMPL_END \ 356cdf0e10cSrcweir ); \ 357cdf0e10cSrcweir pCollection = &collection; \ 358cdf0e10cSrcweir } \ 359cdf0e10cSrcweir } \ 360cdf0e10cSrcweir return (*pCollection).getTypes(); \ 361cdf0e10cSrcweir } 362cdf0e10cSrcweir 363cdf0e10cSrcweir //========================================================================= 364cdf0e10cSrcweir // 365cdf0e10cSrcweir // XTypeProvider impl. 366cdf0e10cSrcweir // 367cdf0e10cSrcweir //========================================================================= 368cdf0e10cSrcweir 369cdf0e10cSrcweir // 1 interface supported 370cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_1( Class, I1 ) \ 371cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 372cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 373cdf0e10cSrcweir CPPU_TYPE_REF( I1 ) \ 374cdf0e10cSrcweir GETTYPES_IMPL_END 375cdf0e10cSrcweir 376cdf0e10cSrcweir // 2 interfaces supported 377cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_2( Class, I1,I2 ) \ 378cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 379cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 380cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 381cdf0e10cSrcweir CPPU_TYPE_REF( I2 ) \ 382cdf0e10cSrcweir GETTYPES_IMPL_END 383cdf0e10cSrcweir 384cdf0e10cSrcweir // 3 interfaces supported 385cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_3( Class, I1,I2,I3 ) \ 386cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 387cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 388cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 389cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 390cdf0e10cSrcweir CPPU_TYPE_REF( I3 ) \ 391cdf0e10cSrcweir GETTYPES_IMPL_END 392cdf0e10cSrcweir 393cdf0e10cSrcweir // 4 interfaces supported 394cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_4( Class, I1,I2,I3,I4 ) \ 395cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 396cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 397cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 398cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 399cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 400cdf0e10cSrcweir CPPU_TYPE_REF( I4 ) \ 401cdf0e10cSrcweir GETTYPES_IMPL_END 402cdf0e10cSrcweir 403cdf0e10cSrcweir // 5 interfaces supported 404cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_5( Class, I1,I2,I3,I4,I5 ) \ 405cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 406cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 407cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 408cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 409cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 410cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 411cdf0e10cSrcweir CPPU_TYPE_REF( I5 ) \ 412cdf0e10cSrcweir GETTYPES_IMPL_END 413cdf0e10cSrcweir 414cdf0e10cSrcweir // 6 interfaces supported 415cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_6( Class, I1,I2,I3,I4,I5,I6 ) \ 416cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 417cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 418cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 419cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 420cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 421cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 422cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 423cdf0e10cSrcweir CPPU_TYPE_REF( I6 ) \ 424cdf0e10cSrcweir GETTYPES_IMPL_END 425cdf0e10cSrcweir 426cdf0e10cSrcweir // 7 interfaces supported 427cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_7( Class, I1,I2,I3,I4,I5,I6,I7 ) \ 428cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 429cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 430cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 431cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 432cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 433cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 434cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 435cdf0e10cSrcweir CPPU_TYPE_REF( I6 ), \ 436cdf0e10cSrcweir CPPU_TYPE_REF( I7 ) \ 437cdf0e10cSrcweir GETTYPES_IMPL_END 438cdf0e10cSrcweir 439cdf0e10cSrcweir // 8 interfaces supported 440cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_8( Class, I1,I2,I3,I4,I5,I6,I7,I8 ) \ 441cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 442cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 443cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 444cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 445cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 446cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 447cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 448cdf0e10cSrcweir CPPU_TYPE_REF( I6 ), \ 449cdf0e10cSrcweir CPPU_TYPE_REF( I7 ), \ 450cdf0e10cSrcweir CPPU_TYPE_REF( I8 ) \ 451cdf0e10cSrcweir GETTYPES_IMPL_END 452cdf0e10cSrcweir 453cdf0e10cSrcweir // 9 interfaces supported 454cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_9( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \ 455cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 456cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 457cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 458cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 459cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 460cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 461cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 462cdf0e10cSrcweir CPPU_TYPE_REF( I6 ), \ 463cdf0e10cSrcweir CPPU_TYPE_REF( I7 ), \ 464cdf0e10cSrcweir CPPU_TYPE_REF( I8 ), \ 465cdf0e10cSrcweir CPPU_TYPE_REF( I9 ) \ 466cdf0e10cSrcweir GETTYPES_IMPL_END 467cdf0e10cSrcweir 468cdf0e10cSrcweir // 10 interfaces supported 469cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_10( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \ 470cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 471cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 472cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 473cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 474cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 475cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 476cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 477cdf0e10cSrcweir CPPU_TYPE_REF( I6 ), \ 478cdf0e10cSrcweir CPPU_TYPE_REF( I7 ), \ 479cdf0e10cSrcweir CPPU_TYPE_REF( I8 ), \ 480cdf0e10cSrcweir CPPU_TYPE_REF( I9 ), \ 481cdf0e10cSrcweir CPPU_TYPE_REF( I10 ) \ 482cdf0e10cSrcweir GETTYPES_IMPL_END 483cdf0e10cSrcweir 484cdf0e10cSrcweir // 11 interfaces supported 485cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_11( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \ 486cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 487cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 488cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 489cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 490cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 491cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 492cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 493cdf0e10cSrcweir CPPU_TYPE_REF( I6 ), \ 494cdf0e10cSrcweir CPPU_TYPE_REF( I7 ), \ 495cdf0e10cSrcweir CPPU_TYPE_REF( I8 ), \ 496cdf0e10cSrcweir CPPU_TYPE_REF( I9 ), \ 497cdf0e10cSrcweir CPPU_TYPE_REF( I10 ), \ 498cdf0e10cSrcweir CPPU_TYPE_REF( I11 ) \ 499cdf0e10cSrcweir GETTYPES_IMPL_END 500cdf0e10cSrcweir 501cdf0e10cSrcweir // 12 interfaces supported 502cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_12( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12 ) \ 503cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 504cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 505cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 506cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 507cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 508cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 509cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 510cdf0e10cSrcweir CPPU_TYPE_REF( I6 ), \ 511cdf0e10cSrcweir CPPU_TYPE_REF( I7 ), \ 512cdf0e10cSrcweir CPPU_TYPE_REF( I8 ), \ 513cdf0e10cSrcweir CPPU_TYPE_REF( I9 ), \ 514cdf0e10cSrcweir CPPU_TYPE_REF( I10 ), \ 515cdf0e10cSrcweir CPPU_TYPE_REF( I11 ), \ 516cdf0e10cSrcweir CPPU_TYPE_REF( I12 ) \ 517cdf0e10cSrcweir GETTYPES_IMPL_END 518cdf0e10cSrcweir 519cdf0e10cSrcweir // 13 interfaces supported 520cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_13( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13 ) \ 521cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 522cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 523cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 524cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 525cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 526cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 527cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 528cdf0e10cSrcweir CPPU_TYPE_REF( I6 ), \ 529cdf0e10cSrcweir CPPU_TYPE_REF( I7 ), \ 530cdf0e10cSrcweir CPPU_TYPE_REF( I8 ), \ 531cdf0e10cSrcweir CPPU_TYPE_REF( I9 ), \ 532cdf0e10cSrcweir CPPU_TYPE_REF( I10 ), \ 533cdf0e10cSrcweir CPPU_TYPE_REF( I11 ), \ 534cdf0e10cSrcweir CPPU_TYPE_REF( I12 ), \ 535cdf0e10cSrcweir CPPU_TYPE_REF( I13 ) \ 536cdf0e10cSrcweir GETTYPES_IMPL_END 537cdf0e10cSrcweir 538cdf0e10cSrcweir // 14 interfaces supported 539cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_14( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14 ) \ 540cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 541cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 542cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 543cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 544cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 545cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 546cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 547cdf0e10cSrcweir CPPU_TYPE_REF( I6 ), \ 548cdf0e10cSrcweir CPPU_TYPE_REF( I7 ), \ 549cdf0e10cSrcweir CPPU_TYPE_REF( I8 ), \ 550cdf0e10cSrcweir CPPU_TYPE_REF( I9 ), \ 551cdf0e10cSrcweir CPPU_TYPE_REF( I10 ), \ 552cdf0e10cSrcweir CPPU_TYPE_REF( I11 ), \ 553cdf0e10cSrcweir CPPU_TYPE_REF( I12 ), \ 554cdf0e10cSrcweir CPPU_TYPE_REF( I13 ), \ 555cdf0e10cSrcweir CPPU_TYPE_REF( I14 ) \ 556cdf0e10cSrcweir GETTYPES_IMPL_END 557cdf0e10cSrcweir 558cdf0e10cSrcweir // 15 interfaces supported 559cdf0e10cSrcweir #define XTYPEPROVIDER_IMPL_15( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15 ) \ 560cdf0e10cSrcweir XTYPEPROVIDER_COMMON_IMPL( Class ) \ 561cdf0e10cSrcweir GETTYPES_IMPL_START( Class ) \ 562cdf0e10cSrcweir CPPU_TYPE_REF( I1 ), \ 563cdf0e10cSrcweir CPPU_TYPE_REF( I2 ), \ 564cdf0e10cSrcweir CPPU_TYPE_REF( I3 ), \ 565cdf0e10cSrcweir CPPU_TYPE_REF( I4 ), \ 566cdf0e10cSrcweir CPPU_TYPE_REF( I5 ), \ 567cdf0e10cSrcweir CPPU_TYPE_REF( I6 ), \ 568cdf0e10cSrcweir CPPU_TYPE_REF( I7 ), \ 569cdf0e10cSrcweir CPPU_TYPE_REF( I8 ), \ 570cdf0e10cSrcweir CPPU_TYPE_REF( I9 ), \ 571cdf0e10cSrcweir CPPU_TYPE_REF( I10 ), \ 572cdf0e10cSrcweir CPPU_TYPE_REF( I11 ), \ 573cdf0e10cSrcweir CPPU_TYPE_REF( I12 ), \ 574cdf0e10cSrcweir CPPU_TYPE_REF( I13 ), \ 575cdf0e10cSrcweir CPPU_TYPE_REF( I14 ), \ 576cdf0e10cSrcweir CPPU_TYPE_REF( I15 ) \ 577cdf0e10cSrcweir GETTYPES_IMPL_END 578cdf0e10cSrcweir 579cdf0e10cSrcweir //========================================================================= 580cdf0e10cSrcweir // 581cdf0e10cSrcweir // XServiceInfo decl. 582cdf0e10cSrcweir // 583cdf0e10cSrcweir //========================================================================= 584cdf0e10cSrcweir 585cdf0e10cSrcweir #define XSERVICEINFO_NOFACTORY_DECL() \ 586cdf0e10cSrcweir virtual rtl::OUString SAL_CALL \ 587cdf0e10cSrcweir getImplementationName() \ 588cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); \ 589cdf0e10cSrcweir virtual sal_Bool SAL_CALL \ 590cdf0e10cSrcweir supportsService( const rtl::OUString& ServiceName ) \ 591cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); \ 592cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL \ 593cdf0e10cSrcweir getSupportedServiceNames() \ 594cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); \ 595cdf0e10cSrcweir \ 596cdf0e10cSrcweir static rtl::OUString \ 597cdf0e10cSrcweir getImplementationName_Static(); \ 598cdf0e10cSrcweir static com::sun::star::uno::Sequence< rtl::OUString > \ 599cdf0e10cSrcweir getSupportedServiceNames_Static(); 600cdf0e10cSrcweir 601cdf0e10cSrcweir #define XSERVICEINFO_DECL() \ 602cdf0e10cSrcweir XSERVICEINFO_NOFACTORY_DECL() \ 603cdf0e10cSrcweir \ 604cdf0e10cSrcweir static com::sun::star::uno::Reference< \ 605cdf0e10cSrcweir com::sun::star::lang::XSingleServiceFactory > \ 606cdf0e10cSrcweir createServiceFactory( const com::sun::star::uno::Reference< \ 607cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ); 608cdf0e10cSrcweir 609cdf0e10cSrcweir //========================================================================= 610cdf0e10cSrcweir // 611cdf0e10cSrcweir // XServiceInfo impl. internals 612cdf0e10cSrcweir // 613cdf0e10cSrcweir //========================================================================= 614cdf0e10cSrcweir 615cdf0e10cSrcweir #define XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \ 616cdf0e10cSrcweir rtl::OUString SAL_CALL Class::getImplementationName() \ 617cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ) \ 618cdf0e10cSrcweir { \ 619cdf0e10cSrcweir return getImplementationName_Static(); \ 620cdf0e10cSrcweir } \ 621cdf0e10cSrcweir \ 622cdf0e10cSrcweir rtl::OUString Class::getImplementationName_Static() \ 623cdf0e10cSrcweir { \ 624cdf0e10cSrcweir return ImplName; \ 625cdf0e10cSrcweir } \ 626cdf0e10cSrcweir \ 627cdf0e10cSrcweir sal_Bool SAL_CALL \ 628cdf0e10cSrcweir Class::supportsService( const rtl::OUString& ServiceName ) \ 629cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ) \ 630cdf0e10cSrcweir { \ 631cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > aSNL = \ 632cdf0e10cSrcweir getSupportedServiceNames(); \ 633cdf0e10cSrcweir const rtl::OUString* pArray = aSNL.getArray(); \ 634cdf0e10cSrcweir for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) \ 635cdf0e10cSrcweir { \ 636cdf0e10cSrcweir if( pArray[ i ] == ServiceName ) \ 637cdf0e10cSrcweir return sal_True; \ 638cdf0e10cSrcweir } \ 639cdf0e10cSrcweir \ 640cdf0e10cSrcweir return sal_False; \ 641cdf0e10cSrcweir } \ 642cdf0e10cSrcweir \ 643cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL \ 644cdf0e10cSrcweir Class::getSupportedServiceNames() \ 645cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ) \ 646cdf0e10cSrcweir { \ 647cdf0e10cSrcweir return getSupportedServiceNames_Static(); \ 648cdf0e10cSrcweir } 649cdf0e10cSrcweir 650cdf0e10cSrcweir #define XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \ 651cdf0e10cSrcweir static com::sun::star::uno::Reference< \ 652cdf0e10cSrcweir com::sun::star::uno::XInterface > SAL_CALL \ 653cdf0e10cSrcweir Class##_CreateInstance( const com::sun::star::uno::Reference< \ 654cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory> & rSMgr ) \ 655cdf0e10cSrcweir throw( com::sun::star::uno::Exception ) \ 656cdf0e10cSrcweir { \ 657cdf0e10cSrcweir com::sun::star::lang::XServiceInfo* pX = \ 658cdf0e10cSrcweir (com::sun::star::lang::XServiceInfo*)new Class( rSMgr ); \ 659cdf0e10cSrcweir return com::sun::star::uno::Reference< \ 660cdf0e10cSrcweir com::sun::star::uno::XInterface >::query( pX ); \ 661cdf0e10cSrcweir } 662cdf0e10cSrcweir 663cdf0e10cSrcweir //========================================================================= 664cdf0e10cSrcweir // 665cdf0e10cSrcweir // XServiceInfo impl. 666cdf0e10cSrcweir // 667cdf0e10cSrcweir //========================================================================= 668cdf0e10cSrcweir 669cdf0e10cSrcweir #define ONE_INSTANCE_SERVICE_FACTORY_IMPL( Class ) \ 670cdf0e10cSrcweir com::sun::star::uno::Reference< \ 671cdf0e10cSrcweir com::sun::star::lang::XSingleServiceFactory > \ 672cdf0e10cSrcweir Class::createServiceFactory( const com::sun::star::uno::Reference< \ 673cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ) \ 674cdf0e10cSrcweir { \ 675cdf0e10cSrcweir return com::sun::star::uno::Reference< \ 676cdf0e10cSrcweir com::sun::star::lang::XSingleServiceFactory >( \ 677cdf0e10cSrcweir cppu::createOneInstanceFactory( \ 678cdf0e10cSrcweir rxServiceMgr, \ 679cdf0e10cSrcweir Class::getImplementationName_Static(), \ 680cdf0e10cSrcweir Class##_CreateInstance, \ 681cdf0e10cSrcweir Class::getSupportedServiceNames_Static() ) ); \ 682cdf0e10cSrcweir } 683cdf0e10cSrcweir 684cdf0e10cSrcweir #define SINGLE_SERVICE_FACTORY_IMPL( Class ) \ 685cdf0e10cSrcweir com::sun::star::uno::Reference< \ 686cdf0e10cSrcweir com::sun::star::lang::XSingleServiceFactory > \ 687cdf0e10cSrcweir Class::createServiceFactory( const com::sun::star::uno::Reference< \ 688cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ) \ 689cdf0e10cSrcweir { \ 690cdf0e10cSrcweir return com::sun::star::uno::Reference< \ 691cdf0e10cSrcweir com::sun::star::lang::XSingleServiceFactory >( \ 692cdf0e10cSrcweir cppu::createSingleFactory( \ 693cdf0e10cSrcweir rxServiceMgr, \ 694cdf0e10cSrcweir Class::getImplementationName_Static(), \ 695cdf0e10cSrcweir Class##_CreateInstance, \ 696cdf0e10cSrcweir Class::getSupportedServiceNames_Static() ) ); \ 697cdf0e10cSrcweir } 698cdf0e10cSrcweir 699cdf0e10cSrcweir // Service without service factory. 700cdf0e10cSrcweir 701cdf0e10cSrcweir // Own implementation of getSupportedServiceNames_Static(). 702cdf0e10cSrcweir #define XSERVICEINFO_NOFACTORY_IMPL_0( Class, ImplName ) \ 703cdf0e10cSrcweir XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \ 704cdf0e10cSrcweir \ 705cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > \ 706cdf0e10cSrcweir Class::getSupportedServiceNames_Static() 707cdf0e10cSrcweir 708cdf0e10cSrcweir // 1 service name 709cdf0e10cSrcweir #define XSERVICEINFO_NOFACTORY_IMPL_1( Class, ImplName, Service1 ) \ 710cdf0e10cSrcweir XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \ 711cdf0e10cSrcweir \ 712cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > \ 713cdf0e10cSrcweir Class::getSupportedServiceNames_Static() \ 714cdf0e10cSrcweir { \ 715cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \ 716cdf0e10cSrcweir aSNS.getArray()[ 0 ] = Service1; \ 717cdf0e10cSrcweir return aSNS; \ 718cdf0e10cSrcweir } 719cdf0e10cSrcweir 720cdf0e10cSrcweir // Service with service factory. 721cdf0e10cSrcweir 722cdf0e10cSrcweir // Own implementation of getSupportedServiceNames_Static(). 723cdf0e10cSrcweir #define XSERVICEINFO_IMPL_0( Class, ImplName ) \ 724cdf0e10cSrcweir XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \ 725cdf0e10cSrcweir XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \ 726cdf0e10cSrcweir \ 727cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > \ 728cdf0e10cSrcweir Class::getSupportedServiceNames_Static() 729cdf0e10cSrcweir 730cdf0e10cSrcweir // 1 service name 731cdf0e10cSrcweir #define XSERVICEINFO_IMPL_1( Class, ImplName, Service1 ) \ 732cdf0e10cSrcweir XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \ 733cdf0e10cSrcweir XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \ 734cdf0e10cSrcweir \ 735cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > \ 736cdf0e10cSrcweir Class::getSupportedServiceNames_Static() \ 737cdf0e10cSrcweir { \ 738cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \ 739cdf0e10cSrcweir aSNS.getArray()[ 0 ] = Service1; \ 740cdf0e10cSrcweir return aSNS; \ 741cdf0e10cSrcweir } 742cdf0e10cSrcweir 743cdf0e10cSrcweir #endif /* !_UCBHELPER_MACROS_HXX */ 744