Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / xmlsecurity / source / framework / xmlsignaturetemplateimpl.cxx
blob586a8f70c7a1e7a73a8981394c938e5c0c13eb77
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>
21 #include <rtl/ustring.hxx>
22 #include <framework/xmlsignaturetemplateimpl.hxx>
23 #include <comphelper/sequence.hxx>
25 using namespace ::com::sun::star::uno ;
26 using ::com::sun::star::lang::XMultiServiceFactory ;
28 using ::com::sun::star::xml::wrapper::XXMLElementWrapper ;
29 using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ;
31 XMLSignatureTemplateImpl::XMLSignatureTemplateImpl()
32 :m_nStatus ( css::xml::crypto::SecurityOperationStatus_UNKNOWN )
36 XMLSignatureTemplateImpl::~XMLSignatureTemplateImpl() {
39 /* XXMLSignatureTemplate */
40 void SAL_CALL XMLSignatureTemplateImpl::setTemplate( const Reference< XXMLElementWrapper >& aTemplate )
42 m_xTemplate = aTemplate ;
45 /* XXMLSignatureTemplate */
46 Reference< XXMLElementWrapper > SAL_CALL XMLSignatureTemplateImpl::getTemplate()
48 return m_xTemplate ;
51 void SAL_CALL XMLSignatureTemplateImpl::setTarget( const css::uno::Reference< css::xml::wrapper::XXMLElementWrapper >& aXmlElement )
53 targets.push_back( aXmlElement );
56 css::uno::Sequence< css::uno::Reference< css::xml::wrapper::XXMLElementWrapper > > SAL_CALL XMLSignatureTemplateImpl::getTargets()
58 sal_Int32 length = targets.size();
59 css::uno::Sequence< css::uno::Reference< css::xml::wrapper::XXMLElementWrapper > > aTargets (length);
61 sal_Int32 i;
63 for (i=0; i<length; i++)
65 aTargets[i] = targets[i];
68 return aTargets;
71 void SAL_CALL XMLSignatureTemplateImpl::setBinding(
72 const css::uno::Reference< css::xml::crypto::XUriBinding >& aUriBinding )
74 m_xUriBinding = aUriBinding;
77 css::uno::Reference< css::xml::crypto::XUriBinding > SAL_CALL XMLSignatureTemplateImpl::getBinding()
79 return m_xUriBinding;
82 void SAL_CALL XMLSignatureTemplateImpl::setStatus(
83 css::xml::crypto::SecurityOperationStatus status )
85 m_nStatus = status;
88 css::xml::crypto::SecurityOperationStatus SAL_CALL XMLSignatureTemplateImpl::getStatus( )
90 return m_nStatus;
93 /* XServiceInfo */
94 OUString SAL_CALL XMLSignatureTemplateImpl::getImplementationName() {
95 return impl_getImplementationName() ;
98 /* XServiceInfo */
99 sal_Bool SAL_CALL XMLSignatureTemplateImpl::supportsService( const OUString& serviceName) {
100 Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
101 return comphelper::findValue(seqServiceNames, serviceName) != -1;
104 /* XServiceInfo */
105 Sequence< OUString > SAL_CALL XMLSignatureTemplateImpl::getSupportedServiceNames() {
106 return impl_getSupportedServiceNames() ;
109 //Helper for XServiceInfo
110 Sequence< OUString > XMLSignatureTemplateImpl::impl_getSupportedServiceNames() {
111 Sequence<OUString> seqServiceNames { "com.sun.star.xml.crypto.XMLSignatureTemplate" };
112 return seqServiceNames ;
115 OUString XMLSignatureTemplateImpl::impl_getImplementationName() {
116 return "com.sun.star.xml.security.framework.XMLSignatureTemplateImpl" ;
119 //Helper for registry
120 Reference< XInterface > XMLSignatureTemplateImpl::impl_createInstance( const Reference< XMultiServiceFactory >& ) {
121 return Reference< XInterface >( *new XMLSignatureTemplateImpl ) ;
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */