1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mregistration.cxx,v $
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_connectivity.hxx"
34 #include "mdrivermanager.hxx"
36 #include <cppuhelper/factory.hxx>
40 using namespace ::com::sun::star::uno
;
41 using namespace ::com::sun::star::lang
;
42 using namespace ::com::sun::star::registry
;
44 //==========================================================================
46 //==========================================================================
50 //---------------------------------------------------------------------------------------
51 SAL_DLLPUBLIC_EXPORT
void SAL_CALL
component_getImplementationEnvironment(const sal_Char
** _ppEnvTypeName
, uno_Environment
** /*_ppEnv*/)
53 *_ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
56 //---------------------------------------------------------------------------------------
57 SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL
component_writeInfo(void* /*_pServiceManager*/, com::sun::star::registry::XRegistryKey
* _pRegistryKey
)
61 sal_Bool bReturn
= sal_False
;
65 ::rtl::OUString sMainKeyName
= ::rtl::OUString::createFromAscii("/");
66 sMainKeyName
+= ::drivermanager::OSDBCDriverManager::getImplementationName_static();
67 sMainKeyName
+= ::rtl::OUString::createFromAscii("/UNO/SERVICES");
68 Reference
< XRegistryKey
> xMainKey
= _pRegistryKey
->createKey(sMainKeyName
);
71 Sequence
< ::rtl::OUString
> sServices(::drivermanager::OSDBCDriverManager::getSupportedServiceNames_static());
72 const ::rtl::OUString
* pBegin
= sServices
.getConstArray();
73 const ::rtl::OUString
* pEnd
= pBegin
+ sServices
.getLength();
74 for (;pBegin
!= pEnd
; ++pBegin
)
75 xMainKey
->createKey(*pBegin
);
79 catch(InvalidRegistryException
&)
82 catch(InvalidValueException
&)
88 //---------------------------------------------------------------------------------------
89 SAL_DLLPUBLIC_EXPORT
void* SAL_CALL
component_getFactory(const sal_Char
* _pImplName
, ::com::sun::star::lang::XMultiServiceFactory
* _pServiceManager
, void* /*_pRegistryKey*/)
93 if (::drivermanager::OSDBCDriverManager::getImplementationName_static().compareToAscii(_pImplName
) == 0)
95 Reference
< XSingleServiceFactory
> xFactory(
96 ::cppu::createOneInstanceFactory(
98 ::drivermanager::OSDBCDriverManager::getImplementationName_static(),
99 ::drivermanager::OSDBCDriverManager::Create
,
100 ::drivermanager::OSDBCDriverManager::getSupportedServiceNames_static()
106 pRet
= xFactory
.get();