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 <cppuhelper/factory.hxx>
24 :
25 : #include "serialnumberadapter.hxx"
26 : #include "xmlelementwrapper_xmlsecimpl.hxx"
27 : #include "xmldocumentwrapper_xmlsecimpl.hxx"
28 : #include "xsec_xmlsec.hxx"
29 :
30 : using namespace ::cppu;
31 : using namespace ::com::sun::star::uno;
32 : using namespace ::com::sun::star::lang;
33 :
34 : extern "C"
35 : {
36 :
37 11 : SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_xmlsec_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* pRegistryKey )
38 : {
39 11 : void* pRet = 0;
40 11 : Reference< XInterface > xFactory ;
41 :
42 11 : if( pImplName != NULL ) {
43 11 : if( XMLElementWrapper_XmlSecImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
44 : {
45 2 : xFactory = cppu::createSingleComponentFactory(
46 : XMLElementWrapper_XmlSecImpl_createInstance,
47 : OUString::createFromAscii( pImplName ),
48 1 : XMLElementWrapper_XmlSecImpl_getSupportedServiceNames() );
49 : }
50 10 : else if( XMLDocumentWrapper_XmlSecImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
51 : {
52 2 : xFactory = cppu::createSingleComponentFactory(
53 : XMLDocumentWrapper_XmlSecImpl_createInstance,
54 : OUString::createFromAscii( pImplName ),
55 1 : XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames() );
56 : }
57 9 : else if( xml_security::serial_number_adapter::implementationName().equals( OUString::createFromAscii( pImplName ) ) )
58 : {
59 2 : xFactory = ::cppu::createSingleComponentFactory(
60 : xml_security::serial_number_adapter::create,
61 : OUString::createFromAscii( pImplName ),
62 1 : xml_security::serial_number_adapter::serviceNames() );
63 : }
64 : }
65 :
66 11 : if( xFactory.is() ) {
67 3 : xFactory->acquire() ;
68 3 : pRet = xFactory.get() ;
69 : } else {
70 8 : pRet = nss_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ;
71 8 : if( pRet != NULL )
72 8 : return pRet ;
73 :
74 : #if defined( XMLSEC_CRYPTO_MSCRYPTO )
75 : pRet = mscrypt_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ;
76 : if( pRet != NULL )
77 : return pRet ;
78 : #endif
79 : }
80 :
81 3 : return pRet ;
82 : }
83 :
84 : }
85 :
86 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|