Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <sal/config.h>
22 : #include <stdio.h>
23 :
24 : #include <osl/mutex.hxx>
25 : #include <osl/thread.h>
26 : #include <cppuhelper/factory.hxx>
27 : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
28 :
29 : #include "seinitializer_nssimpl.hxx"
30 : #include "xmlsignature_nssimpl.hxx"
31 : #include "xmlencryption_nssimpl.hxx"
32 : #include "xmlsecuritycontext_nssimpl.hxx"
33 : #include "xsec_xmlsec.hxx"
34 : #include "securityenvironment_nssimpl.hxx"
35 :
36 : using namespace ::cppu;
37 : using namespace ::com::sun::star::uno;
38 : using namespace ::com::sun::star::lang;
39 : using namespace ::com::sun::star::registry;
40 :
41 : extern "C"
42 : {
43 :
44 12 : void* SAL_CALL nss_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ )
45 : {
46 12 : void* pRet = 0;
47 12 : Reference< XSingleServiceFactory > xFactory ;
48 :
49 12 : if( pImplName != NULL && pServiceManager != NULL )
50 : {
51 : #ifdef XMLSEC_CRYPTO_NSS
52 12 : if( SEInitializer_NssImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
53 : {
54 16 : xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
55 : reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
56 : OUString::createFromAscii( pImplName ),
57 8 : SEInitializer_NssImpl_createInstance, SEInitializer_NssImpl_getSupportedServiceNames() ) );
58 : }
59 4 : else if( XMLSignature_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
60 : {
61 0 : xFactory = XMLSignature_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
62 : }
63 4 : else if( XMLSecurityContext_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
64 : {
65 2 : xFactory = XMLSecurityContext_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
66 : }
67 2 : else if( SecurityEnvironment_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
68 : {
69 2 : xFactory = SecurityEnvironment_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
70 : }
71 0 : else if( XMLEncryption_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
72 : {
73 0 : xFactory = XMLEncryption_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
74 : }
75 : #else
76 : if( ONSSInitializer_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
77 : {
78 : xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
79 : reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
80 : OUString::createFromAscii( pImplName ),
81 : ONSSInitializer_createInstance, ONSSInitializer_getSupportedServiceNames() ) );
82 : }
83 : #endif
84 : }
85 :
86 12 : if( xFactory.is() ) {
87 12 : xFactory->acquire() ;
88 12 : pRet = xFactory.get() ;
89 : }
90 :
91 12 : return pRet ;
92 : }
93 :
94 : }
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|