tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / xmlsecurity / source / gpg / SEInitializer.cxx
blobe81407bef8d8793c897076d87f1cd7b114dd34f9
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/.
8 */
10 #include <cppuhelper/supportsservice.hxx>
11 #include <gpg/SEInitializer.hxx>
12 #include "SecurityEnvironment.hxx"
13 #include "XMLSecurityContext.hxx"
15 #include <global.h>
17 namespace com::sun::star::uno
19 class XComponentContext;
22 using namespace css;
23 using namespace css::lang;
24 using namespace css::uno;
25 using namespace css::xml::crypto;
27 SEInitializerGpg::SEInitializerGpg()
29 // Also init GpgME while we're at it
30 GpgME::initializeLibrary();
33 SEInitializerGpg::~SEInitializerGpg() {}
35 /* XSEInitializer */
36 Reference<XXMLSecurityContext> SAL_CALL SEInitializerGpg::createSecurityContext(const OUString&)
38 try
40 /* Build XML Security Context */
41 Reference<XXMLSecurityContext> xSecCtx(new XMLSecurityContextGpg());
43 Reference<XSecurityEnvironment> xSecEnv(new SecurityEnvironmentGpg());
44 sal_Int32 n = xSecCtx->addSecurityEnvironment(xSecEnv);
45 //originally the SecurityEnvironment with the internal slot was set as default
46 xSecCtx->setDefaultSecurityEnvironmentIndex(n);
47 return xSecCtx;
49 catch (const uno::Exception&)
51 return nullptr;
55 void SAL_CALL SEInitializerGpg::freeSecurityContext(const uno::Reference<XXMLSecurityContext>&) {}
57 /* XServiceInfo */
58 sal_Bool SAL_CALL SEInitializerGpg::supportsService(const OUString& rServiceName)
60 return cppu::supportsService(this, rServiceName);
63 uno::Sequence<OUString> SAL_CALL SEInitializerGpg::getSupportedServiceNames()
65 return { u"com.sun.star.xml.crypto.GPGSEInitializer"_ustr };
68 OUString SAL_CALL SEInitializerGpg::getImplementationName()
70 return u"com.sun.star.xml.security.SEInitializer_Gpg"_ustr;
73 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
74 com_sun_star_xml_security_SEInitializer_Gpg_get_implementation(
75 uno::XComponentContext* /*pCtx*/, uno::Sequence<uno::Any> const& /*rSeq*/)
77 return cppu::acquire(new SEInitializerGpg());
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */