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