LibreOffice Module xmlsecurity (master) 1
XMLSecurityContext.cxx
Go to the documentation of this file.
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
11
13#include <o3tl/safeint.hxx>
14
15using namespace css::uno;
16using namespace css::lang;
17using namespace css::xml::crypto;
18
20 : m_nDefaultEnvIndex(-1)
21{
22}
23
25
27 const Reference<XSecurityEnvironment>& aSecurityEnvironment)
28{
29 if (!aSecurityEnvironment.is())
30 throw RuntimeException("Invalid SecurityEnvironment given!");
31
32 m_vSecurityEnvironments.push_back(aSecurityEnvironment);
33 return m_vSecurityEnvironments.size() - 1;
34}
35
37{
38 return m_vSecurityEnvironments.size();
39}
40
41Reference<XSecurityEnvironment>
43{
45 throw RuntimeException("Invalid index");
46
48}
49
50Reference<XSecurityEnvironment> SAL_CALL XMLSecurityContextGpg::getSecurityEnvironment()
51{
52 if (m_nDefaultEnvIndex < 0
54 throw RuntimeException("Invalid index");
55
57}
58
60{
61 return m_nDefaultEnvIndex;
62}
63
64void SAL_CALL XMLSecurityContextGpg::setDefaultSecurityEnvironmentIndex(sal_Int32 nDefaultEnvIndex)
65{
66 m_nDefaultEnvIndex = nDefaultEnvIndex;
67}
68
69/* XServiceInfo */
71{
72 return "com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl";
73}
74
75/* XServiceInfo */
76sal_Bool SAL_CALL XMLSecurityContextGpg::supportsService(const OUString& serviceName)
77{
78 return cppu::supportsService(this, serviceName);
79}
80
81/* XServiceInfo */
83{
84 return { OUString("com.sun.star.xml.crypto.XMLSecurityContext") };
85}
86
87/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~XMLSecurityContextGpg() override
virtual sal_Int32 SAL_CALL addSecurityEnvironment(const css::uno::Reference< css::xml::crypto::XSecurityEnvironment > &aSecurityEnvironment) override
virtual css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL getSecurityEnvironment() override
virtual sal_Int32 SAL_CALL getDefaultSecurityEnvironmentIndex() override
virtual ::sal_Int32 SAL_CALL getSecurityEnvironmentNumber() override
virtual css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL getSecurityEnvironmentByIndex(sal_Int32 index) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
std::vector< css::uno::Reference< css::xml::crypto::XSecurityEnvironment > > m_vSecurityEnvironments
virtual void SAL_CALL setDefaultSecurityEnvironmentIndex(sal_Int32 nDefaultEnvIndex) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
index
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
unsigned char sal_Bool