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: Zregistration.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"
35 #include <cppuhelper/factory.hxx>
36 #include "ZPoolCollection.hxx"
39 using namespace ::com::sun::star::uno
;
40 using namespace ::com::sun::star::lang
;
41 using namespace ::com::sun::star::registry
;
42 using namespace connectivity
;
43 //==========================================================================
45 //==========================================================================
49 //---------------------------------------------------------------------------------------
50 void SAL_CALL
component_getImplementationEnvironment(const sal_Char
** _ppEnvTypeName
, uno_Environment
** /*_ppEnv*/)
52 *_ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
55 //---------------------------------------------------------------------------------------
56 sal_Bool SAL_CALL
component_writeInfo(void* /*_pServiceManager*/, com::sun::star::registry::XRegistryKey
* _pRegistryKey
)
58 ::rtl::OUString sMainKeyName
= ::rtl::OUString::createFromAscii("/");
59 sMainKeyName
+= OPoolCollection::getImplementationName_Static();
60 sMainKeyName
+= ::rtl::OUString::createFromAscii("/UNO/SERVICES");
64 Reference
< XRegistryKey
> xMainKey
= _pRegistryKey
->createKey(sMainKeyName
);
68 Sequence
< ::rtl::OUString
> sServices
= OPoolCollection::getSupportedServiceNames_Static();
69 const ::rtl::OUString
* pServices
= sServices
.getConstArray();
70 for (sal_Int32 i
=0; i
<sServices
.getLength(); ++i
, ++pServices
)
71 xMainKey
->createKey(*pServices
);
73 catch(InvalidRegistryException
&)
77 catch(InvalidValueException
&)
84 //---------------------------------------------------------------------------------------
85 void* SAL_CALL
component_getFactory(const sal_Char
* _pImplName
, ::com::sun::star::lang::XMultiServiceFactory
* _pServiceManager
, void* /*_pRegistryKey*/)
89 if (OPoolCollection::getImplementationName_Static().compareToAscii(_pImplName
) == 0)
91 Reference
< XSingleServiceFactory
> xFactory(
92 ::cppu::createOneInstanceFactory(
94 OPoolCollection::getImplementationName_Static(),
95 OPoolCollection::CreateInstance
,
96 OPoolCollection::getSupportedServiceNames_Static()
102 pRet
= xFactory
.get();