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