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_starmath.hxx"
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/registry/XRegistryKey.hpp>
28 #include <com/sun/star/uno/Sequence.h>
29 #include <rtl/ustring.hxx>
30
31 #include "smdetect.hxx"
32
33 using namespace ::rtl;
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 void SAL_CALL component_getImplementationEnvironment(
41 const sal_Char** ppEnvironmentTypeName,
42 uno_Environment** /*ppEnvironment*/ )
43 {
44 *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
45 }
46
component_getFactory(const sal_Char * pImplementationName,void * pServiceManager,void *)47 void* SAL_CALL component_getFactory( const sal_Char* pImplementationName,
48 void* pServiceManager,
49 void* /*pRegistryKey*/ )
50 {
51 // Set default return value for this operation - if it failed.
52 void* pReturn = NULL ;
53
54 if (
55 ( pImplementationName != NULL ) &&
56 ( pServiceManager != NULL )
57 )
58 {
59 // Define variables which are used in following macros.
60 Reference< XSingleServiceFactory > xFactory ;
61 Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
62
63 if( SmFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
64 {
65 xFactory = ::cppu::createSingleFactory( xServiceManager,
66 SmFilterDetect::impl_getStaticImplementationName(),
67 SmFilterDetect::impl_createInstance,
68 SmFilterDetect::impl_getStaticSupportedServiceNames() );
69 }
70
71 // Factory is valid - service was found.
72 if ( xFactory.is() )
73 {
74 xFactory->acquire();
75 pReturn = xFactory.get();
76 }
77 }
78
79 // Return with result of this operation.
80 return pReturn ;
81 }
82 } // extern "C"
83
84
85
86