fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / sfx2 / sfxuno.hxx
blob6b0a2763497e52bfa1f22a7031c764f19308025e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SFX_SFXUNO_HXX
21 #define _SFX_SFXUNO_HXX
23 #include "sal/config.h"
24 #include "sfx2/dllapi.h"
25 #include <com/sun/star/uno/Exception.hpp>
26 #include <com/sun/star/beans/PropertyValue.hpp>
27 #include <com/sun/star/util/URL.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
30 #include <com/sun/star/lang/XTypeProvider.hpp>
31 #include <com/sun/star/task/ErrorCodeIOException.hpp>
32 #include <com/sun/star/beans/NamedValue.hpp>
34 #include <com/sun/star/uno/Type.h>
35 #include <com/sun/star/uno/Any.h>
36 #include <com/sun/star/uno/Reference.h>
37 #include <com/sun/star/uno/Sequence.hxx>
38 #include <cppuhelper/typeprovider.hxx>
39 #include <cppuhelper/queryinterface.hxx>
40 #include <cppuhelper/factory.hxx>
42 #include <osl/mutex.hxx>
43 #include <rtl/ustring.hxx>
46 inline sal_Bool operator==( const css::util::URL& aURL1, const css::util::URL& aURL2 )
48 return aURL1.Complete == aURL2.Complete;
51 class SfxAllItemSet ;
52 class SfxItemSet ;
53 class SfxSlot ;
55 SFX2_DLLPUBLIC void TransformParameters( sal_uInt16 nSlotId ,
56 const css::uno::Sequence< css::beans::PropertyValue >& seqArgs ,
57 SfxAllItemSet& aSet ,
58 const SfxSlot* pSlot = 0 );
60 SFX2_DLLPUBLIC void TransformItems( sal_uInt16 nSlotId ,
61 const SfxItemSet& aSet ,
62 css::uno::Sequence< css::beans::PropertyValue >& seqArgs ,
63 const SfxSlot* pSlot = 0 );
65 bool GetEncryptionData_Impl( const SfxItemSet* pSet, css::uno::Sequence< css::beans::NamedValue >& aEncryptionData );
67 #define FrameSearchFlags sal_Int32
69 // Macros to convert string -> unicode and unicode -> string.
70 // We use UTF8 everytime. Its the best way to do this!
71 #define S2U(STRING) OStringToOUString(STRING, RTL_TEXTENCODING_UTF8)
72 #define U2S(STRING) OUStringToOString(STRING, RTL_TEXTENCODING_UTF8)
74 //________________________________________________________________________________________________________________________
75 // macros for declaration and definition of uno-services
76 //________________________________________________________________________________________________________________________
78 //************************************************************************************************************************
79 // declaration of XInterface::queryInterface()
80 // XInterface::aquire()
81 // XInterface::release()
82 // XTypeProvider::getTypes()
83 // XTypeProvider::getImplementationId()
84 //************************************************************************************************************************
85 #define SFX_DECL_XINTERFACE \
86 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw( css::uno::RuntimeException ); \
87 virtual void SAL_CALL acquire() throw(); \
88 virtual void SAL_CALL release() throw();
90 #define SFX_DECL_XTYPEPROVIDER \
91 /* XTypeProvider */ \
92 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw( css::uno::RuntimeException ); \
93 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException );
95 #define SFX_DECL_XINTERFACE_XTYPEPROVIDER \
96 SFX_DECL_XINTERFACE \
97 SFX_DECL_XTYPEPROVIDER
99 //************************************************************************************************************************
100 // declaration of XInterface::queryInterface()
101 // XInterface::aquire()
102 // XInterface::release()
103 // XTypeProvider::getTypes()
104 // XTypeProvider::getImplementationId()
105 // XServiceInfo::getImplementationName()
106 // XServiceInfo::supportsService()
107 // XServiceInfo::getSupportedServiceNames()
108 // static xxx::impl_getStaticSupportedServiceNames()
109 // static xxx::impl_getStaticImplementationName()
110 // static xxx::impl_createInstance()
111 //************************************************************************************************************************
112 #define SFX_DECL_XSERVICEINFO_NOFACTORY \
113 /* XServiceInfo */ \
114 virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); \
115 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ); \
116 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); \
118 /* Helper for XServiceInfo */ \
119 static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames(); \
120 static OUString impl_getStaticImplementationName(); \
122 /* Helper for registry */ \
123 static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception );
125 //************************************************************************************************************************
126 // declaration of XInterface::queryInterface()
127 // XInterface::aquire()
128 // XInterface::release()
129 // XTypeProvider::getTypes()
130 // XTypeProvider::getImplementationId()
131 // XServiceInfo::getImplementationName()
132 // XServiceInfo::supportsService()
133 // XServiceInfo::getSupportedServiceNames()
134 // static xxx::impl_getStaticSupportedServiceNames()
135 // static xxx::impl_getStaticImplementationName()
136 // static xxx::impl_createInstance()
137 // static xxx::impl_createFactory()
138 //************************************************************************************************************************
139 #define SFX_DECL_XSERVICEINFO \
140 SFX_DECL_XSERVICEINFO_NOFACTORY \
141 static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
143 #define SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO \
145 /* XInterface + XTypeProvider */ \
146 SFX_DECL_XINTERFACE_XTYPEPROVIDER \
147 SFX_DECL_XSERVICEINFO
149 //************************************************************************************************************************
150 // implementation of XInterface::queryInterface()
151 // XInterface::aquire()
152 // XInterface::release()
153 //************************************************************************************************************************
154 /*_________________________________________________________________________________________________________________________*/
155 // DON'T USE FOLLOW MACROS DIRECTLY!!!
156 #define SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, IMPLINTERFACES ) \
158 void SAL_CALL IMPLCLASS::acquire() throw() \
160 /* Don't use mutex in methods of XInterface! */ \
161 BASECLASS::acquire(); \
164 void SAL_CALL IMPLCLASS::release() throw() \
166 /* Don't use mutex in methods of XInterface! */ \
167 BASECLASS::release(); \
170 css::uno::Any SAL_CALL IMPLCLASS::queryInterface( const css::uno::Type& rType ) throw( css::uno::RuntimeException ) \
172 /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \
173 /* Ask for my own supported interfaces ... */ \
174 css::uno::Any aReturn ( ::cppu::queryInterface( rType, \
175 IMPLINTERFACES \
177 ); \
178 /* If searched interface supported by this class ... */ \
179 if ( aReturn.hasValue() == sal_True ) \
181 /* ... return this information. */ \
182 return aReturn ; \
184 else \
186 /* Else; ... ask baseclass for interfaces! */ \
187 return BASECLASS::queryInterface( rType ); \
191 #define SFX_IMPL_INTERFACE_0 \
192 static_cast< css::lang::XTypeProvider* >( this )
194 #define SFX_IMPL_INTERFACE_1( INTERFACE1 ) \
195 SFX_IMPL_INTERFACE_0, \
196 static_cast< INTERFACE1* >( this )
198 #define SFX_IMPL_INTERFACE_2( INTERFACE1, INTERFACE2 ) \
199 SFX_IMPL_INTERFACE_1( INTERFACE1 ), \
200 static_cast< INTERFACE2* >( this )
202 #define SFX_IMPL_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ) \
203 SFX_IMPL_INTERFACE_2( INTERFACE1, INTERFACE2 ), \
204 static_cast< INTERFACE3* >( this )
206 #define SFX_IMPL_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \
207 SFX_IMPL_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ), \
208 static_cast< INTERFACE4* >( this )
210 #define SFX_IMPL_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \
211 SFX_IMPL_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ), \
212 static_cast< INTERFACE5* >( this )
214 #define SFX_IMPL_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \
215 SFX_IMPL_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ), \
216 static_cast< INTERFACE6* >( this )
218 #define SFX_IMPL_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \
219 SFX_IMPL_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ), \
220 static_cast< INTERFACE7* >( this )
222 #define SFX_IMPL_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \
223 SFX_IMPL_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ), \
224 static_cast< INTERFACE8* >( this )
226 #define SFX_IMPL_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \
227 SFX_IMPL_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ), \
228 static_cast< INTERFACE9* >( this )
230 #define SFX_IMPL_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \
231 SFX_IMPL_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ), \
232 static_cast< INTERFACE10* >( this )
234 #define SFX_IMPL_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \
235 SFX_IMPL_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ), \
236 static_cast< INTERFACE11* >( this )
238 #define SFX_IMPL_INTERFACE_12( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) \
239 SFX_IMPL_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ), \
240 static_cast< INTERFACE12* >( this )
242 #define SFX_IMPL_INTERFACE_13( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) \
243 SFX_IMPL_INTERFACE_12( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ), \
244 static_cast< INTERFACE13* >( this )
245 /*_________________________________________________________________________________________________________________________*/
247 // Follow macros can used directly :-)
248 // implementation of XInterface with 0 additional interface for queryInterface()
249 #define SFX_IMPL_XINTERFACE_0( IMPLCLASS, BASECLASS ) \
250 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_0 )
252 // implementation of XInterface with 1 additional interface for queryInterface()
253 #define SFX_IMPL_XINTERFACE_1( IMPLCLASS, BASECLASS, INTERFACE1 ) \
254 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_1( INTERFACE1 ) )
256 // implementation of XInterface with 2 additional interfaces for queryInterface()
257 #define SFX_IMPL_XINTERFACE_2( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2 ) \
258 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_2( INTERFACE1, INTERFACE2 ) )
260 // implementation of XInterface with 3 additional interfaces for queryInterface()
261 #define SFX_IMPL_XINTERFACE_3( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3 ) \
262 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ) )
264 // implementation of XInterface with 4 additional interfaces for queryInterface()
265 #define SFX_IMPL_XINTERFACE_4( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \
266 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) )
268 // implementation of XInterface with 5 additional interfaces for queryInterface()
269 #define SFX_IMPL_XINTERFACE_5( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \
270 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) )
272 // implementation of XInterface with 6 additional interfaces for queryInterface()
273 #define SFX_IMPL_XINTERFACE_6( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \
274 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) )
276 // implementation of XInterface with 7 additional interfaces for queryInterface()
277 #define SFX_IMPL_XINTERFACE_7( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \
278 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) )
280 // implementation of XInterface with 8 additional interfaces for queryInterface()
281 #define SFX_IMPL_XINTERFACE_8( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \
282 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) )
284 // implementation of XInterface with 9 additional interfaces for queryInterface()
285 #define SFX_IMPL_XINTERFACE_9( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \
286 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) )
288 // implementation of XInterface with 10 additional interfaces for queryInterface()
289 #define SFX_IMPL_XINTERFACE_10( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \
290 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) )
292 // implementation of XInterface with 11 additional interfaces for queryInterface()
293 #define SFX_IMPL_XINTERFACE_11( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \
294 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) )
296 // implementation of XInterface with 11 additional interfaces for queryInterface()
297 #define SFX_IMPL_XINTERFACE_12( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) \
298 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_12( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) )
300 // implementation of XInterface with 11 additional interfaces for queryInterface()
301 #define SFX_IMPL_XINTERFACE_13( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) \
302 SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_13( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) )
304 //************************************************************************************************************************
305 // implementation of XTypeProvider::getTypes()
306 // XTypeProvider::getImplementationId()
307 //************************************************************************************************************************
308 /*_________________________________________________________________________________________________________________________*/
309 // DON'T USE FOLLOW MACROS DIRECTLY!!!
310 #define SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, IMPLTYPES ) \
312 css::uno::Sequence< sal_Int8 > SAL_CALL IMPLCLASS::getImplementationId() throw( css::uno::RuntimeException ) \
314 /* Create one Id for all instances of this class. */ \
315 /* Use ethernet address to do this! (sal_True) */ \
316 /* Optimize this method */ \
317 /* We initialize a static variable only one time. And we don't must use a mutex at every call! */ \
318 /* For the first call; pID is NULL - for the second call pID is different from NULL! */ \
319 static ::cppu::OImplementationId* pID = NULL ; \
320 if ( pID == NULL ) \
322 /* Ready for multithreading; get global mutex for first call of this method only! see before */ \
323 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
324 /* Control these pointer again ... it can be, that another instance will be faster then these! */ \
325 if ( pID == NULL ) \
327 /* Create a new static ID ... */ \
328 static ::cppu::OImplementationId aID( sal_False ); \
329 /* ... and set his address to static pointer! */ \
330 pID = &aID ; \
333 return pID->getImplementationId(); \
336 css::uno::Sequence< css::uno::Type > SAL_CALL IMPLCLASS::getTypes() throw( css::uno::RuntimeException ) \
338 /* Optimize this method ! */ \
339 /* We initialize a static variable only one time. And we don't must use a mutex at every call! */ \
340 /* For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!*/ \
341 static ::cppu::OTypeCollection* pTypeCollection = NULL ; \
342 if ( pTypeCollection == NULL ) \
344 /* Ready for multithreading; get global mutex for first call of this method only! see before */ \
345 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
346 /* Control these pointer again ... it can be, that another instance will be faster then these! */ \
347 if ( pTypeCollection == NULL ) \
349 /* Create a static typecollection ... */ \
350 static ::cppu::OTypeCollection aTypeCollection( IMPLTYPES ); \
351 /* ... and set his address to static pointer! */ \
352 pTypeCollection = &aTypeCollection ; \
355 return pTypeCollection->getTypes(); \
358 #define SFX_IMPL_TYPE_0 \
359 ::getCppuType(( const css::uno::Reference< css::lang::XTypeProvider >*)NULL )
361 #define SFX_IMPL_TYPE_1( TYPE1 ) \
362 SFX_IMPL_TYPE_0, \
363 ::getCppuType(( const css::uno::Reference< TYPE1 >*)NULL )
365 #define SFX_IMPL_TYPE_2( TYPE1, TYPE2 ) \
366 SFX_IMPL_TYPE_1( TYPE1 ), \
367 ::getCppuType(( const css::uno::Reference< TYPE2 >*)NULL )
369 #define SFX_IMPL_TYPE_3( TYPE1, TYPE2, TYPE3 ) \
370 SFX_IMPL_TYPE_2( TYPE1, TYPE2 ), \
371 ::getCppuType(( const css::uno::Reference< TYPE3 >*)NULL )
373 #define SFX_IMPL_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ) \
374 SFX_IMPL_TYPE_3( TYPE1, TYPE2, TYPE3 ), \
375 ::getCppuType(( const css::uno::Reference< TYPE4 >*)NULL )
377 #define SFX_IMPL_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \
378 SFX_IMPL_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ), \
379 ::getCppuType(( const css::uno::Reference< TYPE5 >*)NULL )
381 #define SFX_IMPL_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \
382 SFX_IMPL_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ), \
383 ::getCppuType(( const css::uno::Reference< TYPE6 >*)NULL )
385 #define SFX_IMPL_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \
386 SFX_IMPL_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ), \
387 ::getCppuType(( const css::uno::Reference< TYPE7 >*)NULL )
389 #define SFX_IMPL_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \
390 SFX_IMPL_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ), \
391 ::getCppuType(( const css::uno::Reference< TYPE8 >*)NULL )
393 #define SFX_IMPL_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \
394 SFX_IMPL_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ), \
395 ::getCppuType(( const css::uno::Reference< TYPE9 >*)NULL )
397 #define SFX_IMPL_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \
398 SFX_IMPL_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ), \
399 ::getCppuType(( const css::uno::Reference< TYPE10 >*)NULL )
401 #define SFX_IMPL_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \
402 SFX_IMPL_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ), \
403 ::getCppuType(( const css::uno::Reference< TYPE11 >*)NULL )
405 #define SFX_IMPL_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \
406 SFX_IMPL_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ), \
407 ::getCppuType(( const css::uno::Reference< TYPE12 >*)NULL )
409 #define SFX_IMPL_TYPE_13( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \
410 SFX_IMPL_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ), \
411 ::getCppuType(( const css::uno::Reference< TYPE13 >*)NULL )
412 /*_________________________________________________________________________________________________________________________*/
414 // FOLLOW MACROS CAN USED DIRECTLY :-)
416 // implementation of XInterface with 1 additional interface for queryInterface()
417 #define SFX_IMPL_XTYPEPROVIDER_0( IMPLCLASS ) \
418 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_0 )
420 // implementation of XInterface with 1 additional interface for queryInterface()
421 #define SFX_IMPL_XTYPEPROVIDER_1( IMPLCLASS, TYPE1 ) \
422 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_1( TYPE1 ) )
424 // implementation of XInterface with 2 additional interfaces for queryInterface()
425 #define SFX_IMPL_XTYPEPROVIDER_2( IMPLCLASS, TYPE1, TYPE2 ) \
426 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_2( TYPE1, TYPE2 ) )
428 // implementation of XInterface with 3 additional interfaces for queryInterface()
429 #define SFX_IMPL_XTYPEPROVIDER_3( IMPLCLASS, TYPE1, TYPE2, TYPE3 ) \
430 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_3( TYPE1, TYPE2, TYPE3 ) )
432 // implementation of XInterface with 4 additional interfaces for queryInterface()
433 #define SFX_IMPL_XTYPEPROVIDER_4( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4 ) \
434 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ) )
436 // implementation of XInterface with 5 additional interfaces for queryInterface()
437 #define SFX_IMPL_XTYPEPROVIDER_5( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \
438 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) )
440 // implementation of XInterface with 6 additional interfaces for queryInterface()
441 #define SFX_IMPL_XTYPEPROVIDER_6( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \
442 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) )
444 // implementation of XInterface with 7 additional interfaces for queryInterface()
445 #define SFX_IMPL_XTYPEPROVIDER_7( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \
446 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) )
448 // implementation of XInterface with 8 additional interfaces for queryInterface()
449 #define SFX_IMPL_XTYPEPROVIDER_8( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \
450 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) )
452 // implementation of XInterface with 9 additional interfaces for queryInterface()
453 #define SFX_IMPL_XTYPEPROVIDER_9( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \
454 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) )
456 // implementation of XInterface with 10 additional interfaces for queryInterface()
457 #define SFX_IMPL_XTYPEPROVIDER_10( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \
458 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) )
460 // implementation of XInterface with 11 additional interfaces for queryInterface()
461 #define SFX_IMPL_XTYPEPROVIDER_11( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \
462 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) )
464 // implementation of XInterface with 11 additional interfaces for queryInterface()
465 #define SFX_IMPL_XTYPEPROVIDER_12( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \
466 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) )
468 // implementation of XInterface with 11 additional interfaces for queryInterface()
469 #define SFX_IMPL_XTYPEPROVIDER_13( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \
470 SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_13( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) )
472 //************************************************************************************************************************
473 // implementation of XServiceInfo::getImplementationName()
474 // XServiceInfo::supportsService()
475 // XServiceInfo::getSupportedServiceNames()
476 // static xxx::impl_getStaticSupportedServiceNames()
477 // static xxx::impl_getStaticImplementationName()
478 // static xxx::impl_createInstance()
479 //************************************************************************************************************************
480 #define SFX_IMPL_XSERVICEINFO( IMPLCLASS, IMPLSERVICENAME, IMPLNAME ) \
482 /* XServiceInfo */ \
483 OUString SAL_CALL IMPLCLASS::getImplementationName() throw( css::uno::RuntimeException ) \
485 return impl_getStaticImplementationName(); \
488 /* XServiceInfo */ \
489 sal_Bool SAL_CALL IMPLCLASS::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ) \
491 css::uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames(); \
492 const OUString* pArray = seqServiceNames.getConstArray(); \
493 for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ ) \
495 if ( pArray[nCounter] == sServiceName ) \
497 return sal_True ; \
500 return sal_False ; \
503 /* XServiceInfo */ \
504 css::uno::Sequence< OUString > SAL_CALL IMPLCLASS::getSupportedServiceNames() throw( css::uno::RuntimeException ) \
506 return impl_getStaticSupportedServiceNames(); \
509 /* Helper for XServiceInfo */ \
510 css::uno::Sequence< OUString > IMPLCLASS::impl_getStaticSupportedServiceNames() \
512 css::uno::Sequence< OUString > seqServiceNames( 1 ); \
513 seqServiceNames.getArray() [0] = OUString::createFromAscii( IMPLSERVICENAME ); \
514 return seqServiceNames ; \
517 /* Helper for XServiceInfo */ \
518 OUString IMPLCLASS::impl_getStaticImplementationName() \
520 return OUString::createFromAscii( IMPLNAME ); \
523 /* Helper for registry */ \
524 css::uno::Reference< css::uno::XInterface > SAL_CALL IMPLCLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) \
526 return css::uno::Reference< css::uno::XInterface >( *new IMPLCLASS( xServiceManager ) ); \
529 //************************************************************************************************************************
530 // implementation of XServiceInfo::getImplementationName()
531 // XServiceInfo::supportsService()
532 // XServiceInfo::getSupportedServiceNames()
533 // static xxx::impl_getStaticSupportedServiceNames()
534 // static xxx::impl_getStaticImplementationName()
535 // static xxx::impl_createInstance()
536 //************************************************************************************************************************
537 #define SFX_IMPL_XSERVICEINFO_CTX( IMPLCLASS, IMPLSERVICENAME, IMPLNAME ) \
539 /* XServiceInfo */ \
540 OUString SAL_CALL IMPLCLASS::getImplementationName() throw( css::uno::RuntimeException ) \
542 return impl_getStaticImplementationName(); \
545 /* XServiceInfo */ \
546 sal_Bool SAL_CALL IMPLCLASS::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ) \
548 css::uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames(); \
549 const OUString* pArray = seqServiceNames.getConstArray(); \
550 for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ ) \
552 if ( pArray[nCounter] == sServiceName ) \
554 return sal_True ; \
557 return sal_False ; \
560 /* XServiceInfo */ \
561 css::uno::Sequence< OUString > SAL_CALL IMPLCLASS::getSupportedServiceNames() throw( css::uno::RuntimeException ) \
563 return impl_getStaticSupportedServiceNames(); \
566 /* Helper for XServiceInfo */ \
567 css::uno::Sequence< OUString > IMPLCLASS::impl_getStaticSupportedServiceNames() \
569 css::uno::Sequence< OUString > seqServiceNames( 1 ); \
570 seqServiceNames.getArray() [0] = OUString::createFromAscii( IMPLSERVICENAME ); \
571 return seqServiceNames ; \
574 /* Helper for XServiceInfo */ \
575 OUString IMPLCLASS::impl_getStaticImplementationName() \
577 return OUString::createFromAscii( IMPLNAME ); \
580 /* Helper for registry */ \
581 css::uno::Reference< css::uno::XInterface > SAL_CALL IMPLCLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) \
583 return css::uno::Reference< css::uno::XInterface >( *new IMPLCLASS( comphelper::getComponentContext(xServiceManager) ) ); \
586 //************************************************************************************************************************
587 // definition of createFactory() for MultiServices
588 //************************************************************************************************************************
589 #define SFX_IMPL_SINGLEFACTORY( IMPLCLASS ) \
591 css::uno::Reference< css::lang::XSingleServiceFactory > IMPLCLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \
593 css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( \
594 cppu::createSingleFactory( xServiceManager , \
595 IMPLCLASS::impl_getStaticImplementationName() , \
596 IMPLCLASS::impl_createInstance , \
597 IMPLCLASS::impl_getStaticSupportedServiceNames() ) \
598 ); \
599 return xReturn ; \
602 //************************************************************************************************************************
603 // definition of createFactory() for OneInstance-Services
604 //************************************************************************************************************************
605 #define SFX_IMPL_ONEINSTANCEFACTORY( IMPLCLASS ) \
607 css::uno::Reference< css::lang::XSingleServiceFactory > IMPLCLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \
609 css::uno::Reference< css::lang::XSingleServiceFactory > xReturn( \
610 cppu::createOneInstanceFactory( xServiceManager , \
611 IMPLCLASS::impl_getStaticImplementationName() , \
612 IMPLCLASS::impl_createInstance , \
613 IMPLCLASS::impl_getStaticSupportedServiceNames() ) \
614 ); \
615 return xReturn ; \
618 //************************************************************************************************************************
619 // definition for "extern c sfx_component_getFactory()"
620 //************************************************************************************************************************
621 #define CREATEFACTORY(CLASS) \
623 /* Create right factory ... */ \
624 xFactory = CLASS::impl_createFactory( xServiceManager );
626 //************************************************************************************************************************
627 // definition for "extern c sfx_component_getFactory()"
628 //************************************************************************************************************************
629 #define IF_NAME_CREATECOMPONENTFACTORY(CLASS) \
631 if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
633 CREATEFACTORY ( CLASS ) \
636 #endif // _SFX_SFXUNO_HXX
638 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */