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