update dev300-m58
[ooovba.git] / dbaccess / source / filter / migration / cfgservices.cxx
blobc0e02792722424b5c9fbacabe73cdd07391fc0e4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cfgservices.cxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef _CPPUHELPER_FACTORY_HXX_
35 #include <cppuhelper/factory.hxx>
36 #endif
37 #ifndef _OSL_DIAGNOSE_H_
38 #include <osl/diagnose.h>
39 #endif
40 #ifndef CFG_REGHELPER_HXX
41 #include "cfg_reghelper.hxx"
42 #endif
45 /********************************************************************************************/
47 using namespace ::dbacfg;
48 using namespace ::com::sun::star::uno;
49 using namespace ::com::sun::star::lang;
50 using namespace ::com::sun::star::registry;
52 //***************************************************************************************
54 // registry functions
55 extern "C" void SAL_CALL createRegistryInfo_OCfgImport();
57 //***************************************************************************************
58 extern "C" void SAL_CALL createRegistryInfo_dbacfg()
60 static sal_Bool bInit = sal_False;
61 if (!bInit)
63 createRegistryInfo_OCfgImport();
64 bInit = sal_True;
68 //---------------------------------------------------------------------------------------
70 extern "C" void SAL_CALL component_getImplementationEnvironment(
71 const sal_Char **ppEnvTypeName,
72 uno_Environment **
75 createRegistryInfo_dbacfg();
76 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
79 //---------------------------------------------------------------------------------------
80 extern "C" sal_Bool SAL_CALL component_writeInfo(
81 void* pServiceManager,
82 void* pRegistryKey
85 if (pRegistryKey)
86 try
88 return ::dbacfg::OModuleRegistration::writeComponentInfos(
89 static_cast<XMultiServiceFactory*>(pServiceManager),
90 static_cast<XRegistryKey*>(pRegistryKey));
92 catch (InvalidRegistryException& )
94 OSL_ENSURE(sal_False, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
97 return sal_False;
100 //---------------------------------------------------------------------------------------
101 extern "C" void* SAL_CALL component_getFactory(
102 const sal_Char* pImplementationName,
103 void* pServiceManager,
104 void* /*pRegistryKey*/)
106 Reference< XInterface > xRet;
107 if (pServiceManager && pImplementationName)
109 xRet = ::dbacfg::OModuleRegistration::getComponentFactory(
110 ::rtl::OUString::createFromAscii(pImplementationName),
111 static_cast< XMultiServiceFactory* >(pServiceManager));
114 if (xRet.is())
115 xRet->acquire();
116 return xRet.get();