xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx |   53 ++++++-----
 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.hxx |   80 -----------------
 xmlsecurity/source/xmlsec/nss/xsec_nss.cxx             |    5 -
 xmlsecurity/util/xsec_xmlsec.component                 |    3 
 4 files changed, 33 insertions(+), 108 deletions(-)

New commits:
commit 48d3ff5c498f8f186d4ee72871af379010403442
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Tue Feb 13 22:09:40 2018 +0100

    xmlsecurity nss: create XMLSignature instances with a constructor
    
    Change-Id: Ic2968a1eda7517ba4cfb67d0cf68fb7de1ac1935
    Reviewed-on: https://gerrit.libreoffice.org/49685
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
index 3389fd149086..5eef5e80ae28 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
@@ -19,7 +19,6 @@
 
 #include <sal/config.h>
 #include <rtl/uuid.h>
-#include "xmlsignature_nssimpl.hxx"
 
 #include <xmlsec/xmldocumentwrapper_xmlsecimpl.hxx>
 #include <xmlsec/xmlelementwrapper_xmlsecimpl.hxx>
@@ -31,7 +30,9 @@
 #include "xmlsecuritycontext_nssimpl.hxx"
 
 #include <xmlsec-wrapper.h>
+#include <com/sun/star/xml/crypto/XXMLSignature.hpp>
 
+using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno ;
 using namespace ::com::sun::star::lang ;
 using ::com::sun::star::lang::XMultiServiceFactory ;
@@ -45,10 +46,30 @@ using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ;
 using ::com::sun::star::xml::crypto::XXMLSecurityContext ;
 using ::com::sun::star::xml::crypto::XUriBinding ;
 
-XMLSignature_NssImpl::XMLSignature_NssImpl() {
-}
+class XMLSignature_NssImpl
+    : public ::cppu::WeakImplHelper<xml::crypto::XXMLSignature, 
lang::XServiceInfo>
+{
+public:
+    explicit XMLSignature_NssImpl();
+
+    //Methods from XXMLSignature
+    virtual uno::Reference<xml::crypto::XXMLSignatureTemplate> SAL_CALL
+    generate(const uno::Reference<xml::crypto::XXMLSignatureTemplate>& 
aTemplate,
+             const uno::Reference<xml::crypto::XSecurityEnvironment>& 
aEnvironment) override;
+
+    virtual uno::Reference<xml::crypto::XXMLSignatureTemplate> SAL_CALL
+    validate(const uno::Reference<xml::crypto::XXMLSignatureTemplate>& 
aTemplate,
+             const uno::Reference<xml::crypto::XXMLSecurityContext>& aContext) 
override;
+
+    //Methods from XServiceInfo
+    virtual OUString SAL_CALL getImplementationName() override;
+
+    virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override;
+
+    virtual uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() 
override;
+};
 
