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