1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
9 * last change: $Author: jholesovsky $ $Date: 2006-08-04 16:35:41 +0200 (Pá, 04 srp 2006) $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 ************************************************************************/
36 #ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
37 #include <com/sun/star/beans/NamedValue.hpp>
39 #ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
40 #include <com/sun/star/registry/XRegistryKey.hpp>
42 #ifndef _COM_SUN_STAR_UTIL_DATE_HPP_
43 #include <com/sun/star/util/Date.hpp>
46 #ifndef _UNO_ENVIRONMENT_H_
47 #include <uno/environment.h>
49 #ifndef _CPPUHELPER_FACTORY_HXX_
50 #include <cppuhelper/factory.hxx>
52 #ifndef _UTL_CONFIGMGR_HXX_
53 #include <unotools/configmgr.hxx>
58 #include "unxsplash.hxx"
61 using namespace ::com::sun::star::uno
;
62 using namespace ::com::sun::star::lang
;
63 using namespace ::com::sun::star::beans
;
64 using namespace ::com::sun::star::registry
;
65 using namespace ::desktop
;
67 static const char* pServices
[] =
69 UnxSplashScreen::serviceName
,
73 static const char* pImplementations
[] =
75 UnxSplashScreen::implementationName
,
79 typedef Reference
<XInterface
>(* fProvider
)( const Reference
<XMultiServiceFactory
>& );
81 static const fProvider pInstanceProviders
[] =
83 UnxSplashScreen::getInstance
,
88 static const char** pSupportedServices
[] =
90 UnxSplashScreen::interfaces
,
94 static Sequence
<OUString
>
95 getSupportedServiceNames( int p
) {
96 const char **names
= pSupportedServices
[p
];
97 Sequence
<OUString
> aSeq
;
98 for ( int i
= 0; names
[i
] != NULL
; i
++ )
101 aSeq
[i
] = OUString::createFromAscii( names
[i
] );
109 component_getImplementationEnvironment(
110 const sal_Char
** ppEnvironmentTypeName
,
111 uno_Environment
** ppEnvironment
)
113 *ppEnvironmentTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
118 void* pServiceManager
,
121 Reference
<XMultiServiceFactory
> xMan(
122 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
) ) ;
123 Reference
<XRegistryKey
> xKey(
124 reinterpret_cast< XRegistryKey
* >( pRegistryKey
) ) ;
126 // iterate over service names and register them...
128 const char* pServiceName
= NULL
;
129 const char* pImplName
= NULL
;
130 for ( int i
= 0; ( pServices
[i
] != NULL
) && ( pImplementations
[i
] != NULL
); i
++ )
132 pServiceName
= pServices
[i
];
133 pImplName
= pImplementations
[i
];
134 aImpl
= OUString::createFromAscii( "/" )
135 + OUString::createFromAscii( pImplName
)
136 + OUString::createFromAscii( "/UNO/SERVICES" );
137 Reference
<XRegistryKey
> xNewKey
= xKey
->createKey( aImpl
);
138 xNewKey
->createKey( OUString::createFromAscii( pServiceName
) );
144 component_getFactory(
145 const sal_Char
* pImplementationName
,
146 void* pServiceManager
,
149 // Set default return value for this operation - if it failed.
150 if ( pImplementationName
&& pServiceManager
)
152 Reference
< XSingleServiceFactory
> xFactory
;
153 Reference
< XMultiServiceFactory
> xServiceManager(
154 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
) ) ;
156 // search implementation
157 for ( int i
= 0; ( pImplementations
[i
] != NULL
); i
++ )
159 if ( strcmp( pImplementations
[i
], pImplementationName
) == 0 )
161 // found implementation
162 xFactory
= Reference
<XSingleServiceFactory
>( cppu::createSingleFactory(
163 xServiceManager
, OUString::createFromAscii( pImplementationName
),
164 pInstanceProviders
[i
], getSupportedServiceNames( i
) ) );
167 // Factory is valid - service was found.
169 return xFactory
.get();