-XMLSignature_NssImpl::~XMLSignature_NssImpl() {
+XMLSignature_NssImpl::XMLSignature_NssImpl() {
 }
 
 /* XXMLSignature */
@@ -267,7 +288,7 @@ SAL_CALL XMLSignature_NssImpl::validate(
 
 /* XServiceInfo */
 OUString SAL_CALL XMLSignature_NssImpl::getImplementationName() {
-    return impl_getImplementationName() ;
+    return OUString("com.sun.star.xml.crypto.XMLSignature");
 }
 
 /* XServiceInfo */
@@ -283,27 +304,15 @@ sal_Bool SAL_CALL XMLSignature_NssImpl::supportsService( 
const OUString& service
 
 /* XServiceInfo */
 Sequence< OUString > SAL_CALL XMLSignature_NssImpl::getSupportedServiceNames() 
{
-    return impl_getSupportedServiceNames() ;
-}
-
-//Helper for XServiceInfo
-Sequence< OUString > XMLSignature_NssImpl::impl_getSupportedServiceNames() {
-    ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
     Sequence<OUString> seqServiceNames { 
"com.sun.star.xml.crypto.XMLSignature" };
     return seqServiceNames ;
 }
 
-OUString XMLSignature_NssImpl::impl_getImplementationName() {
-    return 
OUString("com.sun.star.xml.security.bridge.xmlsec.XMLSignature_NssImpl") ;
-}
-
-//Helper for registry
-Reference< XInterface > SAL_CALL XMLSignature_NssImpl::impl_createInstance( 
const Reference< XMultiServiceFactory >& ) {
-    return Reference< XInterface >( *new XMLSignature_NssImpl ) ;
-}
-
-Reference< XSingleServiceFactory > XMLSignature_NssImpl::impl_createFactory( 
const Reference< XMultiServiceFactory >& aServiceManager ) {
-    return ::cppu::createSingleFactory( aServiceManager , 
impl_getImplementationName() , impl_createInstance , 
impl_getSupportedServiceNames() ) ;
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+com_sun_star_xml_crypto_XMLSignature_get_implementation(uno::XComponentContext*
 /*pCtx*/,
+                                                        
uno::Sequence<uno::Any> const& /*rSeq*/)
+{
+    return cppu::acquire(new XMLSignature_NssImpl);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.hxx 
b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.hxx
deleted file mode 100644
index 92f50d9acb26..000000000000
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_XMLSECURITY_SOURCE_XMLSEC_NSS_XMLSIGNATURE_NSSIMPL_HXX
-#define INCLUDED_XMLSECURITY_SOURCE_XMLSEC_NSS_XMLSIGNATURE_NSSIMPL_HXX
-
-#include <sal/config.h>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/uno/Exception.hpp>
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/xml/crypto/XXMLSignature.hpp>
-#include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp>
-#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
-
-class XMLSignature_NssImpl : public ::cppu::WeakImplHelper<
-    css::xml::crypto::XXMLSignature ,
-    css::lang::XServiceInfo >
-{
-    public:
-        explicit XMLSignature_NssImpl();
-        virtual ~XMLSignature_NssImpl() override ;
-
-        //Methods from XXMLSignature
-        virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > 
SAL_CALL generate(
-            const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate 
>& aTemplate ,
-            const css::uno::Reference< css::xml::crypto::XSecurityEnvironment 
>& aEnvironment
-        ) override ;
-
-        virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > 
SAL_CALL validate(
-            const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate 
>& aTemplate ,
-            const css::uno::Reference< css::xml::crypto::XXMLSecurityContext 
>& aContext
-        ) override;
-
-        //Methods from XServiceInfo
-        virtual OUString SAL_CALL getImplementationName() override ;
-
-        virtual sal_Bool SAL_CALL supportsService(
-            const OUString& ServiceName
-        ) override ;
-
-        virtual css::uno::Sequence< OUString > SAL_CALL 
getSupportedServiceNames() override ;
-
-        //Helper for XServiceInfo
-        static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ;
-
-        /// @throws css::uno::RuntimeException
-        static OUString impl_getImplementationName() ;
-
-        //Helper for registry
-        /// @throws css::uno::RuntimeException
-        static css::uno::Reference< css::uno::XInterface > SAL_CALL 
impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory 
>& aServiceManager ) ;
-
-        static css::uno::Reference< css::lang::XSingleServiceFactory > 
impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory 
>& aServiceManager ) ;
-} ;
-
-#endif // INCLUDED_XMLSECURITY_SOURCE_XMLSEC_NSS_XMLSIGNATURE_NSSIMPL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx 
b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx
index 1776c8f86af7..99582c3bf593 100644
--- a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx
@@ -25,7 +25,6 @@
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 
 #include "seinitializer_nssimpl.hxx"
-#include "xmlsignature_nssimpl.hxx"
 #include "xmlsecuritycontext_nssimpl.hxx"
 #include <xsec_xmlsec.hxx>
 #include "securityenvironment_nssimpl.hxx"
@@ -53,10 +52,6 @@ void* nss_component_getFactory( const sal_Char* pImplName , 
void* pServiceManage
                 OUString::createFromAscii( pImplName ),
                 SEInitializer_NssImpl_createInstance, 
SEInitializer_NssImpl_getSupportedServiceNames() ) );
         }
-        else if( 
XMLSignature_NssImpl::impl_getImplementationName().equalsAscii( pImplName ) )
-        {
-            xFactory = XMLSignature_NssImpl::impl_createFactory( static_cast< 
XMultiServiceFactory* >( pServiceManager ) ) ;
-        }
         else if( 
XMLSecurityContext_NssImpl::impl_getImplementationName().equalsAscii( pImplName 
) )
         {
             xFactory = XMLSecurityContext_NssImpl::impl_createFactory( 
static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
diff --git a/xmlsecurity/util/xsec_xmlsec.component 
b/xmlsecurity/util/xsec_xmlsec.component
index 3b6df511fed5..7282c0efb67e 100644
--- a/xmlsecurity/util/xsec_xmlsec.component
+++ b/xmlsecurity/util/xsec_xmlsec.component
@@ -38,7 +38,8 @@
   <implementation 
name="com.sun.star.xml.security.bridge.xmlsec.XMLSecurityContext_NssImpl">
     <service name="com.sun.star.xml.crypto.XMLSecurityContext"/>
   </implementation>
-  <implementation 
name="com.sun.star.xml.security.bridge.xmlsec.XMLSignature_NssImpl">
+  <implementation name="com.sun.star.xml.crypto.XMLSignature"
+    constructor="com_sun_star_xml_crypto_XMLSignature_get_implementation">
     <service name="com.sun.star.xml.crypto.XMLSignature"/>
   </implementation>
 </component>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to