1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
23 #include <framework/xmlsignaturetemplateimpl.hxx>
25 using namespace ::com::sun::star::uno
;
26 using ::com::sun::star::lang::XMultiServiceFactory
;
27 using ::com::sun::star::lang::XSingleServiceFactory
;
29 using ::com::sun::star::xml::wrapper::XXMLElementWrapper
;
30 using ::com::sun::star::xml::crypto::XXMLSignatureTemplate
;
32 XMLSignatureTemplateImpl::XMLSignatureTemplateImpl()
33 :m_xTemplate( nullptr ),
34 m_nStatus ( css::xml::crypto::SecurityOperationStatus_UNKNOWN
)
38 XMLSignatureTemplateImpl::~XMLSignatureTemplateImpl() {
41 /* XXMLSignatureTemplate */
42 void SAL_CALL
XMLSignatureTemplateImpl::setTemplate( const Reference
< XXMLElementWrapper
>& aTemplate
)
44 m_xTemplate
= aTemplate
;
47 /* XXMLSignatureTemplate */
48 Reference
< XXMLElementWrapper
> SAL_CALL
XMLSignatureTemplateImpl::getTemplate()
53 void SAL_CALL
XMLSignatureTemplateImpl::setTarget( const css::uno::Reference
< css::xml::wrapper::XXMLElementWrapper
>& aXmlElement
)
55 targets
.push_back( aXmlElement
);
58 css::uno::Sequence
< css::uno::Reference
< css::xml::wrapper::XXMLElementWrapper
> > SAL_CALL
XMLSignatureTemplateImpl::getTargets()
60 sal_Int32 length
= targets
.size();
61 css::uno::Sequence
< css::uno::Reference
< css::xml::wrapper::XXMLElementWrapper
> > aTargets (length
);
65 for (i
=0; i
<length
; i
++)
67 aTargets
[i
] = targets
[i
];
73 void SAL_CALL
XMLSignatureTemplateImpl::setBinding(
74 const css::uno::Reference
< css::xml::crypto::XUriBinding
>& aUriBinding
)
76 m_xUriBinding
= aUriBinding
;
79 css::uno::Reference
< css::xml::crypto::XUriBinding
> SAL_CALL
XMLSignatureTemplateImpl::getBinding()
84 void SAL_CALL
XMLSignatureTemplateImpl::setStatus(
85 css::xml::crypto::SecurityOperationStatus status
)
90 css::xml::crypto::SecurityOperationStatus SAL_CALL
XMLSignatureTemplateImpl::getStatus( )
96 OUString SAL_CALL
XMLSignatureTemplateImpl::getImplementationName() {
97 return impl_getImplementationName() ;
101 sal_Bool SAL_CALL
XMLSignatureTemplateImpl::supportsService( const OUString
& serviceName
) {
102 Sequence
< OUString
> seqServiceNames
= getSupportedServiceNames() ;
103 const OUString
* pArray
= seqServiceNames
.getConstArray() ;
104 for( sal_Int32 i
= 0 ; i
< seqServiceNames
.getLength() ; i
++ ) {
105 if( *( pArray
+ i
) == serviceName
)
112 Sequence
< OUString
> SAL_CALL
XMLSignatureTemplateImpl::getSupportedServiceNames() {
113 return impl_getSupportedServiceNames() ;
116 //Helper for XServiceInfo
117 Sequence
< OUString
> XMLSignatureTemplateImpl::impl_getSupportedServiceNames() {
118 ::osl::Guard
< ::osl::Mutex
> aGuard( ::osl::Mutex::getGlobalMutex() ) ;
119 Sequence
<OUString
> seqServiceNames
{ "com.sun.star.xml.crypto.XMLSignatureTemplate" };
120 return seqServiceNames
;
123 OUString
XMLSignatureTemplateImpl::impl_getImplementationName() {
124 return OUString("com.sun.star.xml.security.framework.XMLSignatureTemplateImpl") ;
127 //Helper for registry
128 Reference
< XInterface
> SAL_CALL
XMLSignatureTemplateImpl::impl_createInstance( const Reference
< XMultiServiceFactory
>& ) {
129 return Reference
< XInterface
>( *new XMLSignatureTemplateImpl
) ;
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */