xref: /trunk/main/sd/source/ui/unoidl/facreg.cxx (revision 7a32b0c8)
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 TaskPanelFactory_createInstance(
126cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
127cdf0e10cSrcweir     throw(uno::Exception);
128cdf0e10cSrcweir extern OUString TaskPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
129cdf0e10cSrcweir extern uno::Sequence<OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
130cdf0e10cSrcweir     throw (uno::RuntimeException);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir extern uno::Reference<uno::XInterface> SAL_CALL ResourceId_createInstance(
133cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
134cdf0e10cSrcweir     throw(uno::Exception);
135cdf0e10cSrcweir extern OUString ResourceId_getImplementationName(void) throw (uno::RuntimeException);
136cdf0e10cSrcweir extern uno::Sequence<OUString> SAL_CALL ResourceId_getSupportedServiceNames (void)
137cdf0e10cSrcweir     throw (uno::RuntimeException);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir extern uno::Reference<uno::XInterface> SAL_CALL PresentationFactoryProvider_createInstance(
140cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
141cdf0e10cSrcweir     throw(uno::Exception);
142cdf0e10cSrcweir extern OUString PresentationFactoryProvider_getImplementationName(void)
143cdf0e10cSrcweir     throw (uno::RuntimeException);
144cdf0e10cSrcweir extern uno::Sequence<OUString> SAL_CALL PresentationFactoryProvider_getSupportedServiceNames (void)
145cdf0e10cSrcweir     throw (uno::RuntimeException);
146cdf0e10cSrcweir } }
147cdf0e10cSrcweir 
148*7a32b0c8SAndre Fischer namespace sd { namespace sidebar {
149cdf0e10cSrcweir 
150*7a32b0c8SAndre Fischer extern uno::Reference<uno::XInterface> SAL_CALL SidebarFactory_createInstance(
151cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
152cdf0e10cSrcweir     throw(uno::Exception);
153*7a32b0c8SAndre Fischer extern OUString SidebarFactory_getImplementationName(void) throw (uno::RuntimeException);
154*7a32b0c8SAndre Fischer extern uno::Sequence<OUString> SAL_CALL SidebarFactory_getSupportedServiceNames (void)
155cdf0e10cSrcweir     throw (uno::RuntimeException);
156cdf0e10cSrcweir 
157cdf0e10cSrcweir } }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir namespace sd { namespace presenter {
160cdf0e10cSrcweir extern uno::Reference<uno::XInterface> SAL_CALL SlideRenderer_createInstance(
161cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
162cdf0e10cSrcweir     throw(uno::Exception);
163cdf0e10cSrcweir extern OUString SlideRenderer_getImplementationName(void)
164cdf0e10cSrcweir     throw (uno::RuntimeException);
165cdf0e10cSrcweir extern uno::Sequence<OUString> SAL_CALL SlideRenderer_getSupportedServiceNames (void)
166cdf0e10cSrcweir     throw (uno::RuntimeException);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir extern uno::Reference<uno::XInterface> SAL_CALL PresenterCanvas_createInstance(
169cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
170cdf0e10cSrcweir     throw(uno::Exception);
171cdf0e10cSrcweir extern OUString PresenterCanvas_getImplementationName(void)
172cdf0e10cSrcweir     throw (uno::RuntimeException);
173cdf0e10cSrcweir extern uno::Sequence<OUString> SAL_CALL PresenterCanvas_getSupportedServiceNames (void)
174cdf0e10cSrcweir     throw (uno::RuntimeException);
175cdf0e10cSrcweir 
176cdf0e10cSrcweir extern uno::Reference<uno::XInterface> SAL_CALL PresenterTextViewService_createInstance(
177cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
178cdf0e10cSrcweir     throw(uno::Exception);
179cdf0e10cSrcweir extern OUString PresenterTextViewService_getImplementationName(void)
180cdf0e10cSrcweir     throw (uno::RuntimeException);
181cdf0e10cSrcweir extern uno::Sequence<OUString> SAL_CALL PresenterTextViewService_getSupportedServiceNames (void)
182cdf0e10cSrcweir     throw (uno::RuntimeException);
183cdf0e10cSrcweir 
184cdf0e10cSrcweir extern uno::Reference<uno::XInterface> SAL_CALL PresenterHelperService_createInstance(
185cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
186cdf0e10cSrcweir     throw(uno::Exception);
187cdf0e10cSrcweir extern OUString PresenterHelperService_getImplementationName(void)
188cdf0e10cSrcweir     throw (uno::RuntimeException);
189cdf0e10cSrcweir extern uno::Sequence<OUString> SAL_CALL PresenterHelperService_getSupportedServiceNames (void)
190cdf0e10cSrcweir     throw (uno::RuntimeException);
191cdf0e10cSrcweir 
192cdf0e10cSrcweir extern uno::Reference<uno::XInterface> SAL_CALL PresenterPreviewCache_createInstance(
193cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
194cdf0e10cSrcweir     throw(uno::Exception);
195cdf0e10cSrcweir extern OUString PresenterPreviewCache_getImplementationName(void)
196cdf0e10cSrcweir     throw (uno::RuntimeException);
197cdf0e10cSrcweir extern uno::Sequence<OUString> SAL_CALL PresenterPreviewCache_getSupportedServiceNames (void)
198cdf0e10cSrcweir     throw (uno::RuntimeException);
199cdf0e10cSrcweir } }
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 
202cdf0e10cSrcweir namespace sd { namespace slidesorter {
203cdf0e10cSrcweir extern uno::Reference<uno::XInterface> SAL_CALL SlideSorterService_createInstance(
204cdf0e10cSrcweir     const uno::Reference<uno::XComponentContext>& rxContext)
205cdf0e10cSrcweir     throw(uno::Exception);
206cdf0e10cSrcweir extern OUString SlideSorterService_getImplementationName(void)
207cdf0e10cSrcweir     throw (uno::RuntimeException);
208cdf0e10cSrcweir extern uno::Sequence<OUString> SAL_CALL SlideSorterService_getSupportedServiceNames (void)
209cdf0e10cSrcweir     throw (uno::RuntimeException);
210cdf0e10cSrcweir } }
211cdf0e10cSrcweir 
212cdf0e10cSrcweir using namespace ::sd;
213cdf0e10cSrcweir using namespace ::sd::framework;
214cdf0e10cSrcweir using namespace ::sd::presenter;
215cdf0e10cSrcweir using namespace ::sd::slidesorter;
216*7a32b0c8SAndre Fischer using namespace ::sd::sidebar;
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 
221cdf0e10cSrcweir // ----------------------------------------------------------------------------
222cdf0e10cSrcweir // Declaration and initialization of a map from service names to locally
223cdf0e10cSrcweir // unique factory identifiers.
224cdf0e10cSrcweir 
225cdf0e10cSrcweir enum FactoryId
226cdf0e10cSrcweir {
227cdf0e10cSrcweir     SdDrawingDocumentFactoryId,
228cdf0e10cSrcweir     SdPresentationDocumentFactoryId,
229cdf0e10cSrcweir     SdHtmlOptionsDialogFactoryId,
230cdf0e10cSrcweir     SdUnoModuleFactoryId,
231cdf0e10cSrcweir     RandomNodeFactoryId,
232cdf0e10cSrcweir 
233cdf0e10cSrcweir     ConfigurationFactoryId,
234cdf0e10cSrcweir     ConfigurationControllerFactoryId,
235cdf0e10cSrcweir     ModuleControllerFactoryId,
236cdf0e10cSrcweir     BasicPaneFactoryFactoryId,
237cdf0e10cSrcweir     BasicToolBarFactoryFactoryId,
238cdf0e10cSrcweir     BasicViewFactoryFactoryId,
239cdf0e10cSrcweir     TaskPanelFactoryFactoryId,
240*7a32b0c8SAndre Fischer     SidebarFactoryFactoryId,
241cdf0e10cSrcweir     ResourceIdFactoryId,
242cdf0e10cSrcweir     PresentationFactoryProviderFactoryId,
243cdf0e10cSrcweir     SlideRendererFactoryId,
244cdf0e10cSrcweir     PresenterCanvasFactoryId,
245cdf0e10cSrcweir     PresenterTextViewServiceFactoryId,
246cdf0e10cSrcweir     PresenterHelperServiceFactoryId,
247cdf0e10cSrcweir     PresenterPreviewCacheFactoryId,
248cdf0e10cSrcweir     SlideSorterServiceFactoryId,
249cdf0e10cSrcweir 	SlideLayoutControllerFactoryId,
250cdf0e10cSrcweir 	InsertSlideControllerFactoryId,
251cdf0e10cSrcweir };
252cdf0e10cSrcweir typedef ::std::hash_map<OUString, FactoryId, comphelper::UStringHash, comphelper::UStringEqual> FactoryMap;
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 
255cdf0e10cSrcweir namespace {
256cdf0e10cSrcweir static ::boost::shared_ptr<FactoryMap> spFactoryMap;
257cdf0e10cSrcweir ::boost::shared_ptr<FactoryMap> GetFactoryMap (void)
258cdf0e10cSrcweir {
259cdf0e10cSrcweir     if (spFactoryMap.get() == NULL)
260cdf0e10cSrcweir     {
261cdf0e10cSrcweir         spFactoryMap.reset(new FactoryMap);
262cdf0e10cSrcweir         (*spFactoryMap)[SdDrawingDocument_getImplementationName()] = SdDrawingDocumentFactoryId;
263cdf0e10cSrcweir         (*spFactoryMap)[SdPresentationDocument_getImplementationName()] = SdPresentationDocumentFactoryId;
264cdf0e10cSrcweir         (*spFactoryMap)[SdHtmlOptionsDialog_getImplementationName()] = SdHtmlOptionsDialogFactoryId;
265cdf0e10cSrcweir         (*spFactoryMap)[SdUnoModule_getImplementationName()] = SdUnoModuleFactoryId;
266cdf0e10cSrcweir         (*spFactoryMap)[RandomNode__getImplementationName()] = RandomNodeFactoryId;
267cdf0e10cSrcweir         (*spFactoryMap)[Configuration_getImplementationName()] = ConfigurationFactoryId;
268cdf0e10cSrcweir         (*spFactoryMap)[ConfigurationController_getImplementationName()] = ConfigurationControllerFactoryId;
269cdf0e10cSrcweir         (*spFactoryMap)[ModuleController_getImplementationName()] = ModuleControllerFactoryId;
270cdf0e10cSrcweir         (*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId;
271cdf0e10cSrcweir         (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId;
272cdf0e10cSrcweir         (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId;
273cdf0e10cSrcweir         (*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId;
274*7a32b0c8SAndre Fischer         (*spFactoryMap)[sidebar::SidebarFactory_getImplementationName()] = SidebarFactoryFactoryId;
275cdf0e10cSrcweir         (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId;
276cdf0e10cSrcweir         (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId;
277cdf0e10cSrcweir         (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId;
278cdf0e10cSrcweir         (*spFactoryMap)[PresenterCanvas_getImplementationName()] = PresenterCanvasFactoryId;
279cdf0e10cSrcweir         (*spFactoryMap)[PresenterTextViewService_getImplementationName()] = PresenterTextViewServiceFactoryId;
280cdf0e10cSrcweir         (*spFactoryMap)[PresenterHelperService_getImplementationName()] = PresenterHelperServiceFactoryId;
281cdf0e10cSrcweir         (*spFactoryMap)[PresenterPreviewCache_getImplementationName()] = PresenterPreviewCacheFactoryId;
282cdf0e10cSrcweir         (*spFactoryMap)[SlideSorterService_getImplementationName()] = SlideSorterServiceFactoryId;
283cdf0e10cSrcweir 		(*spFactoryMap)[SlideLayoutController_getImplementationName()] = SlideLayoutControllerFactoryId;
284cdf0e10cSrcweir 		(*spFactoryMap)[InsertSlideController_getImplementationName()] = InsertSlideControllerFactoryId;
285cdf0e10cSrcweir     }
286cdf0e10cSrcweir     return spFactoryMap;
287cdf0e10cSrcweir };
288cdf0e10cSrcweir } // end of anonymous namespace
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 
291cdf0e10cSrcweir extern "C"
292cdf0e10cSrcweir {
293cdf0e10cSrcweir 
294cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
295cdf0e10cSrcweir 	const sal_Char  ** ppEnvTypeName,
296cdf0e10cSrcweir 	uno_Environment **  )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
299cdf0e10cSrcweir }
300cdf0e10cSrcweir 
301cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
302cdf0e10cSrcweir 	const sal_Char * pImplName,
303cdf0e10cSrcweir 	void           * pServiceManager,
304cdf0e10cSrcweir 	void           *  )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir     void * pRet = 0;
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 	if( pServiceManager )
309cdf0e10cSrcweir 	{
310cdf0e10cSrcweir 		uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 		uno::Reference<lang::XSingleServiceFactory> xFactory;
313cdf0e10cSrcweir         uno::Reference<lang::XSingleComponentFactory> xComponentFactory;
314cdf0e10cSrcweir 
315cdf0e10cSrcweir         ::boost::shared_ptr<FactoryMap> pFactoryMap (GetFactoryMap());
316cdf0e10cSrcweir         OUString sImplementationName (OUString::createFromAscii(pImplName));
317cdf0e10cSrcweir         FactoryMap::const_iterator iFactory (pFactoryMap->find(sImplementationName));
318cdf0e10cSrcweir         if (iFactory != pFactoryMap->end())
319cdf0e10cSrcweir         {
320cdf0e10cSrcweir             switch (iFactory->second)
321cdf0e10cSrcweir             {
322cdf0e10cSrcweir                 case SdHtmlOptionsDialogFactoryId:
323cdf0e10cSrcweir                     xFactory = ::cppu::createSingleFactory(
324cdf0e10cSrcweir                         xMSF,
325cdf0e10cSrcweir                         SdHtmlOptionsDialog_getImplementationName(),
326cdf0e10cSrcweir                         SdHtmlOptionsDialog_CreateInstance,
327cdf0e10cSrcweir                         SdHtmlOptionsDialog_getSupportedServiceNames());
328cdf0e10cSrcweir                     break;
329cdf0e10cSrcweir 
330cdf0e10cSrcweir                 case SdDrawingDocumentFactoryId:
331cdf0e10cSrcweir                     xFactory = ::sfx2::createSfxModelFactory(
332cdf0e10cSrcweir                         xMSF,
333cdf0e10cSrcweir                         SdDrawingDocument_getImplementationName(),
334cdf0e10cSrcweir                         SdDrawingDocument_createInstance,
335cdf0e10cSrcweir                         SdDrawingDocument_getSupportedServiceNames());
336cdf0e10cSrcweir                     break;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir                 case SdPresentationDocumentFactoryId:
339cdf0e10cSrcweir                     xFactory = ::sfx2::createSfxModelFactory(
340cdf0e10cSrcweir                         xMSF,
341cdf0e10cSrcweir                         SdPresentationDocument_getImplementationName(),
342cdf0e10cSrcweir                         SdPresentationDocument_createInstance,
343cdf0e10cSrcweir                         SdPresentationDocument_getSupportedServiceNames());
344cdf0e10cSrcweir                     break;
345cdf0e10cSrcweir 
346cdf0e10cSrcweir                 case SdUnoModuleFactoryId:
347cdf0e10cSrcweir                     xFactory = ::cppu::createSingleFactory(
348cdf0e10cSrcweir                         xMSF,
349cdf0e10cSrcweir                         SdUnoModule_getImplementationName(),
350cdf0e10cSrcweir                         SdUnoModule_createInstance,
351cdf0e10cSrcweir                         SdUnoModule_getSupportedServiceNames());
352cdf0e10cSrcweir                     break;
353cdf0e10cSrcweir 
354cdf0e10cSrcweir                 case RandomNodeFactoryId:
355cdf0e10cSrcweir                     xFactory = ::cppu::createSingleFactory(
356cdf0e10cSrcweir                         xMSF,
357cdf0e10cSrcweir                         sd::RandomNode__getImplementationName(),
358cdf0e10cSrcweir                         sd::RandomNode_createInstance,
359cdf0e10cSrcweir                         sd::RandomNode_getSupportedServiceNames());
360cdf0e10cSrcweir                     break;
361cdf0e10cSrcweir 
362cdf0e10cSrcweir                 case ConfigurationFactoryId:
363cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
364cdf0e10cSrcweir                         sd::framework::Configuration_createInstance,
365cdf0e10cSrcweir                         sd::framework::Configuration_getImplementationName(),
366cdf0e10cSrcweir                         sd::framework::Configuration_getSupportedServiceNames());
367cdf0e10cSrcweir                     break;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir                 case ConfigurationControllerFactoryId:
370cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
371cdf0e10cSrcweir                         sd::framework::ConfigurationController_createInstance,
372cdf0e10cSrcweir                         sd::framework::ConfigurationController_getImplementationName(),
373cdf0e10cSrcweir                         sd::framework::ConfigurationController_getSupportedServiceNames());
374cdf0e10cSrcweir                     break;
375cdf0e10cSrcweir 
376cdf0e10cSrcweir                 case ModuleControllerFactoryId:
377cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
378cdf0e10cSrcweir                         sd::framework::ModuleController_createInstance,
379cdf0e10cSrcweir                         sd::framework::ModuleController_getImplementationName(),
380cdf0e10cSrcweir                         sd::framework::ModuleController_getSupportedServiceNames());
381cdf0e10cSrcweir                     break;
382cdf0e10cSrcweir 
383cdf0e10cSrcweir                 case BasicPaneFactoryFactoryId:
384cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
385cdf0e10cSrcweir                         sd::framework::BasicPaneFactory_createInstance,
386cdf0e10cSrcweir                         sd::framework::BasicPaneFactory_getImplementationName(),
387cdf0e10cSrcweir                         sd::framework::BasicPaneFactory_getSupportedServiceNames());
388cdf0e10cSrcweir                     break;
389cdf0e10cSrcweir 
390cdf0e10cSrcweir                 case BasicToolBarFactoryFactoryId:
391cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
392cdf0e10cSrcweir                         sd::framework::BasicToolBarFactory_createInstance,
393cdf0e10cSrcweir                         sd::framework::BasicToolBarFactory_getImplementationName(),
394cdf0e10cSrcweir                         sd::framework::BasicToolBarFactory_getSupportedServiceNames());
395cdf0e10cSrcweir                     break;
396cdf0e10cSrcweir 
397cdf0e10cSrcweir                 case BasicViewFactoryFactoryId:
398cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
399cdf0e10cSrcweir                         sd::framework::BasicViewFactory_createInstance,
400cdf0e10cSrcweir                         sd::framework::BasicViewFactory_getImplementationName(),
401cdf0e10cSrcweir                         sd::framework::BasicViewFactory_getSupportedServiceNames());
402cdf0e10cSrcweir                     break;
403cdf0e10cSrcweir 
404cdf0e10cSrcweir                 case TaskPanelFactoryFactoryId:
405cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
406cdf0e10cSrcweir                         sd::framework::TaskPanelFactory_createInstance,
407cdf0e10cSrcweir                         sd::framework::TaskPanelFactory_getImplementationName(),
408cdf0e10cSrcweir                         sd::framework::TaskPanelFactory_getSupportedServiceNames());
409cdf0e10cSrcweir                     break;
410cdf0e10cSrcweir 
411*7a32b0c8SAndre Fischer                 case SidebarFactoryFactoryId:
412cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
413*7a32b0c8SAndre Fischer                         sd::sidebar::SidebarFactory_createInstance,
414*7a32b0c8SAndre Fischer                         sd::sidebar::SidebarFactory_getImplementationName(),
415*7a32b0c8SAndre Fischer                         sd::sidebar::SidebarFactory_getSupportedServiceNames());
416cdf0e10cSrcweir                     break;
417cdf0e10cSrcweir 
418cdf0e10cSrcweir                 case ResourceIdFactoryId:
419cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
420cdf0e10cSrcweir                         sd::framework::ResourceId_createInstance,
421cdf0e10cSrcweir                         sd::framework::ResourceId_getImplementationName(),
422cdf0e10cSrcweir                         sd::framework::ResourceId_getSupportedServiceNames());
423cdf0e10cSrcweir                     break;
424cdf0e10cSrcweir 
425cdf0e10cSrcweir                 case PresentationFactoryProviderFactoryId:
426cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
427cdf0e10cSrcweir                         sd::framework::PresentationFactoryProvider_createInstance,
428cdf0e10cSrcweir                         sd::framework::PresentationFactoryProvider_getImplementationName(),
429cdf0e10cSrcweir                         sd::framework::PresentationFactoryProvider_getSupportedServiceNames());
430cdf0e10cSrcweir                     break;
431cdf0e10cSrcweir 
432cdf0e10cSrcweir                 case SlideRendererFactoryId:
433cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
434cdf0e10cSrcweir                         sd::presenter::SlideRenderer_createInstance,
435cdf0e10cSrcweir                         sd::presenter::SlideRenderer_getImplementationName(),
436cdf0e10cSrcweir                         sd::presenter::SlideRenderer_getSupportedServiceNames());
437cdf0e10cSrcweir                     break;
438cdf0e10cSrcweir 
439cdf0e10cSrcweir                 case PresenterCanvasFactoryId:
440cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
441cdf0e10cSrcweir                         sd::presenter::PresenterCanvas_createInstance,
442cdf0e10cSrcweir                         sd::presenter::PresenterCanvas_getImplementationName(),
443cdf0e10cSrcweir                         sd::presenter::PresenterCanvas_getSupportedServiceNames());
444cdf0e10cSrcweir                     break;
445cdf0e10cSrcweir 
446cdf0e10cSrcweir                 case PresenterTextViewServiceFactoryId:
447cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
448cdf0e10cSrcweir                         sd::presenter::PresenterTextViewService_createInstance,
449cdf0e10cSrcweir                         sd::presenter::PresenterTextViewService_getImplementationName(),
450cdf0e10cSrcweir                         sd::presenter::PresenterTextViewService_getSupportedServiceNames());
451cdf0e10cSrcweir                     break;
452cdf0e10cSrcweir 
453cdf0e10cSrcweir                 case PresenterHelperServiceFactoryId:
454cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
455cdf0e10cSrcweir                         sd::presenter::PresenterHelperService_createInstance,
456cdf0e10cSrcweir                         sd::presenter::PresenterHelperService_getImplementationName(),
457cdf0e10cSrcweir                         sd::presenter::PresenterHelperService_getSupportedServiceNames());
458cdf0e10cSrcweir                     break;
459cdf0e10cSrcweir 
460cdf0e10cSrcweir                 case PresenterPreviewCacheFactoryId:
461cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
462cdf0e10cSrcweir                         sd::presenter::PresenterPreviewCache_createInstance,
463cdf0e10cSrcweir                         sd::presenter::PresenterPreviewCache_getImplementationName(),
464cdf0e10cSrcweir                         sd::presenter::PresenterPreviewCache_getSupportedServiceNames());
465cdf0e10cSrcweir                     break;
466cdf0e10cSrcweir 
467cdf0e10cSrcweir                 case SlideSorterServiceFactoryId:
468cdf0e10cSrcweir                     xComponentFactory = ::cppu::createSingleComponentFactory(
469cdf0e10cSrcweir                         sd::slidesorter::SlideSorterService_createInstance,
470cdf0e10cSrcweir                         sd::slidesorter::SlideSorterService_getImplementationName(),
471cdf0e10cSrcweir                         sd::slidesorter::SlideSorterService_getSupportedServiceNames());
472cdf0e10cSrcweir                     break;
473cdf0e10cSrcweir 
474cdf0e10cSrcweir 				case SlideLayoutControllerFactoryId:
475cdf0e10cSrcweir 					xFactory = ::cppu::createSingleFactory(
476cdf0e10cSrcweir                         xMSF,
477cdf0e10cSrcweir 						sd::SlideLayoutController_getImplementationName(),
478cdf0e10cSrcweir 						sd::SlideLayoutController_createInstance,
479cdf0e10cSrcweir 						sd::SlideLayoutController_getSupportedServiceNames());
480cdf0e10cSrcweir 					break;
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 				case InsertSlideControllerFactoryId:
483cdf0e10cSrcweir 					xFactory = ::cppu::createSingleFactory(
484cdf0e10cSrcweir                         xMSF,
485cdf0e10cSrcweir 						sd::InsertSlideController_getImplementationName(),
486cdf0e10cSrcweir 						sd::InsertSlideController_createInstance,
487cdf0e10cSrcweir 						sd::InsertSlideController_getSupportedServiceNames());
488cdf0e10cSrcweir                 default:
489cdf0e10cSrcweir                     break;
490cdf0e10cSrcweir             }
491cdf0e10cSrcweir             if (xComponentFactory.is())
492cdf0e10cSrcweir             {
493cdf0e10cSrcweir                 xComponentFactory->acquire();
494cdf0e10cSrcweir                 pRet = xComponentFactory.get();
495cdf0e10cSrcweir             }
496cdf0e10cSrcweir             else if (xFactory.is())
497cdf0e10cSrcweir             {
498cdf0e10cSrcweir                 xFactory->acquire();
499cdf0e10cSrcweir                 pRet = xFactory.get();
500cdf0e10cSrcweir             }
501cdf0e10cSrcweir         }
502cdf0e10cSrcweir     }
503cdf0e10cSrcweir 
504cdf0e10cSrcweir     if (pRet != NULL)
505cdf0e10cSrcweir         SdDLL::Init();
506cdf0e10cSrcweir 	return pRet;
507cdf0e10cSrcweir }
508cdf0e10cSrcweir 
509cdf0e10cSrcweir } // end of extern "C"
510