Bump version to 5.0-14
[LibreOffice.git] / xmlsecurity / source / framework / xsec_framework.cxx
blob8174a50a6cf1cf3762e38937e09486c81f19f74b
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 .
20 #include <stdio.h>
22 #include <osl/mutex.hxx>
23 #include <osl/thread.h>
24 #include <cppuhelper/factory.hxx>
25 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
27 #include "decryptorimpl.hxx"
28 #include "encryptorimpl.hxx"
29 #include "signaturecreatorimpl.hxx"
30 #include "signatureverifierimpl.hxx"
31 #include "saxeventkeeperimpl.hxx"
32 #include "xmlencryptiontemplateimpl.hxx"
33 #include "xmlsignaturetemplateimpl.hxx"
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;
40 extern "C"
42 SAL_DLLPUBLIC_EXPORT void * SAL_CALL xsec_fw_component_getFactory(
43 const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
45 void * pRet = 0;
47 //Decryptor
48 OUString implName = OUString::createFromAscii( pImplName );
49 if ( pServiceManager && implName.equals(DecryptorImpl_getImplementationName()) )
51 Reference< XSingleServiceFactory > xFactory( createSingleFactory(
52 static_cast< XMultiServiceFactory * >( pServiceManager ),
53 OUString::createFromAscii( pImplName ),
54 DecryptorImpl_createInstance, DecryptorImpl_getSupportedServiceNames() ) );
56 if (xFactory.is())
58 xFactory->acquire();
59 pRet = xFactory.get();
63 //Encryptor
64 if ( pServiceManager && implName.equals(EncryptorImpl_getImplementationName()) )
66 Reference< XSingleServiceFactory > xFactory( createSingleFactory(
67 static_cast< XMultiServiceFactory * >( pServiceManager ),
68 OUString::createFromAscii( pImplName ),
69 EncryptorImpl_createInstance, EncryptorImpl_getSupportedServiceNames() ) );
71 if (xFactory.is())
73 xFactory->acquire();
74 pRet = xFactory.get();
78 //SignatureCreator
79 if ( pServiceManager && implName.equals(SignatureCreatorImpl_getImplementationName()) )
81 Reference< XSingleServiceFactory > xFactory( createSingleFactory(
82 static_cast< XMultiServiceFactory * >( pServiceManager ),
83 OUString::createFromAscii( pImplName ),
84 SignatureCreatorImpl_createInstance, SignatureCreatorImpl_getSupportedServiceNames() ) );
86 if (xFactory.is())
88 xFactory->acquire();
89 pRet = xFactory.get();
93 //SignatureVerifier
94 if ( pServiceManager && implName.equals(SignatureVerifierImpl_getImplementationName()) )
96 Reference< XSingleServiceFactory > xFactory( createSingleFactory(
97 static_cast< XMultiServiceFactory * >( pServiceManager ),
98 OUString::createFromAscii( pImplName ),
99 SignatureVerifierImpl_createInstance, SignatureVerifierImpl_getSupportedServiceNames() ) );
101 if (xFactory.is())
103 xFactory->acquire();
104 pRet = xFactory.get();
108 //SAXEventKeeper
109 if ( pServiceManager && implName.equals(SAXEventKeeperImpl_getImplementationName()) )
111 Reference< XSingleServiceFactory > xFactory( createSingleFactory(
112 static_cast< XMultiServiceFactory * >( pServiceManager ),
113 OUString::createFromAscii( pImplName ),
114 SAXEventKeeperImpl_createInstance, SAXEventKeeperImpl_getSupportedServiceNames() ) );
116 if (xFactory.is())
118 xFactory->acquire();
119 pRet = xFactory.get();
123 //XMLSignatureTemplate
124 if ( pServiceManager && implName.equals( XMLSignatureTemplateImpl::impl_getImplementationName()) )
126 Reference< XSingleServiceFactory > xFactory = XMLSignatureTemplateImpl::impl_createFactory(
127 static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
129 if (xFactory.is())
131 xFactory->acquire();
132 pRet = xFactory.get();
136 //XMLEncryptionTemplate
137 if ( pServiceManager && implName.equals( XMLEncryptionTemplateImpl::impl_getImplementationName()) )
139 Reference< XSingleServiceFactory > xFactory = XMLEncryptionTemplateImpl::impl_createFactory(
140 static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
142 if (xFactory.is())
144 xFactory->acquire();
145 pRet = xFactory.get();
149 return pRet;
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */