1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <sal/config.h>
23 #include <cppuhelper/factory.hxx>
25 #include "serialnumberadapter.hxx"
26 #include <xmlsec/xmlelementwrapper_xmlsecimpl.hxx>
27 #include <xmlsec/xmldocumentwrapper_xmlsecimpl.hxx>
28 #include "xsec_xmlsec.hxx"
30 #include <config_gpgme.h>
31 #if HAVE_FEATURE_GPGME
32 # include <gpg/xmlsignature_gpgimpl.hxx>
33 # include <gpg/SEInitializer.hxx>
36 using namespace ::cppu
;
37 using namespace ::com::sun::star::uno
;
38 using namespace ::com::sun::star::lang
;
43 SAL_DLLPUBLIC_EXPORT
void* SAL_CALL
xsec_xmlsec_component_getFactory( const sal_Char
* pImplName
, void* pServiceManager
, void* pRegistryKey
)
46 Reference
< XInterface
> xFactory
;
48 if( pImplName
!= nullptr ) {
49 #if HAVE_FEATURE_GPGME
50 if( XMLSignature_GpgImpl::impl_getImplementationName().equalsAscii( pImplName
) )
52 xFactory
= XMLSignature_GpgImpl::impl_createFactory( static_cast< XMultiServiceFactory
* >( pServiceManager
) ) ;
54 else if( SEInitializerGpg::impl_getImplementationName().equalsAscii( pImplName
) )
56 xFactory
= SEInitializerGpg::impl_createFactory( static_cast< XMultiServiceFactory
* >( pServiceManager
) ) ;
60 if( XMLElementWrapper_XmlSecImpl_getImplementationName().equalsAscii( pImplName
) )
62 xFactory
= cppu::createSingleComponentFactory(
63 XMLElementWrapper_XmlSecImpl_createInstance
,
64 OUString::createFromAscii( pImplName
),
65 XMLElementWrapper_XmlSecImpl_getSupportedServiceNames() );
67 else if( XMLDocumentWrapper_XmlSecImpl_getImplementationName().equalsAscii( pImplName
) )
69 xFactory
= cppu::createSingleComponentFactory(
70 XMLDocumentWrapper_XmlSecImpl_createInstance
,
71 OUString::createFromAscii( pImplName
),
72 XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames() );
74 else if( xml_security::serial_number_adapter::implementationName().equalsAscii( pImplName
) )
76 xFactory
= ::cppu::createSingleComponentFactory(
77 xml_security::serial_number_adapter::create
,
78 OUString::createFromAscii( pImplName
),
79 xml_security::serial_number_adapter::serviceNames() );
85 pRet
= xFactory
.get() ;
87 pRet
= nss_component_getFactory( pImplName
, pServiceManager
, pRegistryKey
) ;
91 #if defined( XMLSEC_CRYPTO_MSCRYPTO )
92 pRet
= mscrypt_component_getFactory( pImplName
, pServiceManager
, pRegistryKey
) ;
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */