xref: /trunk/main/sw/source/ui/uno/detreg.cxx (revision efeef26f)
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_sw.hxx"
26 #include "swdetect.hxx"
27 
28 using ::rtl::OUString;
29 using namespace ::com::sun::star;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::lang;
32 
33 extern "C" {
34 
component_getImplementationEnvironment(const sal_Char ** ppEnvironmentTypeName,uno_Environment **)35 SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
36         const  sal_Char**   ppEnvironmentTypeName,
37         uno_Environment**   /*ppEnvironment*/ )
38 {
39 	*ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
40 }
41 
component_getFactory(const sal_Char * pImplementationName,void * pServiceManager,void *)42 SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
43 	const sal_Char* pImplementationName,
44 	void* pServiceManager,
45 	void* /*pRegistryKey*/ )
46 {
47 	// Set default return value for this operation - if it failed.
48 	void* pReturn = NULL ;
49 
50 	if	(
51 			( pImplementationName	!=	NULL ) &&
52 			( pServiceManager		!=	NULL )
53 		)
54 	{
55 		// Define variables which are used in following macros.
56         Reference< XSingleServiceFactory >   xFactory                                                                                                ;
57         Reference< XMultiServiceFactory >    xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
58 
59 		if( SwFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
60 		{
61 			xFactory = ::cppu::createSingleFactory( xServiceManager,
62 			SwFilterDetect::impl_getStaticImplementationName(),
63 			SwFilterDetect::impl_createInstance,
64 			SwFilterDetect::impl_getStaticSupportedServiceNames() );
65 		}
66 
67 		// Factory is valid - service was found.
68 		if ( xFactory.is() )
69 		{
70 			xFactory->acquire();
71 			pReturn = xFactory.get();
72 		}
73 	}
74 
75 	// Return with result of this operation.
76 	return pReturn ;
77 }
78 } // extern "C"
79 
80 
81 
82