bump product version to 4.1.6.2
[LibreOffice.git] / xmlsecurity / source / xmlsec / xsec_xmlsec.cxx
blobc333b3519e8327770478dd7f5e91dffd1d7811d1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "xmlelementwrapper_xmlsecimpl.hxx"
27 #include "xmldocumentwrapper_xmlsecimpl.hxx"
29 using namespace ::cppu;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::lang;
33 extern "C"
36 extern void* nss_component_getFactory( const sal_Char*, void*, void* );
38 #if defined( XMLSEC_CRYPTO_MSCRYPTO )
39 extern void* mscrypt_component_getFactory( const sal_Char*, void*, void* );
40 #endif
42 SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_xmlsec_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* pRegistryKey )
44 void* pRet = 0;
45 Reference< XInterface > xFactory ;
47 if( pImplName != NULL ) {
48 if( XMLElementWrapper_XmlSecImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
50 xFactory = cppu::createSingleComponentFactory(
51 XMLElementWrapper_XmlSecImpl_createInstance,
52 OUString::createFromAscii( pImplName ),
53 XMLElementWrapper_XmlSecImpl_getSupportedServiceNames() );
55 else if( XMLDocumentWrapper_XmlSecImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
57 xFactory = cppu::createSingleComponentFactory(
58 XMLDocumentWrapper_XmlSecImpl_createInstance,
59 OUString::createFromAscii( pImplName ),
60 XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames() );
62 else if( xml_security::serial_number_adapter::implementationName().equals( OUString::createFromAscii( pImplName ) ) )
64 xFactory = ::cppu::createSingleComponentFactory(
65 xml_security::serial_number_adapter::create,
66 OUString::createFromAscii( pImplName ),
67 xml_security::serial_number_adapter::serviceNames() );
71 if( xFactory.is() ) {
72 xFactory->acquire() ;
73 pRet = xFactory.get() ;
74 } else {
75 pRet = nss_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ;
76 if( pRet != NULL )
77 return pRet ;
79 #if defined( XMLSEC_CRYPTO_MSCRYPTO )
80 pRet = mscrypt_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ;
81 if( pRet != NULL )
82 return pRet ;
83 #endif
86 return pRet ;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */