1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _DBASHARED_APITOOLS_HXX_ 29*cdf0e10cSrcweir #define _DBASHARED_APITOOLS_HXX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef _CPPUHELPER_COMPONENT_HXX_ 32*cdf0e10cSrcweir #include <cppuhelper/component.hxx> 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #ifndef _OSL_MUTEX_HXX_ 35*cdf0e10cSrcweir #include <osl/mutex.hxx> 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_ 38*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #ifndef _OSL_DIAGNOSE_H_ 41*cdf0e10cSrcweir #include <osl/diagnose.h> 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #ifndef _COMPHELPER_STLTYPES_HXX_ 44*cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ 47*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 48*cdf0e10cSrcweir #endif 49*cdf0e10cSrcweir #ifndef _COMPHELPER_SEQUENCE_HXX_ 50*cdf0e10cSrcweir #include <comphelper/sequence.hxx> 51*cdf0e10cSrcweir #endif 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir //================================================================================== 54*cdf0e10cSrcweir //= various typedefs 55*cdf0e10cSrcweir //================================================================================== 56*cdf0e10cSrcweir DECLARE_STL_VECTOR(::com::sun::star::uno::WeakReferenceHelper, OWeakRefArray); 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir //================================================================================== 59*cdf0e10cSrcweir //= OSubComponent - a component which holds a hard ref to it's parent 60*cdf0e10cSrcweir //= and is been hold itself (by the parent) with a weak ref 61*cdf0e10cSrcweir //================================================================================== 62*cdf0e10cSrcweir class OSubComponent : public ::cppu::OComponentHelper 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir protected: 65*cdf0e10cSrcweir // the parent must support the tunnel implementation 66*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; 67*cdf0e10cSrcweir virtual ~OSubComponent(); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir public: 70*cdf0e10cSrcweir OSubComponent(::osl::Mutex& _rMutex, 71*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent); 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir // ::com::sun::star::lang::XTypeProvider 74*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir // ::com::sun::star::uno::XInterface 77*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) 78*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 79*cdf0e10cSrcweir virtual void SAL_CALL acquire() throw(); 80*cdf0e10cSrcweir virtual void SAL_CALL release() throw(); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir inline operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > () const 83*cdf0e10cSrcweir { return (::com::sun::star::uno::XWeak *)this; } 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir }; 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir //================================================================================== 88*cdf0e10cSrcweir //= helper for implementing the XServiceInfo interface 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 91*cdf0e10cSrcweir // (internal - not to be used outside - usually) 92*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \ 93*cdf0e10cSrcweir ::rtl::OUString SAL_CALL classname::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \ 94*cdf0e10cSrcweir { \ 95*cdf0e10cSrcweir return ::rtl::OUString::createFromAscii(implasciiname); \ 96*cdf0e10cSrcweir } \ 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(classname, implasciiname) \ 99*cdf0e10cSrcweir ::rtl::OUString SAL_CALL classname::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \ 100*cdf0e10cSrcweir { \ 101*cdf0e10cSrcweir return getImplementationName_Static(); \ 102*cdf0e10cSrcweir } \ 103*cdf0e10cSrcweir ::rtl::OUString SAL_CALL classname::getImplementationName_Static( ) throw (::com::sun::star::uno::RuntimeException) \ 104*cdf0e10cSrcweir { \ 105*cdf0e10cSrcweir return ::rtl::OUString::createFromAscii(implasciiname); \ 106*cdf0e10cSrcweir } \ 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ 109*cdf0e10cSrcweir sal_Bool SAL_CALL classname::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \ 110*cdf0e10cSrcweir { \ 111*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); \ 112*cdf0e10cSrcweir const ::rtl::OUString* pSupported = aSupported.getConstArray(); \ 113*cdf0e10cSrcweir for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) \ 114*cdf0e10cSrcweir if (pSupported->equals(_rServiceName)) \ 115*cdf0e10cSrcweir return sal_True; \ 116*cdf0e10cSrcweir \ 117*cdf0e10cSrcweir return sal_False; \ 118*cdf0e10cSrcweir } \ 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED1(classname, serviceasciiname) \ 121*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ 122*cdf0e10cSrcweir { \ 123*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); \ 124*cdf0e10cSrcweir aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \ 125*cdf0e10cSrcweir return aSupported; \ 126*cdf0e10cSrcweir } \ 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(classname, serviceasciiname) \ 129*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ 130*cdf0e10cSrcweir { \ 131*cdf0e10cSrcweir return getSupportedServiceNames_Static(); \ 132*cdf0e10cSrcweir } \ 133*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames_Static( ) throw(::com::sun::star::uno::RuntimeException) \ 134*cdf0e10cSrcweir { \ 135*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); \ 136*cdf0e10cSrcweir aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \ 137*cdf0e10cSrcweir return aSupported; \ 138*cdf0e10cSrcweir } \ 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED2_STATIC(classname, serviceasciiname1, serviceasciiname2) \ 141*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ 142*cdf0e10cSrcweir { \ 143*cdf0e10cSrcweir return getSupportedServiceNames_Static(); \ 144*cdf0e10cSrcweir } \ 145*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames_Static( ) throw(::com::sun::star::uno::RuntimeException) \ 146*cdf0e10cSrcweir { \ 147*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2); \ 148*cdf0e10cSrcweir aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname1); \ 149*cdf0e10cSrcweir aSupported[1] = ::rtl::OUString::createFromAscii(serviceasciiname2); \ 150*cdf0e10cSrcweir return aSupported; \ 151*cdf0e10cSrcweir } \ 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED2(classname, serviceasciiname1, serviceasciiname2) \ 154*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ 155*cdf0e10cSrcweir { \ 156*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2); \ 157*cdf0e10cSrcweir aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname1); \ 158*cdf0e10cSrcweir aSupported[1] = ::rtl::OUString::createFromAscii(serviceasciiname2); \ 159*cdf0e10cSrcweir return aSupported; \ 160*cdf0e10cSrcweir } \ 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED3(classname, serviceasciiname1, serviceasciiname2, serviceasciiname3) \ 163*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ 164*cdf0e10cSrcweir { \ 165*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(3); \ 166*cdf0e10cSrcweir aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname1); \ 167*cdf0e10cSrcweir aSupported[1] = ::rtl::OUString::createFromAscii(serviceasciiname2); \ 168*cdf0e10cSrcweir aSupported[2] = ::rtl::OUString::createFromAscii(serviceasciiname3); \ 169*cdf0e10cSrcweir return aSupported; \ 170*cdf0e10cSrcweir } \ 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO_CREATE_STATIC(classname) \ 173*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > \ 174*cdf0e10cSrcweir SAL_CALL classname::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) \ 175*cdf0e10cSrcweir { \ 176*cdf0e10cSrcweir return static_cast< XServiceInfo* >(new classname(_rxORB)); \ 177*cdf0e10cSrcweir } \ 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 180*cdf0e10cSrcweir // declare service info methods - no getImplementationName, so the class is abstract 181*cdf0e10cSrcweir #define DECLARE_SERVICE_INFO_ABSTRACT() \ 182*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \ 183*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 186*cdf0e10cSrcweir // declare service info methods 187*cdf0e10cSrcweir #define DECLARE_SERVICE_INFO() \ 188*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); \ 189*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \ 190*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir #define DECLARE_SERVICE_INFO_STATIC() \ 193*cdf0e10cSrcweir DECLARE_SERVICE_INFO(); \ 194*cdf0e10cSrcweir static ::rtl::OUString SAL_CALL getImplementationName_Static( ) throw (::com::sun::star::uno::RuntimeException); \ 195*cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static( ) throw(::com::sun::star::uno::RuntimeException); \ 196*cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > \ 197*cdf0e10cSrcweir SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&) \ 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 200*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO1(classname, implasciiname, serviceasciiname) \ 201*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \ 202*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ 203*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_GETSUPPORTED1(classname, serviceasciiname) \ 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 206*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO1_STATIC(classname, implasciiname, serviceasciiname) \ 207*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(classname, implasciiname) \ 208*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ 209*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(classname, serviceasciiname) \ 210*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_CREATE_STATIC(classname) \ 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 213*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO2(classname, implasciiname, serviceasciiname1, serviceasciiname2) \ 214*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \ 215*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ 216*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_GETSUPPORTED2(classname, serviceasciiname1, serviceasciiname2) 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 219*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO2_STATIC(classname, implasciiname, serviceasciiname1, serviceasciiname2) \ 220*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(classname, implasciiname) \ 221*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ 222*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_GETSUPPORTED2_STATIC(classname, serviceasciiname1,serviceasciiname2) \ 223*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_CREATE_STATIC(classname) \ 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 226*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO3(classname, implasciiname, serviceasciiname1, serviceasciiname2, serviceasciiname3) \ 227*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \ 228*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ 229*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_GETSUPPORTED3(classname, serviceasciiname1, serviceasciiname2, serviceasciiname3) \ 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 232*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO1_ABSTRACT(classname, serviceasciiname) \ 233*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ 234*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_GETSUPPORTED1(classname, serviceasciiname) \ 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 237*cdf0e10cSrcweir #define IMPLEMENT_SERVICE_INFO2_ABSTRACT(classname, serviceasciiname1, serviceasciiname2) \ 238*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ 239*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO_GETSUPPORTED2(classname, serviceasciiname1, serviceasciiname2) \ 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir //================================================================================== 242*cdf0e10cSrcweir //= XTypeProvider helpers 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir //-------------------------------------------------------------------------- 245*cdf0e10cSrcweir #define DECLARE_IMPLEMENTATION_ID( ) \ 246*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); \ 247*cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId() \ 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir //-------------------------------------------------------------------------- 250*cdf0e10cSrcweir #define DECLARE_GETTYPES( ) \ 251*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir //-------------------------------------------------------------------------- 254*cdf0e10cSrcweir #define DECLARE_TYPEPROVIDER( ) \ 255*cdf0e10cSrcweir DECLARE_GETTYPES( ) \ 256*cdf0e10cSrcweir DECLARE_IMPLEMENTATION_ID( ) 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir //-------------------------------------------------------------------------- 259*cdf0e10cSrcweir #define IMPLEMENT_IMPLEMENTATION_ID( classname ) \ 260*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< sal_Int8 > classname::getUnoTunnelImplementationId() \ 261*cdf0e10cSrcweir { \ 262*cdf0e10cSrcweir static ::cppu::OImplementationId* pId = 0; \ 263*cdf0e10cSrcweir if ( !pId ) \ 264*cdf0e10cSrcweir { \ 265*cdf0e10cSrcweir ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ 266*cdf0e10cSrcweir if ( !pId ) \ 267*cdf0e10cSrcweir { \ 268*cdf0e10cSrcweir static ::cppu::OImplementationId aId; \ 269*cdf0e10cSrcweir pId = &aId; \ 270*cdf0e10cSrcweir } \ 271*cdf0e10cSrcweir } \ 272*cdf0e10cSrcweir return pId->getImplementationId(); \ 273*cdf0e10cSrcweir } \ 274*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< sal_Int8 > classname::getImplementationId() throw (::com::sun::star::uno::RuntimeException) \ 275*cdf0e10cSrcweir { \ 276*cdf0e10cSrcweir return classname::getUnoTunnelImplementationId(); \ 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir //-------------------------------------------------------------------------- 280*cdf0e10cSrcweir #define IMPLEMENT_GETTYPES2( classname, baseclass1, baseclass2 ) \ 281*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > classname::getTypes() throw (::com::sun::star::uno::RuntimeException) \ 282*cdf0e10cSrcweir { \ 283*cdf0e10cSrcweir return ::comphelper::concatSequences( \ 284*cdf0e10cSrcweir baseclass1::getTypes( ), \ 285*cdf0e10cSrcweir baseclass2::getTypes( ) \ 286*cdf0e10cSrcweir ); \ 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir //-------------------------------------------------------------------------- 290*cdf0e10cSrcweir #define IMPLEMENT_GETTYPES3( classname, baseclass1, baseclass2, baseclass3 ) \ 291*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > classname::getTypes() throw (::com::sun::star::uno::RuntimeException) \ 292*cdf0e10cSrcweir { \ 293*cdf0e10cSrcweir return ::comphelper::concatSequences( \ 294*cdf0e10cSrcweir baseclass1::getTypes( ), \ 295*cdf0e10cSrcweir baseclass2::getTypes( ), \ 296*cdf0e10cSrcweir baseclass3::getTypes( ) \ 297*cdf0e10cSrcweir ); \ 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir //-------------------------------------------------------------------------- 301*cdf0e10cSrcweir #define IMPLEMENT_TYPEPROVIDER2( classname, baseclass1, baseclass2 ) \ 302*cdf0e10cSrcweir IMPLEMENT_IMPLEMENTATION_ID( classname) \ 303*cdf0e10cSrcweir IMPLEMENT_GETTYPES2( classname, baseclass1, baseclass2 ) 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir //-------------------------------------------------------------------------- 306*cdf0e10cSrcweir #define IMPLEMENT_TYPEPROVIDER3( classname, baseclass1, baseclass2, baseclass3 ) \ 307*cdf0e10cSrcweir IMPLEMENT_IMPLEMENTATION_ID( classname) \ 308*cdf0e10cSrcweir IMPLEMENT_GETTYPES3(classname, baseclass1, baseclass2, baseclass3 ) 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir //================================================================================== 311*cdf0e10cSrcweir //= helper for declaring/implementing classes based on the OPropertyContainer and an OPropertyArrayUsageHelper 312*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 313*cdf0e10cSrcweir #define DECLARE_PROPERTYCONTAINER_DEFAULTS( ) \ 314*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); \ 315*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); \ 316*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 319*cdf0e10cSrcweir #define IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2( classname , baseclass1) \ 320*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL classname::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) \ 321*cdf0e10cSrcweir { \ 322*cdf0e10cSrcweir Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); \ 323*cdf0e10cSrcweir return xInfo; \ 324*cdf0e10cSrcweir } \ 325*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& classname::getInfoHelper() \ 326*cdf0e10cSrcweir { \ 327*cdf0e10cSrcweir return *baseclass1::getArrayHelper(); \ 328*cdf0e10cSrcweir } \ 329*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* classname::createArrayHelper( ) const \ 330*cdf0e10cSrcweir { \ 331*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps; \ 332*cdf0e10cSrcweir describeProperties(aProps); \ 333*cdf0e10cSrcweir return new ::cppu::OPropertyArrayHelper(aProps); \ 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 336*cdf0e10cSrcweir #define IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( classname ) \ 337*cdf0e10cSrcweir IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2( classname, classname ) 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir //================================================================================== 340*cdf0e10cSrcweir //= helper for implementing the createArrayHelper 341*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 342*cdf0e10cSrcweir #define BEGIN_PROPERTY_SEQUENCE(count) \ 343*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aDescriptor(count); \ 344*cdf0e10cSrcweir ::com::sun::star::beans::Property* pDesc = aDescriptor.getArray(); \ 345*cdf0e10cSrcweir sal_Int32 nPos = 0; \ 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 348*cdf0e10cSrcweir #define BEGIN_PROPERTY_HELPER(count) \ 349*cdf0e10cSrcweir BEGIN_PROPERTY_SEQUENCE(count) 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 352*cdf0e10cSrcweir #define DECL_PROP_IMPL(varname, cpputype) \ 353*cdf0e10cSrcweir pDesc[nPos++] = ::com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, cpputype, 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 356*cdf0e10cSrcweir #define DECL_PROP0(varname, type) \ 357*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getCppuType((const type *)0)) 0) 358*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 359*cdf0e10cSrcweir #define DECL_PROP0_BOOL(varname) \ 360*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getBooleanCppuType()) 0) 361*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 362*cdf0e10cSrcweir #define DECL_PROP0_IFACE(varname, iface) \ 363*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getCppuType(static_cast< ::com::sun::star::uno::Reference< iface >* >(NULL))) 0) 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 366*cdf0e10cSrcweir #define DECL_PROP1(varname, type, attrib1) \ 367*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getCppuType((const type *)0)) ::com::sun::star::beans::PropertyAttribute::attrib1) 368*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 369*cdf0e10cSrcweir #define DECL_PROP1_BOOL(varname, attrib1) \ 370*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getBooleanCppuType()) ::com::sun::star::beans::PropertyAttribute::attrib1) 371*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 372*cdf0e10cSrcweir #define DECL_PROP1_IFACE(varname, iface, attrib1) \ 373*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getCppuType(static_cast< ::com::sun::star::uno::Reference< iface >* >(NULL))) ::com::sun::star::beans::PropertyAttribute::attrib1) 374*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 375*cdf0e10cSrcweir #define DECL_PROP2_IFACE(varname, iface, attrib1, attrib2) \ 376*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getCppuType(static_cast< ::com::sun::star::uno::Reference< iface >* >(NULL))) ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2) 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 379*cdf0e10cSrcweir #define DECL_PROP2(varname, type, attrib1, attrib2) \ 380*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getCppuType((const type *)0)) ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2) 381*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 382*cdf0e10cSrcweir #define DECL_PROP2_BOOL(varname, attrib1, attrib2) \ 383*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getBooleanCppuType()) ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2) 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 386*cdf0e10cSrcweir #define DECL_PROP3(varname, type, attrib1, attrib2, attrib3) \ 387*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getCppuType((const type *)0)) ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3) 388*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 389*cdf0e10cSrcweir #define DECL_PROP3_BOOL(varname, attrib1, attrib2, attrib3) \ 390*cdf0e10cSrcweir DECL_PROP_IMPL(varname, ::getBooleanCppuType()) ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3) 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 394*cdf0e10cSrcweir #define END_PROPERTY_SEQUENCE() \ 395*cdf0e10cSrcweir OSL_ENSURE(nPos == aDescriptor.getLength(), "forgot to adjust the count ?"); \ 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir //---------------------------------------------------------------------------------- 398*cdf0e10cSrcweir #define END_PROPERTY_HELPER() \ 399*cdf0e10cSrcweir END_PROPERTY_SEQUENCE() \ 400*cdf0e10cSrcweir return new ::cppu::OPropertyArrayHelper(aDescriptor); 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir #define NOTIFY_LISTERNERS(_rListeners,T,method) \ 404*cdf0e10cSrcweir Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \ 405*cdf0e10cSrcweir \ 406*cdf0e10cSrcweir const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); \ 407*cdf0e10cSrcweir const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \ 408*cdf0e10cSrcweir \ 409*cdf0e10cSrcweir _rGuard.clear(); \ 410*cdf0e10cSrcweir while( pxInt > pxIntBegin ) \ 411*cdf0e10cSrcweir { \ 412*cdf0e10cSrcweir try \ 413*cdf0e10cSrcweir { \ 414*cdf0e10cSrcweir while( pxInt > pxIntBegin ) \ 415*cdf0e10cSrcweir { \ 416*cdf0e10cSrcweir --pxInt; \ 417*cdf0e10cSrcweir static_cast< T* >( pxInt->get() )->method(aEvt); \ 418*cdf0e10cSrcweir } \ 419*cdf0e10cSrcweir } \ 420*cdf0e10cSrcweir catch( RuntimeException& ) \ 421*cdf0e10cSrcweir { \ 422*cdf0e10cSrcweir } \ 423*cdf0e10cSrcweir } \ 424*cdf0e10cSrcweir _rGuard.reset(); 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir #define NOTIFY_LISTERNERS1(_rListeners,T,method,arg1) \ 427*cdf0e10cSrcweir Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \ 428*cdf0e10cSrcweir \ 429*cdf0e10cSrcweir const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); \ 430*cdf0e10cSrcweir const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \ 431*cdf0e10cSrcweir \ 432*cdf0e10cSrcweir _rGuard.clear(); \ 433*cdf0e10cSrcweir while( pxInt > pxIntBegin ) \ 434*cdf0e10cSrcweir { \ 435*cdf0e10cSrcweir try \ 436*cdf0e10cSrcweir { \ 437*cdf0e10cSrcweir while( pxInt > pxIntBegin ) \ 438*cdf0e10cSrcweir { \ 439*cdf0e10cSrcweir --pxInt; \ 440*cdf0e10cSrcweir static_cast< T* >( pxInt->get() )->method(aEvt,arg1); \ 441*cdf0e10cSrcweir } \ 442*cdf0e10cSrcweir } \ 443*cdf0e10cSrcweir catch( RuntimeException& ) \ 444*cdf0e10cSrcweir { \ 445*cdf0e10cSrcweir } \ 446*cdf0e10cSrcweir } \ 447*cdf0e10cSrcweir _rGuard.reset(); 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir //================================================================================== 451*cdf0e10cSrcweir // miscellaneous 452*cdf0e10cSrcweir #define UNUSED(x) x; 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir #endif // _DBASHARED_APITOOLS_HXX_ 455*cdf0e10cSrcweir 456