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: implementationentry.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_cppuhelper.hxx"
33 #include <cppuhelper/implementationentry.hxx>
34 #include <rtl/ustrbuf.hxx>
36 using namespace ::rtl
;
37 using namespace ::com::sun::star::uno
;
38 using namespace ::com::sun::star::lang
;
39 using namespace ::com::sun::star::registry
;
43 sal_Bool
component_writeInfoHelper(
44 void *, void *pRegistryKey
, const struct ImplementationEntry entries
[] )
46 sal_Bool bRet
= sal_False
;
51 for( sal_Int32 i
= 0; entries
[i
].create
; i
++ )
53 OUStringBuffer
buf( 124 );
54 buf
.appendAscii( RTL_CONSTASCII_STRINGPARAM("/") );
55 buf
.append( entries
[i
].getImplementationName() );
56 buf
.appendAscii(RTL_CONSTASCII_STRINGPARAM( "/UNO/SERVICES" ) );
57 Reference
< XRegistryKey
> xNewKey(
58 reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( buf
.makeStringAndClear() ) );
60 Sequence
< OUString
> seq
= entries
[i
].getSupportedServiceNames();
61 const OUString
*pArray
= seq
.getConstArray();
62 for ( sal_Int32 nPos
= 0 ; nPos
< seq
.getLength(); nPos
++ )
63 xNewKey
->createKey( pArray
[nPos
] );
68 catch ( InvalidRegistryException
& )
70 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
76 void * component_getFactoryHelper(
77 const sal_Char
* pImplName
, void *, void *,
78 const struct ImplementationEntry entries
[] )
82 Reference
< XSingleComponentFactory
> xFactory
;
84 for( sal_Int32 i
= 0 ; entries
[i
].create
; i
++ )
86 OUString implName
= entries
[i
].getImplementationName();
87 if( 0 == implName
.compareToAscii( pImplName
) )
89 xFactory
= entries
[i
].createFactory(
92 entries
[i
].getSupportedServiceNames(),
93 entries
[i
].moduleCounter
);
100 pRet
= xFactory
.get();