xref: /AOO41X/main/dbaccess/source/inc/apitools.hxx (revision 2e2212a7c22e96cf6f6fab0dd042c34a45a64bd6) !
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() throw (::com::sun::star::uno::RuntimeException);
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             throw(::com::sun::star::uno::RuntimeException);
75     virtual void SAL_CALL acquire() throw();
76     virtual void SAL_CALL release() throw();
77 
operator ::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface>() const78     inline operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > () const
79         { return (::com::sun::star::uno::XWeak *)this; }
80 
81 };
82 
83 //==================================================================================
84 //= helper for implementing the XServiceInfo interface
85 
86 //----------------------------------------------------------------------------------
87 // (internal - not to be used outside - usually)
88 #define IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname)   \
89     ::rtl::OUString SAL_CALL classname::getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException)   \
90     {   \
91         return ::rtl::OUString::createFromAscii(implasciiname); \
92     }   \
93 
94 #define IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(classname, implasciiname)    \
95     ::rtl::OUString SAL_CALL classname::getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException)   \
96     {   \
97         return getImplementationName_Static();  \
98     }   \
99     ::rtl::OUString SAL_CALL classname::getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException)    \
100     {   \
101         return ::rtl::OUString::createFromAscii(implasciiname); \
102     }   \
103 
104 #define IMPLEMENT_SERVICE_INFO_SUPPORTS(classname)  \
105     sal_Bool SAL_CALL classname::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \
106     {   \
107         ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());  \
108         const ::rtl::OUString* pSupported = aSupported.getConstArray(); \
109         for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported)    \
110             if (pSupported->equals(_rServiceName))  \
111                 return sal_True;    \
112     \
113         return sal_False;   \
114     }   \
115 
116 #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED1(classname, serviceasciiname)   \
117     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)  \
118     {   \
119         ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);   \
120         aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \
121         return aSupported;  \
122     }   \
123 
124 #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(classname, serviceasciiname)    \
125     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)  \
126     {   \
127         return getSupportedServiceNames_Static();   \
128     }   \
129     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException)   \
130     {   \
131         ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);   \
132         aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \
133         return aSupported;  \
134     }   \
135 
136 #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED2_STATIC(classname, serviceasciiname1, serviceasciiname2)    \
137     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)  \
138     {   \
139         return getSupportedServiceNames_Static();   \
140     }   \
141     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException)   \
142     {   \
143         ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2);   \
144         aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname1);    \
145         aSupported[1] = ::rtl::OUString::createFromAscii(serviceasciiname2);    \
146         return aSupported;  \
147     }   \
148 
149 #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED2(classname, serviceasciiname1, serviceasciiname2)   \
150     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)  \
151     {   \
152         ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2);   \
153         aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname1);    \
154         aSupported[1] = ::rtl::OUString::createFromAscii(serviceasciiname2);    \
155         return aSupported;  \
156     }   \
157 
158 #define IMPLEMENT_SERVICE_INFO_GETSUPPORTED3(classname, serviceasciiname1, serviceasciiname2, serviceasciiname3)    \
159     ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)  \
160     {   \
161         ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(3);   \
162         aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname1);    \
163         aSupported[1] = ::rtl::OUString::createFromAscii(serviceasciiname2);    \
164         aSupported[2] = ::rtl::OUString::createFromAscii(serviceasciiname3);    \
165         return aSupported;  \
166     }   \
167 
168 #define IMPLEMENT_SERVICE_INFO_CREATE_STATIC(classname) \
169     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >   \
170         SAL_CALL classname::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB)  \
171     {   \
172         return static_cast< XServiceInfo* >(new classname(_rxORB)); \
173     }   \
174 
175 //----------------------------------------------------------------------------------
176 // declare service info methods - no getImplementationName, so the class is abstract
177 #define DECLARE_SERVICE_INFO_ABSTRACT() \
178     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \
179     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException) \
180 
181 //----------------------------------------------------------------------------------
182 // declare service info methods
183 #define DECLARE_SERVICE_INFO()  \
184     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException); \
185     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \
186     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException) \
187 
188 #define DECLARE_SERVICE_INFO_STATIC()   \
189     DECLARE_SERVICE_INFO(); \
190     static ::rtl::OUString SAL_CALL getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);   \
191     static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);  \
192     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >    \
193         SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)    \
194 
195 //----------------------------------------------------------------------------------
196 #define IMPLEMENT_SERVICE_INFO1(classname, implasciiname, serviceasciiname) \
197     IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname)   \
198     IMPLEMENT_SERVICE_INFO_SUPPORTS(classname)  \
199     IMPLEMENT_SERVICE_INFO_GETSUPPORTED1(classname, serviceasciiname)   \
200 
201 //----------------------------------------------------------------------------------
202 #define IMPLEMENT_SERVICE_INFO1_STATIC(classname, implasciiname, serviceasciiname)  \
203     IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(classname, implasciiname)    \
204     IMPLEMENT_SERVICE_INFO_SUPPORTS(classname)  \
205     IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(classname, serviceasciiname)    \
206     IMPLEMENT_SERVICE_INFO_CREATE_STATIC(classname) \
207 
208 //----------------------------------------------------------------------------------
209 #define IMPLEMENT_SERVICE_INFO2(classname, implasciiname, serviceasciiname1, serviceasciiname2) \
210     IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname)   \
211     IMPLEMENT_SERVICE_INFO_SUPPORTS(classname)  \
212     IMPLEMENT_SERVICE_INFO_GETSUPPORTED2(classname, serviceasciiname1, serviceasciiname2)
213 
214 //----------------------------------------------------------------------------------
215 #define IMPLEMENT_SERVICE_INFO2_STATIC(classname, implasciiname, serviceasciiname1, serviceasciiname2)  \
216     IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(classname, implasciiname)    \
217     IMPLEMENT_SERVICE_INFO_SUPPORTS(classname)  \
218     IMPLEMENT_SERVICE_INFO_GETSUPPORTED2_STATIC(classname, serviceasciiname1,serviceasciiname2) \
219     IMPLEMENT_SERVICE_INFO_CREATE_STATIC(classname) \
220 
221 //----------------------------------------------------------------------------------
222 #define IMPLEMENT_SERVICE_INFO3(classname, implasciiname, serviceasciiname1, serviceasciiname2, serviceasciiname3)  \
223     IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname)   \
224     IMPLEMENT_SERVICE_INFO_SUPPORTS(classname)  \
225     IMPLEMENT_SERVICE_INFO_GETSUPPORTED3(classname, serviceasciiname1, serviceasciiname2, serviceasciiname3)    \
226 
227 //----------------------------------------------------------------------------------
228 #define IMPLEMENT_SERVICE_INFO1_ABSTRACT(classname, serviceasciiname)   \
229     IMPLEMENT_SERVICE_INFO_SUPPORTS(classname)  \
230     IMPLEMENT_SERVICE_INFO_GETSUPPORTED1(classname, serviceasciiname)   \
231 
232 //----------------------------------------------------------------------------------
233 #define IMPLEMENT_SERVICE_INFO2_ABSTRACT(classname, serviceasciiname1, serviceasciiname2)   \
234     IMPLEMENT_SERVICE_INFO_SUPPORTS(classname)  \
235     IMPLEMENT_SERVICE_INFO_GETSUPPORTED2(classname, serviceasciiname1, serviceasciiname2)   \
236 
237 //==================================================================================
238 //= XTypeProvider helpers
239 
240 //--------------------------------------------------------------------------
241 #define DECLARE_IMPLEMENTATION_ID( )    \
242     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);  \
243     static ::com::sun::star::uno::Sequence< sal_Int8 >  getUnoTunnelImplementationId() \
244 
245 //--------------------------------------------------------------------------
246 #define DECLARE_GETTYPES( ) \
247     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw (::com::sun::star::uno::RuntimeException);
248 
249 //--------------------------------------------------------------------------
250 #define DECLARE_TYPEPROVIDER( ) \
251     DECLARE_GETTYPES( ) \
252     DECLARE_IMPLEMENTATION_ID( )
253 
254 //--------------------------------------------------------------------------
255 #define IMPLEMENT_IMPLEMENTATION_ID( classname )    \
256 ::com::sun::star::uno::Sequence< sal_Int8 > classname::getUnoTunnelImplementationId() \
257 {   \
258     static ::cppu::OImplementationId* pId = 0;  \
259     if ( !pId ) \
260     {   \
261         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
262         if ( !pId ) \
263         {   \
264             static ::cppu::OImplementationId aId;   \
265             pId = &aId; \
266         }   \
267     }   \
268     return pId->getImplementationId();  \
269 } \
270 ::com::sun::star::uno::Sequence< sal_Int8 > classname::getImplementationId() throw (::com::sun::star::uno::RuntimeException)    \
271 {   \
272     return classname::getUnoTunnelImplementationId(); \
273 }
274 
275 //--------------------------------------------------------------------------
276 #define IMPLEMENT_GETTYPES2( classname, baseclass1, baseclass2 )    \
277     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > classname::getTypes() throw (::com::sun::star::uno::RuntimeException)    \
278     {   \
279         return  ::comphelper::concatSequences(  \
280             baseclass1::getTypes( ),    \
281             baseclass2::getTypes( ) \
282         );  \
283     }
284 
285 //--------------------------------------------------------------------------
286 #define IMPLEMENT_GETTYPES3( classname, baseclass1, baseclass2, baseclass3 )    \
287     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > classname::getTypes() throw (::com::sun::star::uno::RuntimeException)    \
288     {   \
289         return  ::comphelper::concatSequences(  \
290             baseclass1::getTypes( ),    \
291             baseclass2::getTypes( ),    \
292             baseclass3::getTypes( ) \
293         );  \
294     }
295 
296 //--------------------------------------------------------------------------
297 #define IMPLEMENT_TYPEPROVIDER2( classname, baseclass1, baseclass2 )    \
298     IMPLEMENT_IMPLEMENTATION_ID( classname) \
299     IMPLEMENT_GETTYPES2( classname, baseclass1, baseclass2 )
300 
301 //--------------------------------------------------------------------------
302 #define IMPLEMENT_TYPEPROVIDER3( classname, baseclass1, baseclass2, baseclass3 )    \
303     IMPLEMENT_IMPLEMENTATION_ID( classname) \
304     IMPLEMENT_GETTYPES3(classname, baseclass1, baseclass2, baseclass3 )
305 
306 //==================================================================================
307 //= helper for declaring/implementing classes based on the OPropertyContainer and an OPropertyArrayUsageHelper
308 //----------------------------------------------------------------------------------
309 #define DECLARE_PROPERTYCONTAINER_DEFAULTS( )   \
310     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo>  SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); \
311     virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); \
312     virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const
313 
314 //----------------------------------------------------------------------------------
315 #define IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2( classname , baseclass1)  \
316     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >  SAL_CALL classname::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException)  \
317     {   \
318         Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );    \
319         return xInfo;   \
320     }   \
321     ::cppu::IPropertyArrayHelper& classname::getInfoHelper()    \
322     {   \
323     return *baseclass1::getArrayHelper();   \
324     }   \
325     ::cppu::IPropertyArrayHelper* classname::createArrayHelper( ) const \
326     {   \
327         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps;    \
328         describeProperties(aProps); \
329         return new ::cppu::OPropertyArrayHelper(aProps);    \
330     }
331 //----------------------------------------------------------------------------------
332 #define IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( classname )   \
333     IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2( classname, classname )
334 
335 //==================================================================================
336 //= helper for implementing the createArrayHelper
337 //----------------------------------------------------------------------------------
338 #define BEGIN_PROPERTY_SEQUENCE(count)  \
339     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aDescriptor(count); \
340     ::com::sun::star::beans::Property* pDesc = aDescriptor.getArray();                  \
341     sal_Int32 nPos = 0;                                             \
342 
343 //----------------------------------------------------------------------------------
344 #define BEGIN_PROPERTY_HELPER(count)                            \
345     BEGIN_PROPERTY_SEQUENCE(count)
346 
347 //----------------------------------------------------------------------------------
348 #define DECL_PROP_IMPL(varname, cpputype) \
349     pDesc[nPos++] = ::com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, cpputype,
350 
351 //----------------------------------------------------------------------------------
352 #define DECL_PROP0(varname, type)   \
353     DECL_PROP_IMPL(varname, ::getCppuType((const type *)0)) 0)
354 //----------------------------------------------------------------------------------
355 #define DECL_PROP0_BOOL(varname)    \
356     DECL_PROP_IMPL(varname, ::getBooleanCppuType()) 0)
357 //----------------------------------------------------------------------------------
358 #define DECL_PROP0_IFACE(varname, iface)    \
359     DECL_PROP_IMPL(varname, ::getCppuType(static_cast< ::com::sun::star::uno::Reference< iface >* >(NULL))) 0)
360 
361 //----------------------------------------------------------------------------------
362 #define DECL_PROP1(varname, type, attrib1)  \
363     DECL_PROP_IMPL(varname, ::getCppuType((const type *)0)) ::com::sun::star::beans::PropertyAttribute::attrib1)
364 //----------------------------------------------------------------------------------
365 #define DECL_PROP1_BOOL(varname, attrib1)   \
366     DECL_PROP_IMPL(varname, ::getBooleanCppuType()) ::com::sun::star::beans::PropertyAttribute::attrib1)
367 //----------------------------------------------------------------------------------
368 #define DECL_PROP1_IFACE(varname, iface, attrib1)   \
369     DECL_PROP_IMPL(varname, ::getCppuType(static_cast< ::com::sun::star::uno::Reference< iface >* >(NULL))) ::com::sun::star::beans::PropertyAttribute::attrib1)
370 //----------------------------------------------------------------------------------
371 #define DECL_PROP2_IFACE(varname, iface, attrib1, attrib2)  \
372     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)
373 
374 //----------------------------------------------------------------------------------
375 #define DECL_PROP2(varname, type, attrib1, attrib2) \
376     DECL_PROP_IMPL(varname, ::getCppuType((const type *)0)) ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2)
377 //----------------------------------------------------------------------------------
378 #define DECL_PROP2_BOOL(varname, attrib1, attrib2)  \
379     DECL_PROP_IMPL(varname, ::getBooleanCppuType()) ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2)
380 
381 //----------------------------------------------------------------------------------
382 #define DECL_PROP3(varname, type, attrib1, attrib2, attrib3)    \
383     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)
384 //----------------------------------------------------------------------------------
385 #define DECL_PROP3_BOOL(varname, attrib1, attrib2, attrib3) \
386     DECL_PROP_IMPL(varname, ::getBooleanCppuType()) ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3)
387 
388 
389 //----------------------------------------------------------------------------------
390 #define END_PROPERTY_SEQUENCE()                             \
391     OSL_ENSURE(nPos == aDescriptor.getLength(), "forgot to adjust the count ?");    \
392 
393 //----------------------------------------------------------------------------------
394 #define END_PROPERTY_HELPER()                               \
395     END_PROPERTY_SEQUENCE() \
396     return new ::cppu::OPropertyArrayHelper(aDescriptor);
397 
398 
399 #define NOTIFY_LISTERNERS(_rListeners,T,method)                                   \
400     Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \
401                                                                                   \
402     const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray();     \
403     const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \
404                                                                                   \
405     _rGuard.clear();                                                              \
406     while( pxInt > pxIntBegin )                                                   \
407     {                                                                             \
408         try                                                                       \
409         {                                                                         \
410             while( pxInt > pxIntBegin )                                           \
411             {                                                                     \
412                 --pxInt;                                                          \
413                 static_cast< T* >( pxInt->get() )->method(aEvt);                  \
414             }                                                                     \
415         }                                                                         \
416         catch( RuntimeException& )                                                \
417         {                                                                         \
418         }                                                                         \
419     }                                                                             \
420     _rGuard.reset();
421 
422 #define NOTIFY_LISTERNERS1(_rListeners,T,method,arg1)                             \
423     Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \
424                                                                                   \
425     const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray();     \
426     const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \
427                                                                                   \
428     _rGuard.clear();                                                              \
429     while( pxInt > pxIntBegin )                                                   \
430     {                                                                             \
431         try                                                                       \
432         {                                                                         \
433             while( pxInt > pxIntBegin )                                           \
434             {                                                                     \
435                 --pxInt;                                                          \
436                 static_cast< T* >( pxInt->get() )->method(aEvt,arg1);             \
437             }                                                                     \
438         }                                                                         \
439         catch( RuntimeException& )                                                \
440         {                                                                         \
441         }                                                                         \
442     }                                                                             \
443     _rGuard.reset();
444 
445 
446 //==================================================================================
447 // miscellaneous
448 #define UNUSED(x)   x;
449 
450 #endif // _DBASHARED_APITOOLS_HXX_
451 
452