xref: /aoo41x/main/sd/source/ui/unoidl/detreg.cxx (revision 79aad27f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #include "sddetect.hxx"
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/registry/XRegistryKey.hpp>
30 #include <com/sun/star/uno/Sequence.h>
31 #include <rtl/ustring.hxx>
32 #include "sal/types.h"
33 
34 using namespace ::com::sun::star;
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::lang;
37 
38 extern "C" {
39 
component_getImplementationEnvironment(const sal_Char ** ppEnvironmentTypeName,uno_Environment **)40 SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
41         const  sal_Char**   ppEnvironmentTypeName,
42         uno_Environment**              )
43 {
44 	*ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
45 }
46 
component_getFactory(const sal_Char * pImplementationName,void * pServiceManager,void *)47 SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
48 	const sal_Char* pImplementationName,
49 	void* pServiceManager,
50 	void*  )
51 {
52 	// Set default return value for this operation - if it failed.
53 	void* pReturn = NULL ;
54 
55 	if	(
56 			( pImplementationName	!=	NULL ) &&
57 			( pServiceManager		!=	NULL )
58 		)
59 	{
60 		// Define variables which are used in following macros.
61         Reference< XSingleServiceFactory >   xFactory                                                                                                ;
62         Reference< XMultiServiceFactory >    xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
63 
64 		if( SdFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
65 		{
66 			xFactory = ::cppu::createSingleFactory( xServiceManager,
67 			SdFilterDetect::impl_getStaticImplementationName(),
68 			SdFilterDetect::impl_createInstance,
69 			SdFilterDetect::impl_getStaticSupportedServiceNames() );
70 		}
71 
72 		// Factory is valid - service was found.
73 		if ( xFactory.is() )
74 		{
75 			xFactory->acquire();
76 			pReturn = xFactory.get();
77 		}
78 	}
79 
80 	// Return with result of this operation.
81 	return pReturn ;
82 }
83 } // extern "C"
84 
85 
86