bump product version to 4.1.6.2
[LibreOffice.git] / svl / source / uno / registerservices.cxx
blobe188dbdb805596f379be82ea7f38f7e41256e7c6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "sal/types.h"
21 #include "rtl/ustring.hxx"
22 #include <cppuhelper/factory.hxx>
23 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/registry/XRegistryKey.hpp>
26 #include <svl/svldllapi.h>
28 using css::uno::Reference;
29 using css::uno::Sequence;
31 // -------------------------------------------------------------------------------------
33 #define DECLARE_CREATEINSTANCE( ImplName ) \
34 Reference< css::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< css::lang::XMultiServiceFactory >& );
36 DECLARE_CREATEINSTANCE( SvNumberFormatterServiceObj )
37 DECLARE_CREATEINSTANCE( SvNumberFormatsSupplierServiceObject )
38 DECLARE_CREATEINSTANCE( PathService )
40 // -------------------------------------------------------------------------------------
42 extern "C"
45 SVL_DLLPUBLIC void* SAL_CALL svl_component_getFactory (
46 const sal_Char * pImplementationName, void * _pServiceManager,
47 SAL_UNUSED_PARAMETER void * /* _pRegistryKey*/)
49 void * pResult = 0;
50 if ( _pServiceManager )
52 Reference< css::lang::XSingleServiceFactory > xFactory;
53 if (rtl_str_compare(
54 pImplementationName,
55 "com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0)
57 Sequence< OUString > aServiceNames(1);
58 aServiceNames.getArray()[0] =
59 OUString("com.sun.star.util.NumberFormatsSupplier");
61 xFactory = ::cppu::createSingleFactory(
62 reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
63 OUString::createFromAscii( pImplementationName ),
64 SvNumberFormatsSupplierServiceObject_CreateInstance,
65 aServiceNames);
67 else if (rtl_str_compare(
68 pImplementationName,
69 "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject") == 0)
71 Sequence< OUString > aServiceNames(1);
72 aServiceNames.getArray()[0] =
73 OUString("com.sun.star.util.NumberFormatter");
75 xFactory = ::cppu::createSingleFactory(
76 reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
77 OUString::createFromAscii( pImplementationName ),
78 SvNumberFormatterServiceObj_CreateInstance,
79 aServiceNames);
81 else if (rtl_str_compare (
82 pImplementationName, "com.sun.star.comp.svl.PathService") == 0)
84 Sequence< OUString > aServiceNames(1);
85 aServiceNames.getArray()[0] =
86 OUString("com.sun.star.config.SpecialConfigManager");
87 xFactory = ::cppu::createSingleFactory (
88 reinterpret_cast< css::lang::XMultiServiceFactory* >( _pServiceManager ),
89 OUString::createFromAscii( pImplementationName ),
90 PathService_CreateInstance,
91 aServiceNames);
93 if ( xFactory.is() )
95 xFactory->acquire();
96 pResult = xFactory.get();
99 return pResult;
102 } // "C"
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */