tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / xmlsecurity / source / xmlsec / mscrypt / xmlsecuritycontext_mscryptimpl.cxx
blobf1f329de92582d23ccb9b6f697c1cc7598c1b89f
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
23 #include "securityenvironment_mscryptimpl.hxx"
25 #include <xmlsec/xmlstreamio.hxx>
27 #include "akmngr.hxx"
29 #include <cppuhelper/supportsservice.hxx>
31 using namespace ::com::sun::star;
32 using namespace ::com::sun::star::lang ;
34 using ::com::sun::star::xml::crypto::XSecurityEnvironment ;
35 using ::com::sun::star::xml::crypto::XXMLSecurityContext ;
37 namespace {
39 class XMLSecurityContext_MSCryptImpl : public ::cppu::WeakImplHelper<
40 css::xml::crypto::XXMLSecurityContext ,
41 css::lang::XServiceInfo >
43 private:
44 //xmlSecKeysMngrPtr m_pKeysMngr ;
45 css::uno::Reference< css::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment ;
47 public:
48 XMLSecurityContext_MSCryptImpl();
50 //Methods from XXMLSecurityContext
51 virtual sal_Int32 SAL_CALL addSecurityEnvironment(
52 const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aSecurityEnvironment
53 ) override;
55 virtual ::sal_Int32 SAL_CALL getSecurityEnvironmentNumber( ) override;
57 virtual css::uno::Reference<
58 css::xml::crypto::XSecurityEnvironment > SAL_CALL
59 getSecurityEnvironmentByIndex( ::sal_Int32 index ) override;
61 virtual css::uno::Reference<
62 css::xml::crypto::XSecurityEnvironment > SAL_CALL
63 getSecurityEnvironment( ) override;
65 virtual ::sal_Int32 SAL_CALL getDefaultSecurityEnvironmentIndex( ) override;
67 virtual void SAL_CALL setDefaultSecurityEnvironmentIndex( sal_Int32 nDefaultEnvIndex ) override;
70 //Methods from XServiceInfo
71 virtual OUString SAL_CALL getImplementationName() override;
73 virtual sal_Bool SAL_CALL supportsService(
74 const OUString& ServiceName
75 ) override;
77 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
82 XMLSecurityContext_MSCryptImpl::XMLSecurityContext_MSCryptImpl()
86 sal_Int32 SAL_CALL XMLSecurityContext_MSCryptImpl::addSecurityEnvironment(
87 const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aSecurityEnvironment)
89 if( !aSecurityEnvironment.is() )
91 throw uno::RuntimeException() ;
94 m_xSecurityEnvironment = aSecurityEnvironment;
96 return 0;
100 sal_Int32 SAL_CALL XMLSecurityContext_MSCryptImpl::getSecurityEnvironmentNumber( )
102 return 1;
105 css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL
106 XMLSecurityContext_MSCryptImpl::getSecurityEnvironmentByIndex( sal_Int32 index )
108 if (index != 0)
110 throw uno::RuntimeException() ;
112 return m_xSecurityEnvironment;
115 css::uno::Reference< css::xml::crypto::XSecurityEnvironment > SAL_CALL
116 XMLSecurityContext_MSCryptImpl::getSecurityEnvironment( )
118 return m_xSecurityEnvironment;
121 sal_Int32 SAL_CALL XMLSecurityContext_MSCryptImpl::getDefaultSecurityEnvironmentIndex( )
123 return 0;
126 void SAL_CALL XMLSecurityContext_MSCryptImpl::setDefaultSecurityEnvironmentIndex( sal_Int32 /*nDefaultEnvIndex*/ )
128 //dummy
131 /* XServiceInfo */
132 OUString SAL_CALL XMLSecurityContext_MSCryptImpl::getImplementationName() {
133 return "com.sun.star.xml.crypto.XMLSecurityContext" ;
136 /* XServiceInfo */
137 sal_Bool SAL_CALL XMLSecurityContext_MSCryptImpl::supportsService( const OUString& serviceName) {
138 return cppu::supportsService(this, serviceName);
141 /* XServiceInfo */
142 uno::Sequence< OUString > SAL_CALL XMLSecurityContext_MSCryptImpl::getSupportedServiceNames() {
143 return { "com.sun.star.xml.crypto.XMLSecurityContext" };
146 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
147 com_sun_star_xml_crypto_XMLSecurityContext_get_implementation(
148 uno::XComponentContext* /*pCtx*/, uno::Sequence<uno::Any> const& /*rSeq*/)
150 return cppu::acquire(new XMLSecurityContext_MSCryptImpl);
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */