1*40df464eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*40df464eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*40df464eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*40df464eSAndrew Rist  * distributed with this work for additional information
6*40df464eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*40df464eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*40df464eSAndrew Rist  * "License"); you may not use this file except in compliance
9*40df464eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*40df464eSAndrew Rist  *
11*40df464eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*40df464eSAndrew Rist  *
13*40df464eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*40df464eSAndrew Rist  * software distributed under the License is distributed on an
15*40df464eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*40df464eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*40df464eSAndrew Rist  * specific language governing permissions and limitations
18*40df464eSAndrew Rist  * under the License.
19*40df464eSAndrew Rist  *
20*40df464eSAndrew Rist  *************************************************************/
21*40df464eSAndrew Rist 
22*40df464eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svl.hxx"
26cdf0e10cSrcweir #include "sal/types.h"
27cdf0e10cSrcweir #include "rtl/ustring.hxx"
28cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
29cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
32cdf0e10cSrcweir #include <svl/svldllapi.h>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace css = com::sun::star;
35cdf0e10cSrcweir using css::uno::Reference;
36cdf0e10cSrcweir using css::uno::Sequence;
37cdf0e10cSrcweir using rtl::OUString;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // -------------------------------------------------------------------------------------
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #define DECLARE_CREATEINSTANCE( ImplName ) \
42cdf0e10cSrcweir 	Reference< css::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< css::lang::XMultiServiceFactory >& );
43cdf0e10cSrcweir 
44cdf0e10cSrcweir DECLARE_CREATEINSTANCE( SvNumberFormatterServiceObj )
DECLARE_CREATEINSTANCE(SvNumberFormatsSupplierServiceObject)45cdf0e10cSrcweir DECLARE_CREATEINSTANCE( SvNumberFormatsSupplierServiceObject )
46cdf0e10cSrcweir DECLARE_CREATEINSTANCE( PathService )
47cdf0e10cSrcweir 
48cdf0e10cSrcweir // -------------------------------------------------------------------------------------
49cdf0e10cSrcweir 
50cdf0e10cSrcweir extern "C"
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 
53cdf0e10cSrcweir SVL_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment (
54cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */)
55cdf0e10cSrcweir {
56cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir SVL_DLLPUBLIC void* SAL_CALL component_getFactory (
60cdf0e10cSrcweir 	const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey*/)
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	void * pResult = 0;
63cdf0e10cSrcweir 	if ( _pServiceManager )
64cdf0e10cSrcweir 	{
65cdf0e10cSrcweir 		Reference< css::lang::XSingleServiceFactory > xFactory;
66cdf0e10cSrcweir 		if (rtl_str_compare(
67cdf0e10cSrcweir 				pImplementationName,
68cdf0e10cSrcweir 				"com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0)
69cdf0e10cSrcweir 		{
70cdf0e10cSrcweir 			Sequence< OUString > aServiceNames(1);
71cdf0e10cSrcweir 			aServiceNames.getArray()[0] =
72cdf0e10cSrcweir 				OUString::createFromAscii( "com.sun.star.util.NumberFormatsSupplier" );
73cdf0e10cSrcweir 
74cdf0e10cSrcweir             xFactory = ::cppu::createSingleFactory(
75cdf0e10cSrcweir 				reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
76cdf0e10cSrcweir 				OUString::createFromAscii( pImplementationName ),
77cdf0e10cSrcweir 				SvNumberFormatsSupplierServiceObject_CreateInstance,
78cdf0e10cSrcweir 				aServiceNames);
79cdf0e10cSrcweir 		}
80cdf0e10cSrcweir 		else if (rtl_str_compare(
81cdf0e10cSrcweir 					 pImplementationName,
82cdf0e10cSrcweir 					 "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject") == 0)
83cdf0e10cSrcweir 		{
84cdf0e10cSrcweir 			Sequence< OUString > aServiceNames(1);
85cdf0e10cSrcweir 			aServiceNames.getArray()[0] =
86cdf0e10cSrcweir 				OUString::createFromAscii( "com.sun.star.util.NumberFormatter" );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir             xFactory = ::cppu::createSingleFactory(
89cdf0e10cSrcweir 				reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
90cdf0e10cSrcweir 				OUString::createFromAscii( pImplementationName ),
91cdf0e10cSrcweir 				SvNumberFormatterServiceObj_CreateInstance,
92cdf0e10cSrcweir 				aServiceNames);
93cdf0e10cSrcweir 		}
94cdf0e10cSrcweir 		else if (rtl_str_compare (
95cdf0e10cSrcweir 					 pImplementationName, "com.sun.star.comp.svl.PathService") == 0)
96cdf0e10cSrcweir 		{
97cdf0e10cSrcweir 			Sequence< OUString > aServiceNames(1);
98cdf0e10cSrcweir             aServiceNames.getArray()[0] =
99cdf0e10cSrcweir 				OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" );
100cdf0e10cSrcweir             xFactory = ::cppu::createSingleFactory (
101cdf0e10cSrcweir 				reinterpret_cast< css::lang::XMultiServiceFactory* >( _pServiceManager ),
102cdf0e10cSrcweir 				OUString::createFromAscii( pImplementationName ),
103cdf0e10cSrcweir 				PathService_CreateInstance,
104cdf0e10cSrcweir 				aServiceNames);
105cdf0e10cSrcweir 		}
106cdf0e10cSrcweir 		if ( xFactory.is() )
107cdf0e10cSrcweir 		{
108cdf0e10cSrcweir 			xFactory->acquire();
109cdf0e10cSrcweir 			pResult = xFactory.get();
110cdf0e10cSrcweir 		}
111cdf0e10cSrcweir 	}
112cdf0e10cSrcweir 	return pResult;
113cdf0e10cSrcweir }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir }	// "C"
116cdf0e10cSrcweir 
117