Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
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>
27 :
28 : using css::uno::Reference;
29 : using css::uno::Sequence;
30 : using rtl::OUString;
31 :
32 : // -------------------------------------------------------------------------------------
33 :
34 : #define DECLARE_CREATEINSTANCE( ImplName ) \
35 : Reference< css::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< css::lang::XMultiServiceFactory >& );
36 :
37 : DECLARE_CREATEINSTANCE( SvNumberFormatterServiceObj )
38 : DECLARE_CREATEINSTANCE( SvNumberFormatsSupplierServiceObject )
39 : DECLARE_CREATEINSTANCE( PathService )
40 :
41 : // -------------------------------------------------------------------------------------
42 :
43 : extern "C"
44 : {
45 :
46 3 : SVL_DLLPUBLIC void* SAL_CALL svl_component_getFactory (
47 : const sal_Char * pImplementationName, void * _pServiceManager,
48 : SAL_UNUSED_PARAMETER void * /* _pRegistryKey*/)
49 : {
50 3 : void * pResult = 0;
51 3 : if ( _pServiceManager )
52 : {
53 3 : Reference< css::lang::XSingleServiceFactory > xFactory;
54 3 : if (rtl_str_compare(
55 : pImplementationName,
56 3 : "com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0)
57 : {
58 0 : Sequence< OUString > aServiceNames(1);
59 : aServiceNames.getArray()[0] =
60 0 : OUString("com.sun.star.util.NumberFormatsSupplier");
61 :
62 : xFactory = ::cppu::createSingleFactory(
63 : reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
64 : OUString::createFromAscii( pImplementationName ),
65 : SvNumberFormatsSupplierServiceObject_CreateInstance,
66 0 : aServiceNames);
67 : }
68 3 : else if (rtl_str_compare(
69 : pImplementationName,
70 3 : "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject") == 0)
71 : {
72 3 : Sequence< OUString > aServiceNames(1);
73 : aServiceNames.getArray()[0] =
74 3 : OUString("com.sun.star.util.NumberFormatter");
75 :
76 : xFactory = ::cppu::createSingleFactory(
77 : reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
78 : OUString::createFromAscii( pImplementationName ),
79 : SvNumberFormatterServiceObj_CreateInstance,
80 3 : aServiceNames);
81 : }
82 0 : else if (rtl_str_compare (
83 0 : pImplementationName, "com.sun.star.comp.svl.PathService") == 0)
84 : {
85 0 : Sequence< OUString > aServiceNames(1);
86 : aServiceNames.getArray()[0] =
87 0 : OUString("com.sun.star.config.SpecialConfigManager");
88 : xFactory = ::cppu::createSingleFactory (
89 : reinterpret_cast< css::lang::XMultiServiceFactory* >( _pServiceManager ),
90 : OUString::createFromAscii( pImplementationName ),
91 : PathService_CreateInstance,
92 0 : aServiceNames);
93 : }
94 3 : if ( xFactory.is() )
95 : {
96 3 : xFactory->acquire();
97 3 : pResult = xFactory.get();
98 3 : }
99 : }
100 3 : return pResult;
101 : }
102 :
103 : } // "C"
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|