dbaccess/Library_dbahsql.mk | 1 dbaccess/source/ui/misc/databaseobjectview.cxx | 6 ++-- embeddedobj/Library_embobj.mk | 1 embeddedobj/source/general/docholder.cxx | 19 +++++++------- embeddedobj/source/inc/docholder.hxx | 6 ++-- framework/inc/classes/taskcreator.hxx | 4 +-- framework/inc/services/taskcreatorsrv.hxx | 32 +++++++++++++++++++++---- framework/source/classes/taskcreator.cxx | 8 +++--- framework/source/services/taskcreatorsrv.cxx | 19 ++++++++++++-- framework/util/fwk.component | 5 +++ offapi/UnoApi_offapi.mk | 1 offapi/com/sun/star/frame/TaskCreator.idl | 31 ++++++++++++++++++++++++ solenv/bin/native-code.py | 1 13 files changed, 104 insertions(+), 30 deletions(-)
New commits: commit 03caa7db14749ee990904c7bf4ee20a8de2afa2f Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jun 18 12:50:49 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jun 18 15:26:32 2025 +0200 tdf#167073 Extension MRI does not start revert commit 39f2c62847b890b6b354bdbc39b9b7aa40542f3d simplify TaskCreatorService and commit 96b6d13c9ad73f946efcb7cfa7ccee3d91b8649c. [API CHANGE] no need for TaskCreatorService to be exposed via UNO I missed that this service is in use. Change-Id: I97b01668f7ba313335f9fbd8cf0e398dfc1b5ca0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186643 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/dbaccess/Library_dbahsql.mk b/dbaccess/Library_dbahsql.mk index e6c353c63f40..05b99126c62e 100644 --- a/dbaccess/Library_dbahsql.mk +++ b/dbaccess/Library_dbahsql.mk @@ -22,7 +22,6 @@ $(eval $(call gb_Library_use_libraries,dbahsql,\ comphelper \ cppu \ cppuhelper \ - fwk \ sal \ salhelper \ dbtools \ diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 5cf67fa78694..112c79947393 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -22,6 +22,7 @@ #include <asyncmodaldialog.hxx> #include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/frame/TaskCreator.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/sdb/application/XTableUIProvider.hpp> @@ -33,7 +34,6 @@ #include <comphelper/diagnose_ex.hxx> #include <utility> #include <vcl/window.hxx> -#include <framework/taskcreatorsrv.hxx> namespace dbaui { @@ -103,13 +103,13 @@ namespace dbaui // if we have no externally provided frame, create one if ( !m_xFrameLoader.is() ) { - rtl::Reference< TaskCreatorService > xFact = new TaskCreatorService(m_xORB); + Reference< XSingleServiceFactory > xFact = TaskCreator::create(m_xORB); Sequence< Any > lArgs{ Any(NamedValue(u"ParentFrame"_ustr, Any(m_xParentFrame))), Any(NamedValue(u"TopWindow"_ustr, Any(true))), Any(NamedValue(u"SupportPersistentWindowState"_ustr, Any(true))) }; - m_xFrameLoader.set(xFact->createInstance(lArgs), UNO_QUERY_THROW); + m_xFrameLoader.set(xFact->createInstanceWithArguments(lArgs), UNO_QUERY_THROW); // everything we load can be considered a "top level document", so set the respective bit at the window. // This, amongst other things, triggers that the component in this task participates in the diff --git a/embeddedobj/Library_embobj.mk b/embeddedobj/Library_embobj.mk index c06d229a0113..18cf55518d44 100644 --- a/embeddedobj/Library_embobj.mk +++ b/embeddedobj/Library_embobj.mk @@ -33,7 +33,6 @@ $(eval $(call gb_Library_use_libraries,embobj,\ comphelper \ cppu \ cppuhelper \ - fwk \ sal \ svt \ utl \ diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 3721b7ba10a4..eddc8a47ca0f 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -18,6 +18,7 @@ */ #include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/frame/TaskCreator.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/TerminationVetoException.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> @@ -63,7 +64,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/namedvaluecollection.hxx> -#include <framework/taskcreatorsrv.hxx> #include <docholder.hxx> #include <commonembobj.hxx> @@ -433,7 +433,7 @@ bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xPar uno::Reference< frame::XFrame > xContFrame( xContDisp, uno::UNO_QUERY ); // create a frame based on the specified window - rtl::Reference< TaskCreatorService > xFrameFact = new TaskCreatorService(m_xContext); + uno::Reference< lang::XSingleServiceFactory > xFrameFact = frame::TaskCreator::create(m_xContext); uno::Sequence< uno::Any > aArgs( xContFrame.is() ? 2 : 1 ); auto pArgs = aArgs.getArray(); @@ -451,7 +451,7 @@ bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xPar } // the call will create, initialize the frame, and register it in the parent - m_xFrame = xFrameFact->createInstance( aArgs ); + m_xFrame.set( xFrameFact->createInstanceWithArguments( aArgs ), uno::UNO_QUERY_THROW ); m_xHatchWindow = std::move(xHWindow); m_xOwnWindow = std::move(xOwnWindow); @@ -807,16 +807,17 @@ bool DocumentHolder::HideUI( const uno::Reference< css::frame::XLayoutManager >& } -uno::Reference< frame::XFrame2 > const & DocumentHolder::GetDocFrame() +uno::Reference< frame::XFrame > const & DocumentHolder::GetDocFrame() { // the frame for outplace activation if ( !m_xFrame.is() ) { - rtl::Reference< TaskCreatorService > xFrameFact = new TaskCreatorService(m_xContext); + uno::Reference< lang::XSingleServiceFactory > xFrameFact = frame::TaskCreator::create(m_xContext); - m_xFrame = xFrameFact->createInstance( m_aOutplaceFrameProps ); + m_xFrame.set(xFrameFact->createInstanceWithArguments( m_aOutplaceFrameProps ), uno::UNO_QUERY_THROW); - if ( m_xFrame.is() ) + uno::Reference< frame::XDispatchProviderInterception > xInterception( m_xFrame, uno::UNO_QUERY ); + if ( xInterception.is() ) { if ( m_xInterceptor.is() ) { @@ -826,11 +827,11 @@ uno::Reference< frame::XFrame2 > const & DocumentHolder::GetDocFrame() m_xInterceptor = new Interceptor( this ); - m_xFrame->registerDispatchProviderInterceptor( m_xInterceptor ); + xInterception->registerDispatchProviderInterceptor( m_xInterceptor ); // register interceptor from outside if ( m_xOutplaceInterceptor.is() ) - m_xFrame->registerDispatchProviderInterceptor( m_xOutplaceInterceptor ); + xInterception->registerDispatchProviderInterceptor( m_xOutplaceInterceptor ); } uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xFrame, uno::UNO_QUERY ); diff --git a/embeddedobj/source/inc/docholder.hxx b/embeddedobj/source/inc/docholder.hxx index 88212e4cd5e6..d4aa54d3b10c 100644 --- a/embeddedobj/source/inc/docholder.hxx +++ b/embeddedobj/source/inc/docholder.hxx @@ -24,7 +24,7 @@ #include <com/sun/star/util/XModifyListener.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/document/XEventListener.hpp> -#include <com/sun/star/frame/XFrame2.hpp> +#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> #include <com/sun/star/frame/XBorderResizeListener.hpp> #include <com/sun/star/frame/BorderWidths.hpp> @@ -63,7 +63,7 @@ private: css::uno::Reference< css::util::XCloseable > m_xComponent; - css::uno::Reference< css::frame::XFrame2 > m_xFrame; + css::uno::Reference< css::frame::XFrame > m_xFrame; css::uno::Reference< css::awt::XWindow > m_xOwnWindow; // set for inplace objects css::uno::Reference< css::awt::XWindow > m_xHatchWindow; // set for inplace objects @@ -85,7 +85,7 @@ private: css::uno::Sequence< css::uno::Any > m_aOutplaceFrameProps; - css::uno::Reference< css::frame::XFrame2 > const & GetDocFrame(); + css::uno::Reference< css::frame::XFrame > const & GetDocFrame(); bool LoadDocToFrame( bool ); css::awt::Rectangle CalculateBorderedArea( const css::awt::Rectangle& aRect ); diff --git a/framework/inc/classes/taskcreator.hxx b/framework/inc/classes/taskcreator.hxx index 169a015aa368..d57cc406e3b7 100644 --- a/framework/inc/classes/taskcreator.hxx +++ b/framework/inc/classes/taskcreator.hxx @@ -19,7 +19,7 @@ #pragma once -#include <com/sun/star/frame/XFrame2.hpp> +#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/Reference.hxx> @@ -51,7 +51,7 @@ class TaskCreator final TaskCreator( css::uno::Reference< css::uno::XComponentContext > xContext ); ~TaskCreator( ); - css::uno::Reference< css::frame::XFrame2 > createTask( const OUString& sName, const utl::MediaDescriptor& rDescriptor ); + css::uno::Reference< css::frame::XFrame > createTask( const OUString& sName, const utl::MediaDescriptor& rDescriptor ); }; // class TaskCreator diff --git a/include/framework/taskcreatorsrv.hxx b/framework/inc/services/taskcreatorsrv.hxx similarity index 68% rename from include/framework/taskcreatorsrv.hxx rename to framework/inc/services/taskcreatorsrv.hxx index 44970c628037..e66cda211378 100644 --- a/include/framework/taskcreatorsrv.hxx +++ b/framework/inc/services/taskcreatorsrv.hxx @@ -19,14 +19,18 @@ #pragma once -#include "fwkdllapi.h" #include <comphelper/compbase.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/frame/XFrame2.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/supportsservice.hxx> -typedef comphelper::WeakComponentImplHelper<> TaskCreatorService_BASE; +typedef comphelper::WeakComponentImplHelper<css::lang::XServiceInfo, + css::lang::XSingleServiceFactory> + TaskCreatorService_BASE; -class FWK_DLLPUBLIC TaskCreatorService : public TaskCreatorService_BASE +class TaskCreatorService : public TaskCreatorService_BASE { private: /** @short the global uno service manager. @@ -37,8 +41,26 @@ private: public: explicit TaskCreatorService(css::uno::Reference<css::uno::XComponentContext> xContext); - css::uno::Reference<css::frame::XFrame2> - createInstance(const css::uno::Sequence<css::uno::Any>& lArguments); + virtual OUString SAL_CALL getImplementationName() override + { + return u"com.sun.star.comp.framework.TaskCreator"_ustr; + } + + virtual sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override + { + return cppu::supportsService(this, ServiceName); + } + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override + { + return { u"com.sun.star.frame.TaskCreator"_ustr }; + } + + // XSingleServiceFactory + virtual css::uno::Reference<css::uno::XInterface> SAL_CALL createInstance() override; + + virtual css::uno::Reference<css::uno::XInterface> SAL_CALL + createInstanceWithArguments(const css::uno::Sequence<css::uno::Any>& lArguments) override; private: css::uno::Reference<css::awt::XWindow> diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx index 3488018d2c09..167e345e051e 100644 --- a/framework/source/classes/taskcreator.cxx +++ b/framework/source/classes/taskcreator.cxx @@ -18,11 +18,12 @@ */ #include <classes/taskcreator.hxx> -#include <framework/taskcreatorsrv.hxx> +#include <services/taskcreatorsrv.hxx> #include <services.h> #include <taskcreatordefs.hxx> #include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/frame/TaskCreator.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <utility> @@ -53,7 +54,7 @@ TaskCreator::~TaskCreator() /*-**************************************************************************************************** TODO document me *//*-*****************************************************************************************************/ -css::uno::Reference< css::frame::XFrame2 > TaskCreator::createTask( const OUString& sName, const utl::MediaDescriptor& rDescriptor ) +css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUString& sName, const utl::MediaDescriptor& rDescriptor ) { rtl::Reference< TaskCreatorService > xCreator = new TaskCreatorService(m_xContext); @@ -66,7 +67,8 @@ css::uno::Reference< css::frame::XFrame2 > TaskCreator::createTask( const OUStri css::uno::Any(css::beans::NamedValue(ARGUMENT_FRAMENAME, css::uno::Any(sName))), css::uno::Any(css::beans::NamedValue(ARGUMENT_HIDDENFORCONVERSION, css::uno::Any(rDescriptor.getUnpackedValueOrDefault(ARGUMENT_HIDDENFORCONVERSION, false)))) }; - return xCreator->createInstance(lArgs); + css::uno::Reference< css::frame::XFrame > xTask(xCreator->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW); + return xTask; } } // namespace framework diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx index 97a75dff554e..2cd7519d0b73 100644 --- a/framework/source/services/taskcreatorsrv.cxx +++ b/framework/source/services/taskcreatorsrv.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <framework/taskcreatorsrv.hxx> +#include <services/taskcreatorsrv.hxx> #include <helper/persistentwindowstate.hxx> #include <helper/tagwindowasmodified.hxx> #include <helper/titlebarupdate.hxx> @@ -46,7 +46,12 @@ TaskCreatorService::TaskCreatorService(css::uno::Reference< css::uno::XComponent { } -css::uno::Reference< css::frame::XFrame2 > TaskCreatorService::createInstance(const css::uno::Sequence< css::uno::Any >& lArguments) +css::uno::Reference< css::uno::XInterface > SAL_CALL TaskCreatorService::createInstance() +{ + return createInstanceWithArguments(css::uno::Sequence< css::uno::Any >()); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL TaskCreatorService::createInstanceWithArguments(const css::uno::Sequence< css::uno::Any >& lArguments) { ::comphelper::SequenceAsHashMap lArgs(lArguments); @@ -132,7 +137,7 @@ css::uno::Reference< css::frame::XFrame2 > TaskCreatorService::createInstance(co if (bVisible) xContainerWindow->setVisible(bVisible); - return xFrame; + return css::uno::Reference< css::uno::XInterface >(xFrame, css::uno::UNO_QUERY_THROW); } // static @@ -279,4 +284,12 @@ OUString TaskCreatorService::impl_filterNames( const OUString& sName ) return sFiltered; } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * +com_sun_star_comp_framework_TaskCreator_get_implementation( + css::uno::XComponentContext *context, + css::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new TaskCreatorService(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/util/fwk.component b/framework/util/fwk.component index eccbe5e2694b..b8fef412703d 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -149,6 +149,11 @@ constructor="com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation"> <service name="com.sun.star.task.StatusIndicatorFactory"/> </implementation> + <implementation name="com.sun.star.comp.framework.TaskCreator" + constructor="com_sun_star_comp_framework_TaskCreator_get_implementation" + single-instance="true"> + <service name="com.sun.star.frame.TaskCreator"/> + </implementation> <implementation name="com.sun.star.comp.framework.ToolBarControllerFactory" constructor="com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation" single-instance="true"> diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 08177f1dc24f..ed9967cf6492 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -192,6 +192,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/frame,\ OfficeFrameLoader \ SessionListener \ StartModule \ + TaskCreator \ UICommandDescription \ theAutoRecovery \ theDesktop \ diff --git a/offapi/com/sun/star/frame/TaskCreator.idl b/offapi/com/sun/star/frame/TaskCreator.idl new file mode 100644 index 000000000000..f7cba87cd926 --- /dev/null +++ b/offapi/com/sun/star/frame/TaskCreator.idl @@ -0,0 +1,31 @@ +/* -*- 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 . + */ + + + module com { module sun { module star { module frame { + +/** + @since LibreOffice 4.1 + */ +service TaskCreator : com::sun::star::lang::XSingleServiceFactory; + + +}; }; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 3e917bb37c80..db5bac9a22e9 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -214,6 +214,7 @@ core_constructor_list = [ "com_sun_star_comp_framework_ToolbarAsMenuController_get_implementation", "com_sun_star_comp_framework_ResourceMenuController_get_implementation", "com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation", + "com_sun_star_comp_framework_TaskCreator_get_implementation", "com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation", "com_sun_star_comp_framework_UIConfigurationManager_get_implementation", "com_sun_star_comp_framework_UIElementFactoryManager_get_implementation",