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