1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <cppuhelper/implementationentry.hxx>
21 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
22 #include <com/sun/star/registry/XRegistryKey.hpp>
24 #include <osl/diagnose.h>
26 using namespace ::com::sun::star::uno
;
27 using namespace ::com::sun::star::lang
;
28 using namespace ::com::sun::star::registry
;
32 sal_Bool
component_writeInfoHelper(
33 SAL_UNUSED_PARAMETER
void *, void * pRegistryKey
,
34 const struct ImplementationEntry entries
[])
41 for( sal_Int32 i
= 0; entries
[i
].create
; i
++ )
43 OUString sKey
= "/" + entries
[i
].getImplementationName() + "/UNO/SERVICES";
44 Reference
< XRegistryKey
> xNewKey(
45 static_cast< XRegistryKey
* >( pRegistryKey
)->createKey( sKey
) );
47 for (auto& serviceName
: entries
[i
].getSupportedServiceNames())
48 xNewKey
->createKey(serviceName
);
53 catch ( InvalidRegistryException
& )
55 OSL_FAIL( "### InvalidRegistryException!" );
61 void * component_getFactoryHelper(
62 char const * pImplName
, SAL_UNUSED_PARAMETER
void *,
63 SAL_UNUSED_PARAMETER
void *, const struct ImplementationEntry entries
[])
66 void * pRet
= nullptr;
67 Reference
< XSingleComponentFactory
> xFactory
;
69 for( sal_Int32 i
= 0 ; entries
[i
].create
; i
++ )
71 OUString implName
= entries
[i
].getImplementationName();
72 if( implName
.equalsAscii( pImplName
) )
74 xFactory
= entries
[i
].createFactory(
77 entries
[i
].getSupportedServiceNames(),
78 entries
[i
].moduleCounter
);
85 pRet
= xFactory
.get();
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */