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 : #include <osl/mutex.hxx>
21 : #include <osl/thread.h>
22 : #include <cppuhelper/factory.hxx>
23 : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
24 :
25 : #include "decryptorimpl.hxx"
26 : #include "encryptorimpl.hxx"
27 : #include "signaturecreatorimpl.hxx"
28 : #include "signatureverifierimpl.hxx"
29 : #include "saxeventkeeperimpl.hxx"
30 : #include "xmlencryptiontemplateimpl.hxx"
31 : #include "xmlsignaturetemplateimpl.hxx"
32 :
33 : using namespace ::cppu;
34 : using namespace ::com::sun::star::uno;
35 : using namespace ::com::sun::star::lang;
36 : using namespace ::com::sun::star::registry;
37 :
38 : extern "C"
39 : {
40 7 : SAL_DLLPUBLIC_EXPORT void * SAL_CALL xsec_fw_component_getFactory(
41 : const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
42 : {
43 7 : void * pRet = 0;
44 :
45 : //Decryptor
46 7 : OUString implName = OUString::createFromAscii( pImplName );
47 7 : if ( pServiceManager && implName.equals(DecryptorImpl_getImplementationName()) )
48 : {
49 : Reference< XSingleServiceFactory > xFactory( createSingleFactory(
50 : static_cast< XMultiServiceFactory * >( pServiceManager ),
51 : OUString::createFromAscii( pImplName ),
52 1 : DecryptorImpl_createInstance, DecryptorImpl_getSupportedServiceNames() ) );
53 :
54 1 : if (xFactory.is())
55 : {
56 1 : xFactory->acquire();
57 1 : pRet = xFactory.get();
58 1 : }
59 : }
60 :
61 : //Encryptor
62 7 : if ( pServiceManager && implName.equals(EncryptorImpl_getImplementationName()) )
63 : {
64 : Reference< XSingleServiceFactory > xFactory( createSingleFactory(
65 : static_cast< XMultiServiceFactory * >( pServiceManager ),
66 : OUString::createFromAscii( pImplName ),
67 1 : EncryptorImpl_createInstance, EncryptorImpl_getSupportedServiceNames() ) );
68 :
69 1 : if (xFactory.is())
70 : {
71 1 : xFactory->acquire();
72 1 : pRet = xFactory.get();
73 1 : }
74 : }
75 :
76 : //SignatureCreator
77 7 : if ( pServiceManager && implName.equals(SignatureCreatorImpl_getImplementationName()) )
78 : {
79 : Reference< XSingleServiceFactory > xFactory( createSingleFactory(
80 : static_cast< XMultiServiceFactory * >( pServiceManager ),
81 : OUString::createFromAscii( pImplName ),
82 1 : SignatureCreatorImpl_createInstance, SignatureCreatorImpl_getSupportedServiceNames() ) );
83 :
84 1 : if (xFactory.is())
85 : {
86 1 : xFactory->acquire();
87 1 : pRet = xFactory.get();
88 1 : }
89 : }
90 :
91 : //SignatureVerifier
92 7 : if ( pServiceManager && implName.equals(SignatureVerifierImpl_getImplementationName()) )
93 : {
94 : Reference< XSingleServiceFactory > xFactory( createSingleFactory(
95 : static_cast< XMultiServiceFactory * >( pServiceManager ),
96 : OUString::createFromAscii( pImplName ),
97 1 : SignatureVerifierImpl_createInstance, SignatureVerifierImpl_getSupportedServiceNames() ) );
98 :
99 1 : if (xFactory.is())
100 : {
101 1 : xFactory->acquire();
102 1 : pRet = xFactory.get();
103 1 : }
104 : }
105 :
106 : //SAXEventKeeper
107 7 : if ( pServiceManager && implName.equals(SAXEventKeeperImpl_getImplementationName()) )
108 : {
109 : Reference< XSingleServiceFactory > xFactory( createSingleFactory(
110 : static_cast< XMultiServiceFactory * >( pServiceManager ),
111 : OUString::createFromAscii( pImplName ),
112 1 : SAXEventKeeperImpl_createInstance, SAXEventKeeperImpl_getSupportedServiceNames() ) );
113 :
114 1 : if (xFactory.is())
115 : {
116 1 : xFactory->acquire();
117 1 : pRet = xFactory.get();
118 1 : }
119 : }
120 :
121 : //XMLSignatureTemplate
122 7 : if ( pServiceManager && implName.equals( XMLSignatureTemplateImpl::impl_getImplementationName()) )
123 : {
124 : Reference< XSingleServiceFactory > xFactory = XMLSignatureTemplateImpl::impl_createFactory(
125 1 : static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
126 :
127 1 : if (xFactory.is())
128 : {
129 1 : xFactory->acquire();
130 1 : pRet = xFactory.get();
131 1 : }
132 : }
133 :
134 : //XMLEncryptionTemplate
135 7 : if ( pServiceManager && implName.equals( XMLEncryptionTemplateImpl::impl_getImplementationName()) )
136 : {
137 : Reference< XSingleServiceFactory > xFactory = XMLEncryptionTemplateImpl::impl_createFactory(
138 1 : static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
139 :
140 1 : if (xFactory.is())
141 : {
142 1 : xFactory->acquire();
143 1 : pRet = xFactory.get();
144 1 : }
145 : }
146 :
147 7 : return pRet;
148 : }
149 : }
150 :
151 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|