diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-03-15 12:31:22 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-03-16 16:57:52 +0000 |
commit | 9b6ed11d58b9f9d0310f95f914a3d354fc813b54 (patch) | |
tree | 2dd0fffda446c328add362a9c91e68ff78fc9628 /xmlsecurity | |
parent | e7391ca132a9964dc9d870039a104abec044d357 (diff) |
gpg4libre: No need to create separate idl files for gpg services
Change-Id: Ief217cd91e30433c30ac0547d28fb6eab2dc43b0
Reviewed-on: https://gerrit.libreoffice.org/35213
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/Library_xsec_gpg.mk | 6 | ||||
-rw-r--r-- | xmlsecurity/inc/gpg/SEInitializer.hxx (renamed from xmlsecurity/source/gpg/SEInitializer.hxx) | 19 | ||||
-rw-r--r-- | xmlsecurity/inc/xsecgpgdllapi.h | 23 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/GpgComponentFactory.cxx | 70 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/SEInitializer.cxx | 45 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/SecurityEnvironment.cxx | 39 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/SecurityEnvironment.hxx | 21 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/XMLEncryption.cxx | 42 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/XMLEncryption.hxx | 27 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/XMLSecurityContext.cxx | 43 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/XMLSecurityContext.hxx | 24 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/XMLSignature.cxx | 40 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/XMLSignature.hxx | 27 | ||||
-rw-r--r-- | xmlsecurity/source/helper/documentsignaturemanager.cxx | 4 | ||||
-rw-r--r-- | xmlsecurity/util/xsec_gpg.component | 36 |
15 files changed, 38 insertions, 428 deletions
diff --git a/xmlsecurity/Library_xsec_gpg.mk b/xmlsecurity/Library_xsec_gpg.mk index 7f6e814e651a..21d77f50669b 100644 --- a/xmlsecurity/Library_xsec_gpg.mk +++ b/xmlsecurity/Library_xsec_gpg.mk @@ -9,8 +9,6 @@ $(eval $(call gb_Library_Library,xsec_gpg)) -$(eval $(call gb_Library_set_componentfile,xsec_gpg,xmlsecurity/util/xsec_gpg)) - $(eval $(call gb_Library_set_include,xsec_gpg,\ $$(INCLUDE) \ -I$(SRCDIR)/xmlsecurity/inc \ @@ -18,8 +16,7 @@ $(eval $(call gb_Library_set_include,xsec_gpg,\ )) $(eval $(call gb_Library_add_defs,xsec_gpg,\ - -DXSECFW_DLLIMPLEMENTATION \ - -DXMLSEC_CRYPTO_GPG \ + -DXSECGPG_DLLIMPLEMENTATION \ )) $(eval $(call gb_Library_use_custom_headers,xsec_gpg,\ @@ -47,7 +44,6 @@ $(eval $(call gb_Library_add_exception_objects,xsec_gpg,\ xmlsecurity/source/gpg/CertificateImpl \ xmlsecurity/source/gpg/CipherContext \ xmlsecurity/source/gpg/DigestContext \ - xmlsecurity/source/gpg/GpgComponentFactory \ xmlsecurity/source/gpg/SecurityEnvironment \ xmlsecurity/source/gpg/SEInitializer \ xmlsecurity/source/gpg/XMLEncryption \ diff --git a/xmlsecurity/source/gpg/SEInitializer.hxx b/xmlsecurity/inc/gpg/SEInitializer.hxx index 1372c40906f1..d4f375bfd41c 100644 --- a/xmlsecurity/source/gpg/SEInitializer.hxx +++ b/xmlsecurity/inc/gpg/SEInitializer.hxx @@ -16,12 +16,11 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> #include <com/sun/star/xml/crypto/XSEInitializer.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> +#include <xsecgpgdllapi.h> #include <cppuhelper/implbase.hxx> -class SEInitializerGpg : public cppu::WeakImplHelper< css::xml::crypto::XSEInitializer, - css::lang::XServiceInfo > +class XSECGPG_DLLPUBLIC SEInitializerGpg : public cppu::WeakImplHelper< css::xml::crypto::XSEInitializer > { protected: css::uno::Reference< css::uno::XComponentContext > m_xContext; @@ -36,22 +35,8 @@ public: virtual void SAL_CALL freeSecurityContext( const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& securityContext ) override; - - /* 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; }; -OUString SEInitializer_getImplementationName(); - -css::uno::Sequence< OUString > SAL_CALL SEInitializer_getSupportedServiceNames(); - -css::uno::Reference< css::uno::XInterface > SAL_CALL SEInitializer_createInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory > & rxMSF); - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/inc/xsecgpgdllapi.h b/xmlsecurity/inc/xsecgpgdllapi.h new file mode 100644 index 000000000000..741c830b74a7 --- /dev/null +++ b/xmlsecurity/inc/xsecgpgdllapi.h @@ -0,0 +1,23 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_XMLSECURITY_INC_XSECGPGDLLAPI_H +#define INCLUDED_XMLSECURITY_INC_XSECGPGDLLAPI_H + +#include <sal/types.h> + +#if defined(XSECGPG_DLLIMPLEMENTATION) +#define XSECGPG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define XSECGPG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#endif // INCLUDED_XMLSECURITY_INC_XSECGPGDLLAPI_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/GpgComponentFactory.cxx b/xmlsecurity/source/gpg/GpgComponentFactory.cxx deleted file mode 100644 index 3f0f2d1ba8f3..000000000000 --- a/xmlsecurity/source/gpg/GpgComponentFactory.cxx +++ /dev/null @@ -1,70 +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/. - */ - -#include "SecurityEnvironment.hxx" -#include "SEInitializer.hxx" -#include "XMLSignature.hxx" -#include "XMLEncryption.hxx" -#include "XMLSecurityContext.hxx" - -#include <cppuhelper/factory.hxx> - -using namespace cppu; -using namespace css::uno; -using namespace css::lang; -using namespace css::registry; - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_gpg_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ ) -{ - void* pRet = nullptr; - Reference< XSingleServiceFactory > xFactory ; - - if( pImplName != nullptr && pServiceManager != nullptr ) - { -#ifdef XMLSEC_CRYPTO_GPG - if( SEInitializer_getImplementationName().equalsAscii( pImplName ) ) - { - xFactory.set( createSingleFactory( - static_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), - SEInitializer_createInstance, SEInitializer_getSupportedServiceNames() ) ); - } - else if( XMLSignatureGpg::impl_getImplementationName().equalsAscii( pImplName ) ) - { - xFactory = XMLSignatureGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - } - else if( XMLSecurityContextGpg::impl_getImplementationName().equalsAscii( pImplName ) ) - { - xFactory = XMLSecurityContextGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - } - else if( SecurityEnvironmentGpg::impl_getImplementationName().equalsAscii( pImplName ) ) - { - xFactory = SecurityEnvironmentGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - } - else if( XMLEncryptionGpg::impl_getImplementationName().equalsAscii( pImplName ) ) - { - xFactory = XMLEncryptionGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - } -#endif - } - - if( xFactory.is() ) { - xFactory->acquire() ; - pRet = xFactory.get() ; - } - - return pRet ; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/SEInitializer.cxx b/xmlsecurity/source/gpg/SEInitializer.cxx index fce5aa32d00b..af02de9d7ece 100644 --- a/xmlsecurity/source/gpg/SEInitializer.cxx +++ b/xmlsecurity/source/gpg/SEInitializer.cxx @@ -7,14 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "SEInitializer.hxx" +#include "gpg/SEInitializer.hxx" #include "SecurityEnvironment.hxx" +#include "XMLSecurityContext.hxx" -#include <comphelper/processfactory.hxx> -#include <cppuhelper/supportsservice.hxx> - -#include <com/sun/star/xml/crypto/gpg/GpgSecurityEnvironment.hpp> -#include <com/sun/star/xml/crypto/gpg/GpgXMLSecurityContext.hpp> using namespace css; using namespace css::lang; @@ -37,11 +33,9 @@ Reference< XXMLSecurityContext > SAL_CALL SEInitializerGpg::createSecurityContex try { /* Build XML Security Context */ - Reference< XXMLSecurityContext > xSecCtx = xml::crypto::gpg::GpgXMLSecurityContext::create(m_xContext); - - Reference< XSecurityEnvironment > xSecEnv = xml::crypto::gpg::GpgSecurityEnvironment::create(m_xContext); - Reference< XUnoTunnel > xSecEnvTunnel(xSecEnv, uno::UNO_QUERY_THROW); + Reference< XXMLSecurityContext > xSecCtx(new XMLSecurityContextGpg()); + Reference< XSecurityEnvironment > xSecEnv(new SecurityEnvironmentGpg()); sal_Int32 n = xSecCtx->addSecurityEnvironment(xSecEnv); //originally the SecurityEnvironment with the internal slot was set as default xSecCtx->setDefaultSecurityEnvironmentIndex( n ); @@ -57,35 +51,4 @@ void SAL_CALL SEInitializerGpg::freeSecurityContext( const uno::Reference< XXMLS { } -OUString SEInitializer_getImplementationName() -{ - return OUString("com.sun.star.xml.security.SEInitializer_Gpg"); -} - -uno::Sequence< OUString > SAL_CALL SEInitializer_getSupportedServiceNames() -{ - return {"com.sun.star.xml.crypto.gpg.GpgSEInitializer"}; -} - -uno::Reference< uno::XInterface > SAL_CALL SEInitializer_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rxMSF) -{ - return static_cast<cppu::OWeakObject*>(new SEInitializerGpg(comphelper::getComponentContext(rxMSF))); -} - -/* XServiceInfo */ -OUString SAL_CALL SEInitializerGpg::getImplementationName() -{ - return SEInitializer_getImplementationName(); -} - -sal_Bool SAL_CALL SEInitializerGpg::supportsService( const OUString& rServiceName ) -{ - return cppu::supportsService(this, rServiceName); -} - -uno::Sequence< OUString > SAL_CALL SEInitializerGpg::getSupportedServiceNames() -{ - return SEInitializer_getSupportedServiceNames(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx index eb167b2732a9..51484e2c3c29 100644 --- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx +++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx @@ -32,45 +32,6 @@ SecurityEnvironmentGpg::~SecurityEnvironmentGpg() { } -/* XServiceInfo */ -OUString SAL_CALL SecurityEnvironmentGpg::getImplementationName() -{ - return impl_getImplementationName(); -} - -/* XServiceInfo */ -sal_Bool SAL_CALL SecurityEnvironmentGpg::supportsService(const OUString& serviceName) -{ - return cppu::supportsService(this, serviceName); -} - -/* XServiceInfo */ -Sequence< OUString > SAL_CALL SecurityEnvironmentGpg::getSupportedServiceNames() -{ - return impl_getSupportedServiceNames() ; -} - -//Helper for XServiceInfo -Sequence< OUString > SecurityEnvironmentGpg::impl_getSupportedServiceNames() -{ - return { "com.sun.star.xml.crypto.gpg.GpgSecurityEnvironment" } ; -} - -OUString SecurityEnvironmentGpg::impl_getImplementationName() -{ - return OUString("com.sun.star.xml.security.SecurityEnvironment_Gpg"); -} - -//Helper for registry -Reference< XInterface > SAL_CALL SecurityEnvironmentGpg::impl_createInstance( const Reference< XMultiServiceFactory >& ) -{ - return Reference< XInterface >( *new SecurityEnvironmentGpg ) ; -} - -Reference< XSingleServiceFactory > SecurityEnvironmentGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) { - return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ; -} - /* XUnoTunnel */ sal_Int64 SAL_CALL SecurityEnvironmentGpg::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.hxx b/xmlsecurity/source/gpg/SecurityEnvironment.hxx index 1b5831e48778..51a263fa5e5d 100644 --- a/xmlsecurity/source/gpg/SecurityEnvironment.hxx +++ b/xmlsecurity/source/gpg/SecurityEnvironment.hxx @@ -17,8 +17,6 @@ #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/uno/SecurityException.hpp> #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/security/XCertificate.hpp> @@ -28,7 +26,6 @@ class SecurityEnvironmentGpg : public cppu::WeakImplHelper< css::xml::crypto::XSecurityEnvironment, - css::lang::XServiceInfo, css::lang::XUnoTunnel > { public: @@ -36,24 +33,6 @@ public: virtual ~SecurityEnvironmentGpg() override; //Methods from XSecurityEnvironment - - //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() ; - - static OUString impl_getImplementationName(); - - //Helper for registry - 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 ) ; - virtual ::sal_Int32 SAL_CALL verifyCertificate( const css::uno::Reference< css::security::XCertificate >& xCert, diff --git a/xmlsecurity/source/gpg/XMLEncryption.cxx b/xmlsecurity/source/gpg/XMLEncryption.cxx index b01e9fde4434..65083ff68bac 100644 --- a/xmlsecurity/source/gpg/XMLEncryption.cxx +++ b/xmlsecurity/source/gpg/XMLEncryption.cxx @@ -9,8 +9,6 @@ #include "XMLEncryption.hxx" -#include <cppuhelper/supportsservice.hxx> - using namespace css::uno; using namespace css::lang; using namespace css::xml::wrapper; @@ -36,44 +34,4 @@ Reference< XXMLEncryptionTemplate > SAL_CALL XMLEncryptionGpg::decrypt(const Ref return nullptr; } -/* XServiceInfo */ -OUString SAL_CALL XMLEncryptionGpg::getImplementationName() -{ - return impl_getImplementationName() ; -} - -/* XServiceInfo */ -sal_Bool SAL_CALL XMLEncryptionGpg::supportsService(const OUString& serviceName) -{ - return cppu::supportsService(this, serviceName); -} - -/* XServiceInfo */ -Sequence< OUString > SAL_CALL XMLEncryptionGpg::getSupportedServiceNames() -{ - return impl_getSupportedServiceNames() ; -} - -//Helper for XServiceInfo -Sequence< OUString > XMLEncryptionGpg::impl_getSupportedServiceNames() -{ - return {"com.sun.star.xml.crypto.gpg.GpgXMLEncryption"}; -} - -OUString XMLEncryptionGpg::impl_getImplementationName() -{ - return OUString("com.sun.star.xml.security.XMLEncryption_Gpg"); -} - -//Helper for registry -Reference< XInterface > SAL_CALL XMLEncryptionGpg::impl_createInstance( const Reference< XMultiServiceFactory >& ) -{ - return Reference< XInterface >(*new XMLEncryptionGpg); -} - -Reference< XSingleServiceFactory > XMLEncryptionGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) -{ - return ::cppu::createSingleFactory(aServiceManager, impl_getImplementationName(), impl_createInstance, impl_getSupportedServiceNames()); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/XMLEncryption.hxx b/xmlsecurity/source/gpg/XMLEncryption.hxx index 0addc77e3936..d9c6b508c666 100644 --- a/xmlsecurity/source/gpg/XMLEncryption.hxx +++ b/xmlsecurity/source/gpg/XMLEncryption.hxx @@ -12,20 +12,16 @@ #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/XXMLEncryption.hpp> #include <com/sun/star/xml/crypto/XXMLEncryptionTemplate.hpp> #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> #include <com/sun/star/xml/crypto/XMLEncryptionException.hpp> -class XMLEncryptionGpg : public cppu::WeakImplHelper< css::xml::crypto::XXMLEncryption, - css::lang::XServiceInfo > +class XMLEncryptionGpg : public cppu::WeakImplHelper< css::xml::crypto::XXMLEncryption > { public: explicit XMLEncryptionGpg(); @@ -39,26 +35,7 @@ public: virtual css::uno::Reference< css::xml::crypto::XXMLEncryptionTemplate > SAL_CALL decrypt( const css::uno::Reference< css::xml::crypto::XXMLEncryptionTemplate >& aTemplate, const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& aContext) override; - - // 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(); - - static OUString impl_getImplementationName(); - - // Helper for registry - 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_GPG_XMLENCRYPTION_HXX diff --git a/xmlsecurity/source/gpg/XMLSecurityContext.cxx b/xmlsecurity/source/gpg/XMLSecurityContext.cxx index 867785295f29..a05ea7e40c55 100644 --- a/xmlsecurity/source/gpg/XMLSecurityContext.cxx +++ b/xmlsecurity/source/gpg/XMLSecurityContext.cxx @@ -10,8 +10,6 @@ #include "XMLSecurityContext.hxx" #include "SecurityEnvironment.hxx" -#include <cppuhelper/supportsservice.hxx> - using namespace css::uno; using namespace css::lang; using namespace css::xml::crypto; @@ -67,45 +65,4 @@ void SAL_CALL XMLSecurityContextGpg::setDefaultSecurityEnvironmentIndex(sal_Int3 m_nDefaultEnvIndex = nDefaultEnvIndex; } -/* XServiceInfo */ -OUString SAL_CALL XMLSecurityContextGpg::getImplementationName() -{ - return impl_getImplementationName() ; -} - -/* XServiceInfo */ -sal_Bool SAL_CALL XMLSecurityContextGpg::supportsService( const OUString& serviceName) -{ - return cppu::supportsService(this, serviceName); -} - -/* XServiceInfo */ -Sequence< OUString > SAL_CALL XMLSecurityContextGpg::getSupportedServiceNames() -{ - return impl_getSupportedServiceNames() ; -} - -//Helper for XServiceInfo -Sequence< OUString > XMLSecurityContextGpg::impl_getSupportedServiceNames() -{ - return {"com.sun.star.xml.crypto.gpg.GpgXMLSecurityContext"}; -} - -OUString XMLSecurityContextGpg::impl_getImplementationName() -{ - return OUString("com.sun.star.xml.security.XMLSecurityContext_Gpg"); -} - -//Helper for registry -Reference< XInterface > SAL_CALL XMLSecurityContextGpg::impl_createInstance( const Reference< XMultiServiceFactory >& ) -{ - return Reference< XInterface >( *new XMLSecurityContextGpg ) ; -} - -Reference< XSingleServiceFactory > XMLSecurityContextGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) -{ - return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ; -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/XMLSecurityContext.hxx b/xmlsecurity/source/gpg/XMLSecurityContext.hxx index c1cd0f29c1c9..3402d33aa9cd 100644 --- a/xmlsecurity/source/gpg/XMLSecurityContext.hxx +++ b/xmlsecurity/source/gpg/XMLSecurityContext.hxx @@ -26,8 +26,7 @@ #include <vector> -class XMLSecurityContextGpg : public cppu::WeakImplHelper< css::xml::crypto::XXMLSecurityContext, - css::lang::XServiceInfo > +class XMLSecurityContextGpg : public cppu::WeakImplHelper< css::xml::crypto::XXMLSecurityContext > { private: std::vector< css::uno::Reference< css::xml::crypto::XSecurityEnvironment > > m_vSecurityEnvironments; @@ -35,7 +34,7 @@ private: sal_Int32 m_nDefaultEnvIndex; public: - XMLSecurityContextGpg() ; + XMLSecurityContextGpg(); virtual ~XMLSecurityContextGpg() override; // XXMLSecurityContext @@ -51,25 +50,6 @@ public: virtual sal_Int32 SAL_CALL getDefaultSecurityEnvironmentIndex() override; virtual void SAL_CALL setDefaultSecurityEnvironmentIndex( sal_Int32 nDefaultEnvIndex ) override; - - // 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; - - // XServiceInfo - static css::uno::Sequence< OUString > impl_getSupportedServiceNames(); - - static OUString impl_getImplementationName(); - - //Helper for registry - 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_GPG_XMLSECURITYCONTEXT_HXX diff --git a/xmlsecurity/source/gpg/XMLSignature.cxx b/xmlsecurity/source/gpg/XMLSignature.cxx index e174a419a174..6bebb698d434 100644 --- a/xmlsecurity/source/gpg/XMLSignature.cxx +++ b/xmlsecurity/source/gpg/XMLSignature.cxx @@ -40,44 +40,4 @@ Reference< XXMLSignatureTemplate > SAL_CALL XMLSignatureGpg::validate(const Refe return nullptr; } -/* XServiceInfo */ -OUString SAL_CALL XMLSignatureGpg::getImplementationName() -{ - return impl_getImplementationName() ; -} - -/* XServiceInfo */ -sal_Bool SAL_CALL XMLSignatureGpg::supportsService( const OUString& serviceName) -{ - return cppu::supportsService(this, serviceName); -} - -/* XServiceInfo */ -Sequence< OUString > SAL_CALL XMLSignatureGpg::getSupportedServiceNames() -{ - return impl_getSupportedServiceNames() ; -} - -//Helper for XServiceInfo -Sequence< OUString > XMLSignatureGpg::impl_getSupportedServiceNames() -{ - return {"com.sun.star.xml.crypto.gpg.GpgXMLSignature"}; -} - -OUString XMLSignatureGpg::impl_getImplementationName() -{ - return OUString("com.sun.star.xml.security.XMLSignature_Gpg"); -} - -//Helper for registry -Reference< XInterface > SAL_CALL XMLSignatureGpg::impl_createInstance( const Reference< XMultiServiceFactory >& ) -{ - return Reference< XInterface >( *new XMLSignatureGpg ) ; -} - -Reference< XSingleServiceFactory > XMLSignatureGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) -{ - return cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/XMLSignature.hxx b/xmlsecurity/source/gpg/XMLSignature.hxx index ea076d9d47bb..8e8a49cb3ad5 100644 --- a/xmlsecurity/source/gpg/XMLSignature.hxx +++ b/xmlsecurity/source/gpg/XMLSignature.hxx @@ -12,20 +12,16 @@ #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> #include <com/sun/star/xml/crypto/XMLSignatureException.hpp> -class XMLSignatureGpg : public cppu::WeakImplHelper< css::xml::crypto::XXMLSignature, - css::lang::XServiceInfo > +class XMLSignatureGpg : public cppu::WeakImplHelper< css::xml::crypto::XXMLSignature > { public: explicit XMLSignatureGpg(); @@ -41,26 +37,7 @@ public: const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate >& aTemplate , const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& aContext ) override; - - // 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() ; - - static OUString impl_getImplementationName(); - - //Helper for registry - 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_GPG_XMLSIGNATURE_HXX diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index e0a61e2ba377..7a7e10c3dc31 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -18,6 +18,7 @@ */ #include <documentsignaturemanager.hxx> +#include "gpg/SEInitializer.hxx" #include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/embed/ElementModes.hpp> @@ -25,7 +26,6 @@ #include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/xml/crypto/SEInitializer.hpp> -#include <com/sun/star/xml/crypto/gpg/GpgSEInitializer.hpp> #include <comphelper/storagehelper.hxx> #include <rtl/ustrbuf.hxx> @@ -56,7 +56,7 @@ bool DocumentSignatureManager::init() mxSEInitializer = xml::crypto::SEInitializer::create(mxContext); #if !defined(MACOSX) && !defined(WNT) - mxGpgSEInitializer = xml::crypto::gpg::GpgSEInitializer::create(mxContext); + mxGpgSEInitializer.set(new SEInitializerGpg(mxContext)); #endif if (mxSEInitializer.is()) diff --git a/xmlsecurity/util/xsec_gpg.component b/xmlsecurity/util/xsec_gpg.component deleted file mode 100644 index 0a684d164666..000000000000 --- a/xmlsecurity/util/xsec_gpg.component +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * 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/. - * ---> - -<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="xsec_gpg" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.xml.security.SEInitializer_Gpg"> - <service name="com.sun.star.xml.crypto.gpg.GpgSEInitializer"/> - </implementation> - <implementation name="com.sun.star.xml.security.SecurityEnvironment_Gpg"> - <service name="com.sun.star.xml.crypto.gpg.GpgSecurityEnvironment"/> - </implementation> - <!-- TODO Not implemented yet - <implementation name="com.sun.star.xml.security.XMLDocumentWrapper_Gpg"> - <service name="com.sun.star.xml.wrapper.XMLDocumentWrapper"/> - </implementation> - <implementation name="com.sun.star.xml.security.XMLElementWrapper_Gpg"> - <service name="com.sun.star.xml.wrapper.XMLElementWrapper"/> - </implementation>--> - <implementation name="com.sun.star.xml.security.XMLEncryption_Gpg"> - <service name="com.sun.star.xml.crypto.gpg.GpgXMLEncryption"/> - </implementation> - <implementation name="com.sun.star.xml.security.XMLSecurityContext_Gpg"> - <service name="com.sun.star.xml.crypto.gpg.GpgXMLSecurityContext"/> - </implementation> - <implementation name="com.sun.star.xml.security.XMLSignature_Gpg"> - <service name="com.sun.star.xml.crypto.gpg.GpgXMLSignature"/> - </implementation>--> -</component> - |