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 #include <com/sun/star/registry/XRegistryKey.hpp>
30 #include <com/sun/star/registry/InvalidRegistryException.hpp>
31 #include <cppuhelper/factory.hxx>
33 #include "mainthreadexecutor.hxx"
34 #include "bitmapcreator.hxx"
36 using namespace ::com::sun::star
;
41 SAL_DLLPUBLIC_EXPORT
void * SAL_CALL
component_getFactory( const sal_Char
* pImplName
, void * pServiceManager
, void * pRegistryKey
)
45 ::rtl::OUString
aImplName( ::rtl::OUString::createFromAscii( pImplName
) );
46 uno::Reference
< lang::XSingleServiceFactory
> xFactory
;
48 if ( pServiceManager
)
50 if ( aImplName
.equals( MainThreadExecutor::impl_staticGetImplementationName() ) )
52 xFactory
= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory
*>( pServiceManager
),
53 MainThreadExecutor::impl_staticGetImplementationName(),
54 MainThreadExecutor::impl_staticCreateSelfInstance
,
55 MainThreadExecutor::impl_staticGetSupportedServiceNames() );
57 else if ( aImplName
.equals( VCLBitmapCreator::impl_staticGetImplementationName() ) )
59 xFactory
= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory
*>( pServiceManager
),
60 VCLBitmapCreator::impl_staticGetImplementationName(),
61 VCLBitmapCreator::impl_staticCreateSelfInstance
,
62 VCLBitmapCreator::impl_staticGetSupportedServiceNames() );
69 pRet
= xFactory
.get();
76 sal_Bool SAL_CALL
component_writeInfo( void * pServiceManager
, void * pRegistryKey
)
82 uno::Reference
< registry::XRegistryKey
> xKey( reinterpret_cast< registry::XRegistryKey
* >( pRegistryKey
) );
84 uno::Reference
< registry::XRegistryKey
> xNewKey
;
85 uno::Sequence
< ::rtl::OUString
> rServices
;
88 xNewKey
= xKey
->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) +
89 MainThreadExecutor::impl_staticGetImplementationName() +
90 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
92 rServices
= MainThreadExecutor::impl_staticGetSupportedServiceNames();
93 for( ind
= 0; ind
< rServices
.getLength(); ind
++ )
94 xNewKey
->createKey( rServices
.getConstArray()[ind
] );
96 xNewKey
= xKey
->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) +
97 VCLBitmapCreator::impl_staticGetImplementationName() +
98 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
100 rServices
= VCLBitmapCreator::impl_staticGetSupportedServiceNames();
101 for( ind
= 0; ind
< rServices
.getLength(); ind
++ )
102 xNewKey
->createKey( rServices
.getConstArray()[ind
] );
106 catch (registry::InvalidRegistryException
&)
108 OSL_FAIL( "### InvalidRegistryException!" );
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */