summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-13 20:17:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-14 14:40:49 +0200
commitaf1eee15fdacbef4d43f130750b7dbee432ef39b (patch)
tree35efdcf6a764e3cf39fbde51de7da82c1cea7d68 /shell
parent616a47c9570f9ce67b18a124f08f4a342bff3468 (diff)
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'shell')
-rw-r--r--shell/Library_cmdmail.mk1
-rw-r--r--shell/source/cmdmail/cmdmail.component5
-rw-r--r--shell/source/cmdmail/cmdmailentry.cxx67
-rw-r--r--shell/source/cmdmail/cmdmailsuppl.cxx19
4 files changed, 11 insertions, 81 deletions
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 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="cmdmail" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.system.SimpleCommandMail">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.system.SimpleCommandMail"
+ constructor="shell_CmdMailSuppl_get_implementation">
<service name="com.sun.star.system.SimpleCommandMail"/>
</implementation>
</component>
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 <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-#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<css::uno::Any> const&)
+{
+ return cppu::acquire(new CmdMailSuppl(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */