From af1eee15fdacbef4d43f130750b7dbee432ef39b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 13 Jul 2020 20:17:06 +0200 Subject: shell/cmdmail: create instances with uno constructors See tdf#74608 for motivation. Change-Id: Ifeece1a72c594348f52e3edbee503a16a99619e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98682 Tested-by: Jenkins Reviewed-by: Noel Grandin --- shell/Library_cmdmail.mk | 1 - shell/source/cmdmail/cmdmail.component | 5 ++- shell/source/cmdmail/cmdmailentry.cxx | 67 ---------------------------------- shell/source/cmdmail/cmdmailsuppl.cxx | 19 ++++------ 4 files changed, 11 insertions(+), 81 deletions(-) delete mode 100644 shell/source/cmdmail/cmdmailentry.cxx (limited to 'shell') diff --git a/shell/Library_cmdmail.mk b/shell/Library_cmdmail.mk index 4841fde2f1e8..e3af3fb51a67 100644 --- a/shell/Library_cmdmail.mk +++ b/shell/Library_cmdmail.mk @@ -21,7 +21,6 @@ $(eval $(call gb_Library_use_libraries,cmdmail,\ $(eval $(call gb_Library_set_componentfile,cmdmail,shell/source/cmdmail/cmdmail)) $(eval $(call gb_Library_add_exception_objects,cmdmail,\ - shell/source/cmdmail/cmdmailentry \ shell/source/cmdmail/cmdmailmsg \ shell/source/cmdmail/cmdmailsuppl \ )) diff --git a/shell/source/cmdmail/cmdmail.component b/shell/source/cmdmail/cmdmail.component index ea9ce04d243c..6b11062697d8 100644 --- a/shell/source/cmdmail/cmdmail.component +++ b/shell/source/cmdmail/cmdmail.component @@ -18,8 +18,9 @@ --> - + xmlns="http://openoffice.org/2010/uno-components"> + diff --git a/shell/source/cmdmail/cmdmailentry.cxx b/shell/source/cmdmail/cmdmailentry.cxx deleted file mode 100644 index 750277d1fe6f..000000000000 --- a/shell/source/cmdmail/cmdmailentry.cxx +++ /dev/null @@ -1,67 +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 -#include -#include "cmdmailsuppl.hxx" - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::cppu; -using com::sun::star::system::XSimpleMailClientSupplier; - -#define COMP_SERVICE_NAME "com.sun.star.system.SimpleCommandMail" -#define COMP_IMPL_NAME "com.sun.star.comp.system.SimpleCommandMail" - -namespace -{ - Reference< XInterface > createInstance( const Reference< XComponentContext >& xContext ) - { - return Reference< XInterface >( static_cast< XSimpleMailClientSupplier* >( new CmdMailSuppl( xContext ) ) ); - } -} - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void* cmdmail_component_getFactory( - const char* pImplName, - SAL_UNUSED_PARAMETER void* /*pSrvManager*/, - SAL_UNUSED_PARAMETER void* /*pRegistryKey*/ ) -{ - Reference< XSingleComponentFactory > xFactory; - - if (0 == ::rtl_str_compare( pImplName, COMP_IMPL_NAME )) - { - xFactory = ::cppu::createSingleComponentFactory( - createInstance, - COMP_IMPL_NAME, - Sequence< OUString > { COMP_SERVICE_NAME } ); - } - - if (xFactory.is()) - xFactory->acquire(); - - return xFactory.get(); -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/cmdmail/cmdmailsuppl.cxx b/shell/source/cmdmail/cmdmailsuppl.cxx index 2867eae63d7c..12bd5101dba8 100644 --- a/shell/source/cmdmail/cmdmailsuppl.cxx +++ b/shell/source/cmdmail/cmdmailsuppl.cxx @@ -49,16 +49,6 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::configuration; -namespace -{ - Sequence< OUString > Component_getSupportedServiceNames() - { - Sequence< OUString > aRet { "com.sun.star.system.SimpleCommandMail" }; - return aRet; - } - -} - CmdMailSuppl::CmdMailSuppl( const Reference< XComponentContext >& xContext ) : WeakImplHelper< XSimpleMailClientSupplier, XSimpleMailClient, XServiceInfo >() { @@ -286,7 +276,14 @@ sal_Bool SAL_CALL CmdMailSuppl::supportsService( const OUString& ServiceName ) Sequence< OUString > SAL_CALL CmdMailSuppl::getSupportedServiceNames( ) { - return Component_getSupportedServiceNames(); + return { "com.sun.star.system.SimpleCommandMail" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +shell_CmdMailSuppl_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence const&) +{ + return cppu::acquire(new CmdMailSuppl(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit