[Libreoffice-commits] core.git: framework/inc framework/Library_fwk.mk framework/source framework/util
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 9 06:47:09 UTC 2020
framework/Library_fwk.mk | 1
framework/inc/recording/dispatchrecorder.hxx | 10 --
framework/inc/services.h | 1
framework/inc/uielement/langselectionmenucontroller.hxx | 10 --
framework/source/recording/dispatchrecorder.cxx | 34 ++++---
framework/source/register/registertemp.cxx | 63 -------------
framework/source/uielement/langselectionmenucontroller.cxx | 30 ++++--
framework/util/fwk.component | 8 +
8 files changed, 60 insertions(+), 97 deletions(-)
New commits:
commit c435ee5c9c9882d0817039d5e53990418c3d1066
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Wed Jul 8 18:39:27 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 9 08:46:19 2020 +0200
framework: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: Ia2d9447b687f0792d9d3a98d30cd2b8fe54049ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98388
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index 61bb9d825906..12434b7a4b74 100644
--- a/framework/Library_fwk.mk
+++ b/framework/Library_fwk.mk
@@ -150,7 +150,6 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/loadenv/targethelper \
framework/source/recording/dispatchrecorder \
framework/source/recording/dispatchrecordersupplier \
- framework/source/register/registertemp \
framework/source/services/ContextChangeEventMultiplexer \
framework/source/services/autorecovery \
framework/source/services/desktop \
diff --git a/framework/inc/recording/dispatchrecorder.hxx b/framework/inc/recording/dispatchrecorder.hxx
index 54a9cb0e2185..806fe3cb2f22 100644
--- a/framework/inc/recording/dispatchrecorder.hxx
+++ b/framework/inc/recording/dispatchrecorder.hxx
@@ -57,12 +57,10 @@ class DispatchRecorder final
DispatchRecorder( const css::uno::Reference< css::uno::XComponentContext >& xSMGR );
virtual ~DispatchRecorder() override;
- // XInterface, XTypeProvider, XServiceInfo
- DECLARE_XSERVICEINFO_NOFACTORY
- /* Helper for registry */
- /// @throws css::uno::Exception
- static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
- static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
+ /* interface XServiceInfo */
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
// XDispatchRecorder
virtual void SAL_CALL startRecording ( const css::uno::Reference< css::frame::XFrame >& xFrame ) override;
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 8e1044811157..01a93213abd9 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -35,7 +35,6 @@ namespace framework{
#define IMPLEMENTATIONNAME_QUICKLAUNCHER "com.sun.star.comp.desktop.QuickstartWrapper"
#define IMPLEMENTATIONNAME_FWK_TASKCREATOR "com.sun.star.comp.framework.TaskCreator"
-#define IMPLEMENTATIONNAME_LANGUAGESELECTIONMENUCONTROLLER "com.sun.star.comp.framework.LanguageSelectionMenuController"
} // namespace framework
diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx
index cdf682e3e02b..32f2a45bac9c 100644
--- a/framework/inc/uielement/langselectionmenucontroller.hxx
+++ b/framework/inc/uielement/langselectionmenucontroller.hxx
@@ -38,12 +38,10 @@ namespace framework
LanguageSelectionMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext );
virtual ~LanguageSelectionMenuController() override;
- // XServiceInfo
- DECLARE_XSERVICEINFO_NOFACTORY
- /* Helper for registry */
- /// @throws css::uno::Exception
- static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
- static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
+ /* interface XServiceInfo */
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
// XPopupMenuController
virtual void SAL_CALL updatePopupMenu() override;
diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx
index 8ed03a030c8e..0a370ef3fa0b 100644
--- a/framework/source/recording/dispatchrecorder.cxx
+++ b/framework/source/recording/dispatchrecorder.cxx
@@ -38,17 +38,21 @@ namespace framework{
// XInterface, XTypeProvider, XServiceInfo
-DEFINE_XSERVICEINFO_MULTISERVICE_2(
- DispatchRecorder,
- ::cppu::OWeakObject,
- "com.sun.star.frame.DispatchRecorder",
- "com.sun.star.comp.framework.DispatchRecorder")
-
-DEFINE_INIT_SERVICE(
- DispatchRecorder,
- {
- }
-)
+OUString SAL_CALL DispatchRecorder::getImplementationName()
+{
+ return "com.sun.star.comp.framework.DispatchRecorder";
+}
+
+sal_Bool SAL_CALL DispatchRecorder::supportsService( const OUString& sServiceName )
+{
+ return cppu::supportsService(this, sServiceName);
+}
+
+css::uno::Sequence< OUString > SAL_CALL DispatchRecorder::getSupportedServiceNames()
+{
+ return { "com.sun.star.frame.DispatchRecorder" };
+}
+
static void flatten_struct_members(
@@ -427,4 +431,12 @@ void SAL_CALL DispatchRecorder::replaceByIndex(sal_Int32 idx, const css::uno::An
} // namespace framework
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+framework_DispatchRecorder_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
+{
+ return cppu::acquire(new framework::DispatchRecorder(context));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/register/registertemp.cxx b/framework/source/register/registertemp.cxx
deleted file mode 100644
index 3f848f474cc6..000000000000
--- a/framework/source/register/registertemp.cxx
+++ /dev/null
@@ -1,63 +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 <macros/registration.hxx>
-
-/*=================================================================================================================
- Add new include and new register info to for new services.
-
- Example:
-
- #include <service1.hxx>
- #include <service2.hxx>
-
- COMPONENTGETFACTORY ( IFFACTORIE( Service1 )
- else
- IFFACTORIE( Service2 )
- )
-=================================================================================================================*/
-#include <services/mediatypedetectionhelper.hxx>
-#include <dispatch/mailtodispatcher.hxx>
-#include <dispatch/oxt_handler.hxx>
-#include <dispatch/popupmenudispatcher.hxx>
-#include <dispatch/servicehandler.hxx>
-#include <dispatch/dispatchdisabler.hxx>
-#include <framework/dispatchhelper.hxx>
-#include <recording/dispatchrecorder.hxx>
-#include <recording/dispatchrecordersupplier.hxx>
-#include <services/uriabbreviation.hxx>
-#include <uielement/fontmenucontroller.hxx>
-#include <uielement/fontsizemenucontroller.hxx>
-#include <uielement/footermenucontroller.hxx>
-#include <uielement/headermenucontroller.hxx>
-#include <uielement/langselectionmenucontroller.hxx>
-#include <uielement/macrosmenucontroller.hxx>
-#include <uielement/newmenucontroller.hxx>
-#include <uielement/toolbarmodemenucontroller.hxx>
-#include <uielement/toolbarsmenucontroller.hxx>
-#include <jobs/helponstartup.hxx>
-#include <dispatch/systemexec.hxx>
-#include <jobs/shelljob.hxx>
-
-COMPONENTGETFACTORY ( fwk,
- IFFACTORY( ::framework::DispatchRecorder ) else
- IFFACTORY( ::framework::LanguageSelectionMenuController )
- )
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx
index 3d971f43f8fc..d19bf519a28e 100644
--- a/framework/source/uielement/langselectionmenucontroller.cxx
+++ b/framework/source/uielement/langselectionmenucontroller.cxx
@@ -53,13 +53,23 @@ using namespace com::sun::star::util;
namespace framework
{
-DEFINE_XSERVICEINFO_MULTISERVICE_2 ( LanguageSelectionMenuController ,
- OWeakObject ,
- SERVICENAME_POPUPMENUCONTROLLER ,
- IMPLEMENTATIONNAME_LANGUAGESELECTIONMENUCONTROLLER
- )
+// XInterface, XTypeProvider, XServiceInfo
+
+OUString SAL_CALL LanguageSelectionMenuController::getImplementationName()
+{
+ return "com.sun.star.comp.framework.LanguageSelectionMenuController";
+}
+
+sal_Bool SAL_CALL LanguageSelectionMenuController::supportsService( const OUString& sServiceName )
+{
+ return cppu::supportsService(this, sServiceName);
+}
+
+css::uno::Sequence< OUString > SAL_CALL LanguageSelectionMenuController::getSupportedServiceNames()
+{
+ return { SERVICENAME_POPUPMENUCONTROLLER };
+}
-DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {} )
LanguageSelectionMenuController::LanguageSelectionMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext )
: svt::PopupMenuControllerBase(xContext)
@@ -283,4 +293,12 @@ void SAL_CALL LanguageSelectionMenuController::initialize( const Sequence< Any >
}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+framework_LanguageSelectionMenuController_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
+{
+ return cppu::acquire(new framework::LanguageSelectionMenuController(context));
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 24ab6d67b51a..79538a58e8e4 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -18,7 +18,7 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="fwk" xmlns="http://openoffice.org/2010/uno-components">
+ xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.frame.SessionListener"
constructor="com_sun_star_comp_frame_SessionListener_get_implementation">
<service name="com.sun.star.frame.SessionListener"/>
@@ -212,10 +212,12 @@
constructor="com_sun_star_comp_framework_ResourceMenuController_get_implementation">
<service name="com.sun.star.frame.PopupMenuController"/>
</implementation>
- <implementation name="com.sun.star.comp.framework.LanguageSelectionMenuController">
+ <implementation name="com.sun.star.comp.framework.LanguageSelectionMenuController"
+ constructor="framework_LanguageSelectionMenuController_get_implementation">
<service name="com.sun.star.frame.PopupMenuController"/>
</implementation>
- <implementation name="com.sun.star.comp.framework.DispatchRecorder">
+ <implementation name="com.sun.star.comp.framework.DispatchRecorder"
+ constructor="framework_DispatchRecorder_get_implementation">
<service name="com.sun.star.frame.DispatchRecorder"/>
</implementation>
<implementation name="com.sun.star.comp.framework.DispatchRecorderSupplier"
More information about the Libreoffice-commits
mailing list