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 <com/sun/star/registry/XRegistryKey.hpp>
21 #include <com/sun/star/registry/InvalidRegistryException.hpp>
22 #include <cppuhelper/factory.hxx>
24 #include "mainthreadexecutor.hxx"
25 #include "bitmapcreator.hxx"
27 using namespace ::com::sun::star
;
32 SAL_DLLPUBLIC_EXPORT
void * SAL_CALL
component_getFactory( const sal_Char
* pImplName
, void * pServiceManager
, void * pRegistryKey
)
36 OUString
aImplName( OUString::createFromAscii( pImplName
) );
37 uno::Reference
< lang::XSingleServiceFactory
> xFactory
;
39 if ( pServiceManager
)
41 if ( aImplName
.equals( MainThreadExecutor::impl_staticGetImplementationName() ) )
43 xFactory
= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory
*>( pServiceManager
),
44 MainThreadExecutor::impl_staticGetImplementationName(),
45 MainThreadExecutor::impl_staticCreateSelfInstance
,
46 MainThreadExecutor::impl_staticGetSupportedServiceNames() );
48 else if ( aImplName
.equals( VCLBitmapCreator::impl_staticGetImplementationName() ) )
50 xFactory
= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory
*>( pServiceManager
),
51 VCLBitmapCreator::impl_staticGetImplementationName(),
52 VCLBitmapCreator::impl_staticCreateSelfInstance
,
53 VCLBitmapCreator::impl_staticGetSupportedServiceNames() );
60 pRet
= xFactory
.get();
67 sal_Bool SAL_CALL
component_writeInfo( void * pServiceManager
, void * pRegistryKey
)
73 uno::Reference
< registry::XRegistryKey
> xKey( reinterpret_cast< registry::XRegistryKey
* >( pRegistryKey
) );
75 uno::Reference
< registry::XRegistryKey
> xNewKey
;
76 uno::Sequence
< OUString
> rServices
;
79 xNewKey
= xKey
->createKey( OUString("/") +
80 MainThreadExecutor::impl_staticGetImplementationName() +
81 OUString( "/UNO/SERVICES") );
83 rServices
= MainThreadExecutor::impl_staticGetSupportedServiceNames();
84 for( ind
= 0; ind
< rServices
.getLength(); ind
++ )
85 xNewKey
->createKey( rServices
.getConstArray()[ind
] );
87 xNewKey
= xKey
->createKey( OUString("/") +
88 VCLBitmapCreator::impl_staticGetImplementationName() +
89 OUString( "/UNO/SERVICES") );
91 rServices
= VCLBitmapCreator::impl_staticGetSupportedServiceNames();
92 for( ind
= 0; ind
< rServices
.getLength(); ind
++ )
93 xNewKey
->createKey( rServices
.getConstArray()[ind
] );
97 catch (registry::InvalidRegistryException
&)
99 OSL_FAIL( "### InvalidRegistryException!" );
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */