xmlsecurity: convert last non-uno-consturctor based service

Change-Id: Ib8a16c69aa2a05118e329a6552682b7a21d4536a
Reviewed-on: https://gerrit.libreoffice.org/57023
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
diff --git a/xmlsecurity/Library_xsec_xmlsec.mk b/xmlsecurity/Library_xsec_xmlsec.mk
index 0c71188..cc4bbdb 100644
--- a/xmlsecurity/Library_xsec_xmlsec.mk
+++ b/xmlsecurity/Library_xsec_xmlsec.mk
@@ -65,7 +65,6 @@ $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\
	xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl \
	xmlsecurity/source/xmlsec/xmlsec_init \
	xmlsecurity/source/xmlsec/xmlstreamio \
	xmlsecurity/source/xmlsec/xsec_xmlsec \
	xmlsecurity/source/xmlsec/nss/ciphercontext \
	xmlsecurity/source/xmlsec/nss/digestcontext \
	xmlsecurity/source/xmlsec/nss/nssinitializer \
diff --git a/xmlsecurity/inc/gpg/SEInitializer.hxx b/xmlsecurity/inc/gpg/SEInitializer.hxx
index 3cc89da..7909acc 100644
--- a/xmlsecurity/inc/gpg/SEInitializer.hxx
+++ b/xmlsecurity/inc/gpg/SEInitializer.hxx
@@ -39,19 +39,12 @@ public:
    virtual void SAL_CALL freeSecurityContext( const css::uno::Reference<
        css::xml::crypto::XXMLSecurityContext >& securityContext ) override;

    static css::uno::Sequence< OUString > impl_getSupportedServiceNames();

    static OUString impl_getImplementationName();

    /* 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;

    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
diff --git a/xmlsecurity/source/gpg/SEInitializer.cxx b/xmlsecurity/source/gpg/SEInitializer.cxx
index e7c1910..689d00f 100644
--- a/xmlsecurity/source/gpg/SEInitializer.cxx
+++ b/xmlsecurity/source/gpg/SEInitializer.cxx
@@ -22,7 +22,6 @@ using namespace css::lang;
using namespace css::uno;
using namespace css::xml::crypto;


SEInitializerGpg::SEInitializerGpg()
{
    // Also init GpgME while we're at it
@@ -57,28 +56,7 @@ void SAL_CALL SEInitializerGpg::freeSecurityContext( const uno::Reference< XXMLS
{
}



uno::Reference< uno::XInterface > SAL_CALL SEInitializerGpg::impl_createInstance( const uno::Reference< lang::XMultiServiceFactory > & /*rxMSF*/)
{
    return static_cast<cppu::OWeakObject*>(new SEInitializerGpg());
}

uno::Reference< XSingleServiceFactory > SEInitializerGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
    return cppu::createSingleFactory( aServiceManager, impl_getImplementationName(), impl_createInstance, impl_getSupportedServiceNames() ) ;
}

/* XServiceInfo */
OUString SEInitializerGpg::impl_getImplementationName()
{
    return OUString("com.sun.star.xml.security.SEInitializer_Gpg");
}

uno::Sequence< OUString > SEInitializerGpg::impl_getSupportedServiceNames()
{
    return {"com.sun.star.xml.crypto.GPGSEInitializer"};
}

sal_Bool SAL_CALL SEInitializerGpg::supportsService( const OUString& rServiceName )
{
    return cppu::supportsService(this, rServiceName);
@@ -86,12 +64,19 @@ sal_Bool SAL_CALL SEInitializerGpg::supportsService( const OUString& rServiceNam

uno::Sequence< OUString > SAL_CALL SEInitializerGpg::getSupportedServiceNames()
{
    return impl_getSupportedServiceNames();
    return {"com.sun.star.xml.crypto.GPGSEInitializer"};
}

OUString SAL_CALL SEInitializerGpg::getImplementationName()
{
    return impl_getImplementationName();
    return OUString("com.sun.star.xml.security.SEInitializer_Gpg");
}

extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
com_sun_star_xml_security_SEInitializer_Gpg_get_implementation(
    uno::XComponentContext* /*pCtx*/, uno::Sequence<uno::Any> const& /*rSeq*/)
{
    return cppu::acquire(new SEInitializerGpg());
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
deleted file mode 100644
index aeee893..0000000
--- a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
+++ /dev/null
@@ -1,68 +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 .
 */


#include <sal/config.h>

#include <cppuhelper/factory.hxx>

#include <config_gpgme.h>
#if HAVE_FEATURE_GPGME
# include <gpg/xmlsignature_gpgimpl.hxx>
# include <gpg/SEInitializer.hxx>
#endif

using namespace ::cppu;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;

extern "C"
{

SAL_DLLPUBLIC_EXPORT void* xsec_xmlsec_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ )
{
    void* pRet = nullptr;
    Reference< XInterface > xFactory ;

    if( pImplName != nullptr ) {
#if HAVE_FEATURE_GPGME
        if( XMLSignature_GpgImpl::impl_getImplementationName().equalsAscii( pImplName ) )
        {
            xFactory = XMLSignature_GpgImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
        }
        else if( SEInitializerGpg::impl_getImplementationName().equalsAscii( pImplName ) )
        {
            xFactory = SEInitializerGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
        }
#else
        (void)pServiceManager;
#endif
    }

    if( xFactory.is() ) {
        xFactory->acquire() ;
        pRet = xFactory.get() ;
    }

    return pRet ;
}

}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/util/xsec_xmlsec.component b/xmlsecurity/util/xsec_xmlsec.component
index 6ea539f..d219dc6 100644
--- a/xmlsecurity/util/xsec_xmlsec.component
+++ b/xmlsecurity/util/xsec_xmlsec.component
@@ -18,7 +18,7 @@
 -->

<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
    prefix="xsec_xmlsec" xmlns="http://openoffice.org/2010/uno-components">
    xmlns="http://openoffice.org/2010/uno-components">
  <implementation name="com.sun.star.xml.crypto.NSSInitializer"
    constructor="com_sun_star_xml_crypto_NSSInitializer_get_implementation">
    <service name="com.sun.star.xml.crypto.NSSInitializer"/>
@@ -27,7 +27,8 @@
    constructor="com_sun_star_xml_crypto_SEInitializer_get_implementation">
    <service name="com.sun.star.xml.crypto.SEInitializer"/>
  </implementation>
  <implementation name="com.sun.star.xml.security.SEInitializer_Gpg">
  <implementation name="com.sun.star.xml.security.SEInitializer_Gpg"
    constructor="com_sun_star_xml_security_SEInitializer_Gpg_get_implementation">
    <service name="com.sun.star.xml.crypto.GPGSEInitializer"/>
  </implementation>
  <implementation name="com.sun.star.xml.crypto.SecurityEnvironment"