xref: /aoo41x/main/configmgr/source/services.cxx (revision cdf0e10c)
1 /*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27 
28 #include "precompiled_configmgr.hxx"
29 #include "sal/config.h"
30 
31 #include "com/sun/star/uno/Exception.hpp"
32 #include "com/sun/star/uno/Reference.hxx"
33 #include "com/sun/star/uno/XComponentContext.hpp"
34 #include "com/sun/star/uno/XInterface.hpp"
35 #include "cppuhelper/factory.hxx"
36 #include "cppuhelper/implementationentry.hxx"
37 #include "osl/diagnose.h"
38 #include "uno/lbnames.h"
39 #include "sal/types.h"
40 
41 #include "configurationprovider.hxx"
42 #include "configurationregistry.hxx"
43 #include "defaultprovider.hxx"
44 #include "update.hxx"
45 
46 namespace {
47 
48 namespace css = com::sun::star;
49 
50 css::uno::Reference< css::uno::XInterface > SAL_CALL dummy(
51     css::uno::Reference< css::uno::XComponentContext > const &)
52     SAL_THROW((css::uno::Exception))
53 {
54     OSL_ASSERT(false);
55     return css::uno::Reference< css::uno::XInterface >();
56 }
57 
58 static cppu::ImplementationEntry const services[] = {
59     { &dummy, &configmgr::configuration_provider::getImplementationName,
60       &configmgr::configuration_provider::getSupportedServiceNames,
61       &configmgr::configuration_provider::createFactory, 0, 0 },
62     { &configmgr::default_provider::create,
63       &configmgr::default_provider::getImplementationName,
64       &configmgr::default_provider::getSupportedServiceNames,
65       &cppu::createSingleComponentFactory, 0, 0 },
66     { &configmgr::configuration_registry::create,
67       &configmgr::configuration_registry::getImplementationName,
68       &configmgr::configuration_registry::getSupportedServiceNames,
69       &cppu::createSingleComponentFactory, 0, 0 },
70     { &configmgr::update::create, &configmgr::update::getImplementationName,
71       &configmgr::update::getSupportedServiceNames,
72       &cppu::createSingleComponentFactory, 0, 0 },
73     { 0, 0, 0, 0, 0, 0 }
74 };
75 
76 }
77 
78 extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
79     char const * pImplName, void * pServiceManager, void * pRegistryKey)
80 {
81     return cppu::component_getFactoryHelper(
82         pImplName, pServiceManager, pRegistryKey, services);
83 }
84 
85 extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
86 component_getImplementationEnvironment(
87     char const ** ppEnvTypeName, uno_Environment **)
88 {
89     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
90 }
91