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