xref: /aoo42x/main/package/source/xstor/register.cxx (revision 873c956e)
1a3872823SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3a3872823SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4a3872823SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5a3872823SAndrew Rist  * distributed with this work for additional information
6a3872823SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7a3872823SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8a3872823SAndrew Rist  * "License"); you may not use this file except in compliance
9a3872823SAndrew Rist  * with the License.  You may obtain a copy of the License at
10a3872823SAndrew Rist  *
11a3872823SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12a3872823SAndrew Rist  *
13a3872823SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14a3872823SAndrew Rist  * software distributed under the License is distributed on an
15a3872823SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16a3872823SAndrew Rist  * KIND, either express or implied.  See the License for the
17a3872823SAndrew Rist  * specific language governing permissions and limitations
18a3872823SAndrew Rist  * under the License.
19a3872823SAndrew Rist  *
20a3872823SAndrew Rist  *************************************************************/
21a3872823SAndrew Rist 
22a3872823SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_package.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
29cdf0e10cSrcweir #include <com/sun/star/registry/InvalidRegistryException.hpp>
30cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include "xfactory.hxx"
33*873c956eSdamjan #include "package/dllapi.h"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir using namespace ::com::sun::star;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 
38cdf0e10cSrcweir extern "C" {
39cdf0e10cSrcweir 
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)40*873c956eSdamjan PACKAGE_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
41cdf0e10cSrcweir {
42cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
43cdf0e10cSrcweir }
44cdf0e10cSrcweir 
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)45*873c956eSdamjan PACKAGE_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
46cdf0e10cSrcweir {
47cdf0e10cSrcweir 	void * pRet = 0;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 	::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) );
50cdf0e10cSrcweir 	uno::Reference< lang::XSingleServiceFactory > xFactory;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	if ( pServiceManager && aImplName.equals( OStorageFactory::impl_staticGetImplementationName() ) )
53cdf0e10cSrcweir 	{
54cdf0e10cSrcweir 		xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
55cdf0e10cSrcweir 											OStorageFactory::impl_staticGetImplementationName(),
56cdf0e10cSrcweir 											OStorageFactory::impl_staticCreateSelfInstance,
57cdf0e10cSrcweir 											OStorageFactory::impl_staticGetSupportedServiceNames() );
58cdf0e10cSrcweir 	}
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	if ( xFactory.is() )
61cdf0e10cSrcweir 	{
62cdf0e10cSrcweir 		xFactory->acquire();
63cdf0e10cSrcweir 		pRet = xFactory.get();
64cdf0e10cSrcweir 	}
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	return pRet;
67cdf0e10cSrcweir }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir } // extern "C"
70cdf0e10cSrcweir 
71