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_xmlsecurity.hxx"
26 
27 #include <sal/config.h>
28 #include <stdio.h>
29 
30 #include <osl/mutex.hxx>
31 #include <osl/thread.h>
32 #include <cppuhelper/factory.hxx>
33 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
34 
35 #include "seinitializer_mscryptimpl.hxx"
36 #include "xmlsignature_mscryptimpl.hxx"
37 #include "xmlencryption_mscryptimpl.hxx"
38 #include "xmlsecuritycontext_mscryptimpl.hxx"
39 #include "securityenvironment_mscryptimpl.hxx"
40 
41 using namespace ::rtl;
42 using namespace ::cppu;
43 using namespace ::com::sun::star::uno;
44 using namespace ::com::sun::star::lang;
45 using namespace ::com::sun::star::registry;
46 
47 extern "C"
48 {
49 
mscrypt_component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)50 void* SAL_CALL mscrypt_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ )
51 {
52 	void* pRet = 0;
53 	Reference< XSingleServiceFactory > xFactory ;
54 
55 	if( pImplName != NULL && pServiceManager != NULL ) {
56 		if( XMLSignature_MSCryptImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
57 			xFactory = XMLSignature_MSCryptImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
58 		} else if( XMLSecurityContext_MSCryptImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
59 			xFactory = XMLSecurityContext_MSCryptImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
60 		} else if( SecurityEnvironment_MSCryptImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
61 			xFactory = SecurityEnvironment_MSCryptImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
62 		} else if( XMLEncryption_MSCryptImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
63 			xFactory = XMLEncryption_MSCryptImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
64 		} else if( SEInitializer_MSCryptImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
65 			xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
66 				reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
67 				OUString::createFromAscii( pImplName ),
68 				SEInitializer_MSCryptImpl_createInstance, SEInitializer_MSCryptImpl_getSupportedServiceNames() ) );
69 		}
70 	}
71 
72 	if( xFactory.is() ) {
73 		xFactory->acquire() ;
74 		pRet = xFactory.get() ;
75 	}
76 
77 	return pRet ;
78 }
79 
80 }
81