xref: /trunk/main/sd/source/ui/unoidl/facreg.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 #include <com/sun/star/registry/XRegistryKey.hpp>
31 
32 #include "sddll.hxx"
33 
34 #include <cppuhelper/factory.hxx>
35 #include <uno/lbnames.h>
36 #include <sfx2/sfxmodelfactory.hxx>
37 #include "osl/diagnose.h"
38 #include "sal/types.h"
39 
40 #ifndef INCLUDED_STRING_H
41 #include <string.h>
42 #define INCLUDED_STRING_H
43 #endif
44 #include <comphelper/stl_types.hxx>
45 #include <hash_map>
46 #include <boost/shared_ptr.hpp>
47 
48 using namespace rtl;
49 using namespace com::sun::star;
50 
51 
52 // Forward declarations of the factories.
53 
54 extern uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory, const sal_uInt64 _nCreationFlags );
55 extern OUString SdDrawingDocument_getImplementationName() throw( uno::RuntimeException );
56 extern uno::Sequence< OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames() throw( uno::RuntimeException );
57 
58 extern uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory, const sal_uInt64 _nCreationFlags );
59 extern OUString SdPresentationDocument_getImplementationName() throw( uno::RuntimeException );
60 extern uno::Sequence< OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames() throw( uno::RuntimeException );
61 
62 extern uno::Reference< uno::XInterface > SAL_CALL SdHtmlOptionsDialog_CreateInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
63 extern OUString SdHtmlOptionsDialog_getImplementationName() throw( uno::RuntimeException );
64 extern uno::Sequence< OUString > SAL_CALL SdHtmlOptionsDialog_getSupportedServiceNames() throw( uno::RuntimeException );
65 
66 extern uno::Reference< uno::XInterface > SAL_CALL SdUnoModule_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
67 extern OUString SdUnoModule_getImplementationName() throw( uno::RuntimeException );
68 extern uno::Sequence< OUString > SAL_CALL SdUnoModule_getSupportedServiceNames() throw( uno::RuntimeException );
69 
70 namespace sd
71 {
72 extern uno::Reference< uno::XInterface > SAL_CALL RandomNode_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
73 extern OUString RandomNode__getImplementationName() throw( uno::RuntimeException );
74 extern uno::Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( uno::RuntimeException );
75 
76 extern uno::Reference< uno::XInterface > SAL_CALL SlideLayoutController_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
77 extern OUString SlideLayoutController_getImplementationName() throw( uno::RuntimeException );
78 extern uno::Sequence< OUString >  SlideLayoutController_getSupportedServiceNames() throw( uno::RuntimeException );
79 
80 extern uno::Reference< uno::XInterface > SAL_CALL InsertSlideController_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory );
81 extern OUString InsertSlideController_getImplementationName() throw( uno::RuntimeException );
82 extern uno::Sequence< OUString >  InsertSlideController_getSupportedServiceNames() throw( uno::RuntimeException );
83 }
84 
85 namespace sd { namespace framework {
86 
87 extern uno::Reference<uno::XInterface> SAL_CALL Configuration_createInstance(
88     const uno::Reference<uno::XComponentContext>& rxContext)
89     throw(uno::Exception);
90 extern OUString Configuration_getImplementationName(void) throw (uno::RuntimeException);
91 extern uno::Sequence<OUString> SAL_CALL Configuration_getSupportedServiceNames (void)
92     throw (uno::RuntimeException);
93 
94 extern uno::Reference<uno::XInterface> SAL_CALL ConfigurationController_createInstance(
95     const uno::Reference<uno::XComponentContext>& rxContext)
96     throw(uno::Exception);
97 extern OUString ConfigurationController_getImplementationName(void) throw (uno::RuntimeException);
98 extern uno::Sequence<OUString> SAL_CALL ConfigurationController_getSupportedServiceNames (void)
99     throw (uno::RuntimeException);
100 
101 extern uno::Reference<uno::XInterface> SAL_CALL ModuleController_createInstance(
102     const uno::Reference<uno::XComponentContext>& rxContext)
103     throw(uno::Exception);
104 extern OUString ModuleController_getImplementationName(void) throw (uno::RuntimeException);
105 extern uno::Sequence<OUString> SAL_CALL ModuleController_getSupportedServiceNames (void)
106     throw (uno::RuntimeException);
107 
108 extern uno::Reference<uno::XInterface> SAL_CALL BasicPaneFactory_createInstance(
109     const uno::Reference<uno::XComponentContext>& rxContext)
110     throw(uno::Exception);
111 extern OUString BasicPaneFactory_getImplementationName(void) throw (uno::RuntimeException);
112 extern uno::Sequence<OUString> SAL_CALL BasicPaneFactory_getSupportedServiceNames (void)
113     throw (uno::RuntimeException);
114 
115 extern uno::Reference<uno::XInterface> SAL_CALL BasicToolBarFactory_createInstance(
116     const uno::Reference<uno::XComponentContext>& rxContext)
117     throw(uno::Exception);
118 extern OUString BasicToolBarFactory_getImplementationName(void) throw (uno::RuntimeException);
119 extern uno::Sequence<OUString> SAL_CALL BasicToolBarFactory_getSupportedServiceNames (void)
120     throw (uno::RuntimeException);
121 
122 extern uno::Reference<uno::XInterface> SAL_CALL BasicViewFactory_createInstance(
123     const uno::Reference<uno::XComponentContext>& rxContext)
124     throw(uno::Exception);
125 extern OUString BasicViewFactory_getImplementationName(void) throw (uno::RuntimeException);
126 extern uno::Sequence<OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void)
127     throw (uno::RuntimeException);
128 
129 extern uno::Reference<uno::XInterface> SAL_CALL TaskPanelFactory_createInstance(
130     const uno::Reference<uno::XComponentContext>& rxContext)
131     throw(uno::Exception);
132 extern OUString TaskPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
133 extern uno::Sequence<OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
134     throw (uno::RuntimeException);
135 
136 extern uno::Reference<uno::XInterface> SAL_CALL ResourceId_createInstance(
137     const uno::Reference<uno::XComponentContext>& rxContext)
138     throw(uno::Exception);
139 extern OUString ResourceId_getImplementationName(void) throw (uno::RuntimeException);
140 extern uno::Sequence<OUString> SAL_CALL ResourceId_getSupportedServiceNames (void)
141     throw (uno::RuntimeException);
142 
143 extern uno::Reference<uno::XInterface> SAL_CALL PresentationFactoryProvider_createInstance(
144     const uno::Reference<uno::XComponentContext>& rxContext)
145     throw(uno::Exception);
146 extern OUString PresentationFactoryProvider_getImplementationName(void)
147     throw (uno::RuntimeException);
148 extern uno::Sequence<OUString> SAL_CALL PresentationFactoryProvider_getSupportedServiceNames (void)
149     throw (uno::RuntimeException);
150 } }
151 
152 
153 namespace sd { namespace toolpanel {
154 
155 extern uno::Reference<uno::XInterface> SAL_CALL ToolPanelFactory_createInstance(
156     const uno::Reference<uno::XComponentContext>& rxContext)
157     throw(uno::Exception);
158 extern OUString ToolPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
159 extern uno::Sequence<OUString> SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
160     throw (uno::RuntimeException);
161 
162 } }
163 
164 namespace sd { namespace presenter {
165 extern uno::Reference<uno::XInterface> SAL_CALL SlideRenderer_createInstance(
166     const uno::Reference<uno::XComponentContext>& rxContext)
167     throw(uno::Exception);
168 extern OUString SlideRenderer_getImplementationName(void)
169     throw (uno::RuntimeException);
170 extern uno::Sequence<OUString> SAL_CALL SlideRenderer_getSupportedServiceNames (void)
171     throw (uno::RuntimeException);
172 
173 extern uno::Reference<uno::XInterface> SAL_CALL PresenterCanvas_createInstance(
174     const uno::Reference<uno::XComponentContext>& rxContext)
175     throw(uno::Exception);
176 extern OUString PresenterCanvas_getImplementationName(void)
177     throw (uno::RuntimeException);
178 extern uno::Sequence<OUString> SAL_CALL PresenterCanvas_getSupportedServiceNames (void)
179     throw (uno::RuntimeException);
180 
181 extern uno::Reference<uno::XInterface> SAL_CALL PresenterTextViewService_createInstance(
182     const uno::Reference<uno::XComponentContext>& rxContext)
183     throw(uno::Exception);
184 extern OUString PresenterTextViewService_getImplementationName(void)
185     throw (uno::RuntimeException);
186 extern uno::Sequence<OUString> SAL_CALL PresenterTextViewService_getSupportedServiceNames (void)
187     throw (uno::RuntimeException);
188 
189 extern uno::Reference<uno::XInterface> SAL_CALL PresenterHelperService_createInstance(
190     const uno::Reference<uno::XComponentContext>& rxContext)
191     throw(uno::Exception);
192 extern OUString PresenterHelperService_getImplementationName(void)
193     throw (uno::RuntimeException);
194 extern uno::Sequence<OUString> SAL_CALL PresenterHelperService_getSupportedServiceNames (void)
195     throw (uno::RuntimeException);
196 
197 extern uno::Reference<uno::XInterface> SAL_CALL PresenterPreviewCache_createInstance(
198     const uno::Reference<uno::XComponentContext>& rxContext)
199     throw(uno::Exception);
200 extern OUString PresenterPreviewCache_getImplementationName(void)
201     throw (uno::RuntimeException);
202 extern uno::Sequence<OUString> SAL_CALL PresenterPreviewCache_getSupportedServiceNames (void)
203     throw (uno::RuntimeException);
204 } }
205 
206 
207 namespace sd { namespace slidesorter {
208 extern uno::Reference<uno::XInterface> SAL_CALL SlideSorterService_createInstance(
209     const uno::Reference<uno::XComponentContext>& rxContext)
210     throw(uno::Exception);
211 extern OUString SlideSorterService_getImplementationName(void)
212     throw (uno::RuntimeException);
213 extern uno::Sequence<OUString> SAL_CALL SlideSorterService_getSupportedServiceNames (void)
214     throw (uno::RuntimeException);
215 } }
216 
217 using namespace ::sd;
218 using namespace ::sd::framework;
219 using namespace ::sd::presenter;
220 using namespace ::sd::slidesorter;
221 using namespace ::sd::toolpanel;
222 
223 
224 
225 
226 // ----------------------------------------------------------------------------
227 // Declaration and initialization of a map from service names to locally
228 // unique factory identifiers.
229 
230 enum FactoryId
231 {
232     SdDrawingDocumentFactoryId,
233     SdPresentationDocumentFactoryId,
234     SdHtmlOptionsDialogFactoryId,
235     SdUnoModuleFactoryId,
236     RandomNodeFactoryId,
237 
238     ConfigurationFactoryId,
239     ConfigurationControllerFactoryId,
240     ModuleControllerFactoryId,
241     BasicPaneFactoryFactoryId,
242     BasicToolBarFactoryFactoryId,
243     BasicViewFactoryFactoryId,
244     TaskPanelFactoryFactoryId,
245     ToolPanelFactoryFactoryId,
246     ResourceIdFactoryId,
247     PresentationFactoryProviderFactoryId,
248     SlideRendererFactoryId,
249     PresenterCanvasFactoryId,
250     PresenterTextViewServiceFactoryId,
251     PresenterHelperServiceFactoryId,
252     PresenterPreviewCacheFactoryId,
253     SlideSorterServiceFactoryId,
254 	SlideLayoutControllerFactoryId,
255 	InsertSlideControllerFactoryId,
256 };
257 typedef ::std::hash_map<OUString, FactoryId, comphelper::UStringHash, comphelper::UStringEqual> FactoryMap;
258 
259 
260 namespace {
261 static ::boost::shared_ptr<FactoryMap> spFactoryMap;
262 ::boost::shared_ptr<FactoryMap> GetFactoryMap (void)
263 {
264     if (spFactoryMap.get() == NULL)
265     {
266         spFactoryMap.reset(new FactoryMap);
267         (*spFactoryMap)[SdDrawingDocument_getImplementationName()] = SdDrawingDocumentFactoryId;
268         (*spFactoryMap)[SdPresentationDocument_getImplementationName()] = SdPresentationDocumentFactoryId;
269         (*spFactoryMap)[SdHtmlOptionsDialog_getImplementationName()] = SdHtmlOptionsDialogFactoryId;
270         (*spFactoryMap)[SdUnoModule_getImplementationName()] = SdUnoModuleFactoryId;
271         (*spFactoryMap)[RandomNode__getImplementationName()] = RandomNodeFactoryId;
272         (*spFactoryMap)[Configuration_getImplementationName()] = ConfigurationFactoryId;
273         (*spFactoryMap)[ConfigurationController_getImplementationName()] = ConfigurationControllerFactoryId;
274         (*spFactoryMap)[ModuleController_getImplementationName()] = ModuleControllerFactoryId;
275         (*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId;
276         (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId;
277         (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId;
278         (*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId;
279         (*spFactoryMap)[ToolPanelFactory_getImplementationName()] = ToolPanelFactoryFactoryId;
280         (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId;
281         (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId;
282         (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId;
283         (*spFactoryMap)[PresenterCanvas_getImplementationName()] = PresenterCanvasFactoryId;
284         (*spFactoryMap)[PresenterTextViewService_getImplementationName()] = PresenterTextViewServiceFactoryId;
285         (*spFactoryMap)[PresenterHelperService_getImplementationName()] = PresenterHelperServiceFactoryId;
286         (*spFactoryMap)[PresenterPreviewCache_getImplementationName()] = PresenterPreviewCacheFactoryId;
287         (*spFactoryMap)[SlideSorterService_getImplementationName()] = SlideSorterServiceFactoryId;
288 		(*spFactoryMap)[SlideLayoutController_getImplementationName()] = SlideLayoutControllerFactoryId;
289 		(*spFactoryMap)[InsertSlideController_getImplementationName()] = InsertSlideControllerFactoryId;
290     }
291     return spFactoryMap;
292 };
293 } // end of anonymous namespace
294 
295 
296 extern "C"
297 {
298 
299 SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
300 	const sal_Char  ** ppEnvTypeName,
301 	uno_Environment **  )
302 {
303 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
304 }
305 
306 SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
307 	const sal_Char * pImplName,
308 	void           * pServiceManager,
309 	void           *  )
310 {
311     void * pRet = 0;
312 
313 	if( pServiceManager )
314 	{
315 		uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
316 
317 		uno::Reference<lang::XSingleServiceFactory> xFactory;
318         uno::Reference<lang::XSingleComponentFactory> xComponentFactory;
319 
320         ::boost::shared_ptr<FactoryMap> pFactoryMap (GetFactoryMap());
321         OUString sImplementationName (OUString::createFromAscii(pImplName));
322         FactoryMap::const_iterator iFactory (pFactoryMap->find(sImplementationName));
323         if (iFactory != pFactoryMap->end())
324         {
325             switch (iFactory->second)
326             {
327                 case SdHtmlOptionsDialogFactoryId:
328                     xFactory = ::cppu::createSingleFactory(
329                         xMSF,
330                         SdHtmlOptionsDialog_getImplementationName(),
331                         SdHtmlOptionsDialog_CreateInstance,
332                         SdHtmlOptionsDialog_getSupportedServiceNames());
333                     break;
334 
335                 case SdDrawingDocumentFactoryId:
336                     xFactory = ::sfx2::createSfxModelFactory(
337                         xMSF,
338                         SdDrawingDocument_getImplementationName(),
339                         SdDrawingDocument_createInstance,
340                         SdDrawingDocument_getSupportedServiceNames());
341                     break;
342 
343                 case SdPresentationDocumentFactoryId:
344                     xFactory = ::sfx2::createSfxModelFactory(
345                         xMSF,
346                         SdPresentationDocument_getImplementationName(),
347                         SdPresentationDocument_createInstance,
348                         SdPresentationDocument_getSupportedServiceNames());
349                     break;
350 
351                 case SdUnoModuleFactoryId:
352                     xFactory = ::cppu::createSingleFactory(
353                         xMSF,
354                         SdUnoModule_getImplementationName(),
355                         SdUnoModule_createInstance,
356                         SdUnoModule_getSupportedServiceNames());
357                     break;
358 
359                 case RandomNodeFactoryId:
360                     xFactory = ::cppu::createSingleFactory(
361                         xMSF,
362                         sd::RandomNode__getImplementationName(),
363                         sd::RandomNode_createInstance,
364                         sd::RandomNode_getSupportedServiceNames());
365                     break;
366 
367                 case ConfigurationFactoryId:
368                     xComponentFactory = ::cppu::createSingleComponentFactory(
369                         sd::framework::Configuration_createInstance,
370                         sd::framework::Configuration_getImplementationName(),
371                         sd::framework::Configuration_getSupportedServiceNames());
372                     break;
373 
374                 case ConfigurationControllerFactoryId:
375                     xComponentFactory = ::cppu::createSingleComponentFactory(
376                         sd::framework::ConfigurationController_createInstance,
377                         sd::framework::ConfigurationController_getImplementationName(),
378                         sd::framework::ConfigurationController_getSupportedServiceNames());
379                     break;
380 
381                 case ModuleControllerFactoryId:
382                     xComponentFactory = ::cppu::createSingleComponentFactory(
383                         sd::framework::ModuleController_createInstance,
384                         sd::framework::ModuleController_getImplementationName(),
385                         sd::framework::ModuleController_getSupportedServiceNames());
386                     break;
387 
388                 case BasicPaneFactoryFactoryId:
389                     xComponentFactory = ::cppu::createSingleComponentFactory(
390                         sd::framework::BasicPaneFactory_createInstance,
391                         sd::framework::BasicPaneFactory_getImplementationName(),
392                         sd::framework::BasicPaneFactory_getSupportedServiceNames());
393                     break;
394 
395                 case BasicToolBarFactoryFactoryId:
396                     xComponentFactory = ::cppu::createSingleComponentFactory(
397                         sd::framework::BasicToolBarFactory_createInstance,
398                         sd::framework::BasicToolBarFactory_getImplementationName(),
399                         sd::framework::BasicToolBarFactory_getSupportedServiceNames());
400                     break;
401 
402                 case BasicViewFactoryFactoryId:
403                     xComponentFactory = ::cppu::createSingleComponentFactory(
404                         sd::framework::BasicViewFactory_createInstance,
405                         sd::framework::BasicViewFactory_getImplementationName(),
406                         sd::framework::BasicViewFactory_getSupportedServiceNames());
407                     break;
408 
409                 case TaskPanelFactoryFactoryId:
410                     xComponentFactory = ::cppu::createSingleComponentFactory(
411                         sd::framework::TaskPanelFactory_createInstance,
412                         sd::framework::TaskPanelFactory_getImplementationName(),
413                         sd::framework::TaskPanelFactory_getSupportedServiceNames());
414                     break;
415 
416                 case ToolPanelFactoryFactoryId:
417                     xComponentFactory = ::cppu::createSingleComponentFactory(
418                         sd::toolpanel::ToolPanelFactory_createInstance,
419                         sd::toolpanel::ToolPanelFactory_getImplementationName(),
420                         sd::toolpanel::ToolPanelFactory_getSupportedServiceNames());
421                     break;
422 
423                 case ResourceIdFactoryId:
424                     xComponentFactory = ::cppu::createSingleComponentFactory(
425                         sd::framework::ResourceId_createInstance,
426                         sd::framework::ResourceId_getImplementationName(),
427                         sd::framework::ResourceId_getSupportedServiceNames());
428                     break;
429 
430                 case PresentationFactoryProviderFactoryId:
431                     xComponentFactory = ::cppu::createSingleComponentFactory(
432                         sd::framework::PresentationFactoryProvider_createInstance,
433                         sd::framework::PresentationFactoryProvider_getImplementationName(),
434                         sd::framework::PresentationFactoryProvider_getSupportedServiceNames());
435                     break;
436 
437                 case SlideRendererFactoryId:
438                     xComponentFactory = ::cppu::createSingleComponentFactory(
439                         sd::presenter::SlideRenderer_createInstance,
440                         sd::presenter::SlideRenderer_getImplementationName(),
441                         sd::presenter::SlideRenderer_getSupportedServiceNames());
442                     break;
443 
444                 case PresenterCanvasFactoryId:
445                     xComponentFactory = ::cppu::createSingleComponentFactory(
446                         sd::presenter::PresenterCanvas_createInstance,
447                         sd::presenter::PresenterCanvas_getImplementationName(),
448                         sd::presenter::PresenterCanvas_getSupportedServiceNames());
449                     break;
450 
451                 case PresenterTextViewServiceFactoryId:
452                     xComponentFactory = ::cppu::createSingleComponentFactory(
453                         sd::presenter::PresenterTextViewService_createInstance,
454                         sd::presenter::PresenterTextViewService_getImplementationName(),
455                         sd::presenter::PresenterTextViewService_getSupportedServiceNames());
456                     break;
457 
458                 case PresenterHelperServiceFactoryId:
459                     xComponentFactory = ::cppu::createSingleComponentFactory(
460                         sd::presenter::PresenterHelperService_createInstance,
461                         sd::presenter::PresenterHelperService_getImplementationName(),
462                         sd::presenter::PresenterHelperService_getSupportedServiceNames());
463                     break;
464 
465                 case PresenterPreviewCacheFactoryId:
466                     xComponentFactory = ::cppu::createSingleComponentFactory(
467                         sd::presenter::PresenterPreviewCache_createInstance,
468                         sd::presenter::PresenterPreviewCache_getImplementationName(),
469                         sd::presenter::PresenterPreviewCache_getSupportedServiceNames());
470                     break;
471 
472                 case SlideSorterServiceFactoryId:
473                     xComponentFactory = ::cppu::createSingleComponentFactory(
474                         sd::slidesorter::SlideSorterService_createInstance,
475                         sd::slidesorter::SlideSorterService_getImplementationName(),
476                         sd::slidesorter::SlideSorterService_getSupportedServiceNames());
477                     break;
478 
479 				case SlideLayoutControllerFactoryId:
480 					xFactory = ::cppu::createSingleFactory(
481                         xMSF,
482 						sd::SlideLayoutController_getImplementationName(),
483 						sd::SlideLayoutController_createInstance,
484 						sd::SlideLayoutController_getSupportedServiceNames());
485 					break;
486 
487 				case InsertSlideControllerFactoryId:
488 					xFactory = ::cppu::createSingleFactory(
489                         xMSF,
490 						sd::InsertSlideController_getImplementationName(),
491 						sd::InsertSlideController_createInstance,
492 						sd::InsertSlideController_getSupportedServiceNames());
493                 default:
494                     break;
495             }
496             if (xComponentFactory.is())
497             {
498                 xComponentFactory->acquire();
499                 pRet = xComponentFactory.get();
500             }
501             else if (xFactory.is())
502             {
503                 xFactory->acquire();
504                 pRet = xFactory.get();
505             }
506         }
507     }
508 
509     if (pRet != NULL)
510         SdDLL::Init();
511 	return pRet;
512 }
513 
514 } // end of extern "C"
515