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