1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_cppuhelper.hxx"
31 #include <cppuhelper/implementationentry.hxx>
32 #include <rtl/ustrbuf.hxx>
34 using namespace ::rtl
;
35 using namespace ::com::sun::star::uno
;
36 using namespace ::com::sun::star::lang
;
37 using namespace ::com::sun::star::registry
;
41 sal_Bool
component_writeInfoHelper(
42 void *, void *pRegistryKey
, const struct ImplementationEntry entries
[] )
44 sal_Bool bRet
= sal_False
;
49 for( sal_Int32 i
= 0; entries
[i
].create
; i
++ )
51 OUStringBuffer
buf( 124 );
52 buf
.appendAscii( RTL_CONSTASCII_STRINGPARAM("/") );
53 buf
.append( entries
[i
].getImplementationName() );
54 buf
.appendAscii(RTL_CONSTASCII_STRINGPARAM( "/UNO/SERVICES" ) );
55 Reference
< XRegistryKey
> xNewKey(
56 reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( buf
.makeStringAndClear() ) );
58 Sequence
< OUString
> seq
= entries
[i
].getSupportedServiceNames();
59 const OUString
*pArray
= seq
.getConstArray();
60 for ( sal_Int32 nPos
= 0 ; nPos
< seq
.getLength(); nPos
++ )
61 xNewKey
->createKey( pArray
[nPos
] );
66 catch ( InvalidRegistryException
& )
68 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
74 void * component_getFactoryHelper(
75 const sal_Char
* pImplName
, void *, void *,
76 const struct ImplementationEntry entries
[] )
80 Reference
< XSingleComponentFactory
> xFactory
;
82 for( sal_Int32 i
= 0 ; entries
[i
].create
; i
++ )
84 OUString implName
= entries
[i
].getImplementationName();
85 if( 0 == implName
.compareToAscii( pImplName
) )
87 xFactory
= entries
[i
].createFactory(
90 entries
[i
].getSupportedServiceNames(),
91 entries
[i
].moduleCounter
);
98 pRet
= xFactory
.get();
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */