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 : #include <registerservices.hxx>
29 :
30 : using css::uno::Reference;
31 : using css::uno::Sequence;
32 :
33 : extern "C"
34 : {
35 :
36 0 : SVL_DLLPUBLIC void* SAL_CALL svl_component_getFactory (
37 : const sal_Char * pImplementationName, void * _pServiceManager,
38 : SAL_UNUSED_PARAMETER void * /* _pRegistryKey*/)
39 : {
40 0 : void * pResult = 0;
41 0 : if ( _pServiceManager )
42 : {
43 0 : Reference< css::lang::XSingleServiceFactory > xFactory;
44 0 : if (rtl_str_compare(
45 : pImplementationName,
46 0 : "com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0)
47 : {
48 0 : Sequence< OUString > aServiceNames(1);
49 0 : aServiceNames.getArray()[0] =
50 0 : OUString("com.sun.star.util.NumberFormatsSupplier");
51 :
52 0 : xFactory = ::cppu::createSingleFactory(
53 : reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
54 : OUString::createFromAscii( pImplementationName ),
55 : SvNumberFormatsSupplierServiceObject_CreateInstance,
56 0 : aServiceNames);
57 : }
58 0 : else if (rtl_str_compare(
59 : pImplementationName,
60 0 : "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject") == 0)
61 : {
62 0 : Sequence< OUString > aServiceNames(1);
63 0 : aServiceNames.getArray()[0] =
64 0 : OUString("com.sun.star.util.NumberFormatter");
65 :
66 0 : xFactory = ::cppu::createSingleFactory(
67 : reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
68 : OUString::createFromAscii( pImplementationName ),
69 : SvNumberFormatterServiceObj_CreateInstance,
70 0 : aServiceNames);
71 : }
72 0 : else if (rtl_str_compare (
73 0 : pImplementationName, "com.sun.star.comp.svl.PathService") == 0)
74 : {
75 0 : Sequence< OUString > aServiceNames(1);
76 0 : aServiceNames.getArray()[0] =
77 0 : OUString("com.sun.star.config.SpecialConfigManager");
78 0 : xFactory = ::cppu::createSingleFactory (
79 : reinterpret_cast< css::lang::XMultiServiceFactory* >( _pServiceManager ),
80 : OUString::createFromAscii( pImplementationName ),
81 : PathService_CreateInstance,
82 0 : aServiceNames);
83 : }
84 0 : if ( xFactory.is() )
85 : {
86 0 : xFactory->acquire();
87 0 : pResult = xFactory.get();
88 0 : }
89 : }
90 0 : return pResult;
91 : }
92 :
93 : } // "C"
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|