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