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 :
23 : #include <osl/mutex.hxx>
24 : #include <osl/thread.h>
25 : #include <cppuhelper/factory.hxx>
26 : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
27 :
28 : #include "seinitializer_nssimpl.hxx"
29 : #include "xmlsignature_nssimpl.hxx"
30 : #include "xmlencryption_nssimpl.hxx"
31 : #include "xmlsecuritycontext_nssimpl.hxx"
32 : #include "xsec_xmlsec.hxx"
33 : #include "securityenvironment_nssimpl.hxx"
34 :
35 : using namespace ::cppu;
36 : using namespace ::com::sun::star::uno;
37 : using namespace ::com::sun::star::lang;
38 : using namespace ::com::sun::star::registry;
39 :
40 : extern "C"
41 : {
42 :
43 8 : void* SAL_CALL nss_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ )
44 : {
45 8 : void* pRet = 0;
46 8 : Reference< XSingleServiceFactory > xFactory ;
47 :
48 8 : if( pImplName != NULL && pServiceManager != NULL )
49 : {
50 : #ifdef XMLSEC_CRYPTO_NSS
51 8 : if( SEInitializer_NssImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
52 : {
53 8 : xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
54 : static_cast< XMultiServiceFactory * >( pServiceManager ),
55 : OUString::createFromAscii( pImplName ),
56 4 : SEInitializer_NssImpl_createInstance, SEInitializer_NssImpl_getSupportedServiceNames() ) );
57 : }
58 4 : else if( XMLSignature_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
59 : {
60 1 : xFactory = XMLSignature_NssImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
61 : }
62 3 : else if( XMLSecurityContext_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
63 : {
64 1 : xFactory = XMLSecurityContext_NssImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
65 : }
66 2 : else if( SecurityEnvironment_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
67 : {
68 1 : xFactory = SecurityEnvironment_NssImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
69 : }
70 1 : else if( XMLEncryption_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
71 : {
72 1 : xFactory = XMLEncryption_NssImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
73 : }
74 : #else
75 : if( ONSSInitializer_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
76 : {
77 : xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
78 : reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
79 : OUString::createFromAscii( pImplName ),
80 : ONSSInitializer_createInstance, ONSSInitializer_getSupportedServiceNames() ) );
81 : }
82 : #endif
83 : }
84 :
85 8 : if( xFactory.is() ) {
86 8 : xFactory->acquire() ;
87 8 : pRet = xFactory.get() ;
88 : }
89 :
90 8 : return pRet ;
91 : }
92 :
93 : }
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|