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