diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 5cfc725c5e29..7687ee9fd06d 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2971,6 +2971,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/presentation,\ AnimationEffect \ AnimationSpeed \ ClickAction \ + CreateDialogFactoryService \ EffectCommands \ EffectNodeType \ EffectPresetClass \ diff --git a/offapi/com/sun/star/presentation/CreateDialogFactoryService.idl b/offapi/com/sun/star/presentation/CreateDialogFactoryService.idl new file mode 100644 index 000000000000..2f235334adaa --- /dev/null +++ b/offapi/com/sun/star/presentation/CreateDialogFactoryService.idl @@ -0,0 +1,38 @@ +/* -*- 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 presentation { + +/** + The sd module uses this to get a pointer to the AccessibleFactory from the sdui module. + Because we have a dependency in our modules that goes the "wrong" way. + + @since LibreOffice 24.8 + + @internal + + ATTENTION: This is marked internal and does not + have the published flag, which means it is subject to + change without notice and should not be used outside the LibreOffice core. +*/ +service CreateDialogFactoryService : com::sun::star::lang::XUnoTunnel; + +}; }; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/Library_sdui.mk b/sd/Library_sdui.mk index 30a502bcbdf6..5f0f457a43c5 100644 --- a/sd/Library_sdui.mk +++ b/sd/Library_sdui.mk @@ -9,8 +9,6 @@ $(eval $(call gb_Library_Library,sdui)) -$(eval $(call gb_Library_set_plugin_for,sdui,sd)) - $(eval $(call gb_Library_set_componentfile,sdui,sd/source/console/presenter,services)) $(eval $(call gb_Library_set_include,sdui,\ @@ -53,6 +51,7 @@ $(eval $(call gb_Library_use_libraries,sdui,\ fwk \ sal \ salhelper \ + sd \ sfx \ sot \ svl \ diff --git a/sd/source/console/presenter.component b/sd/source/console/presenter.component index 3e1bc8508d36..8a1d8b93a224 100644 --- a/sd/source/console/presenter.component +++ b/sd/source/console/presenter.component @@ -15,4 +15,8 @@ constructor="sd_PresenterProtocolHandler_get_implementation"> + + + diff --git a/sd/source/ui/dlg/sdabstdlg.cxx b/sd/source/ui/dlg/sdabstdlg.cxx index 2b686a3e8882..181a2ec42d62 100644 --- a/sd/source/ui/dlg/sdabstdlg.cxx +++ b/sd/source/ui/dlg/sdabstdlg.cxx @@ -18,38 +18,19 @@ */ #include - -#include - -typedef SdAbstractDialogFactory* (*SdFuncPtrCreateDialogFactory)(); - -#ifndef DISABLE_DYNLOADING - -extern "C" { -static void thisModule() {} -} - -#else - -extern "C" SdAbstractDialogFactory* SdCreateDialogFactory(); - -#endif +#include +#include SdAbstractDialogFactory* SdAbstractDialogFactory::Create() { - SdFuncPtrCreateDialogFactory fp = nullptr; -#ifndef DISABLE_DYNLOADING - static ::osl::Module aDialogLibrary; - static constexpr OUStringLiteral sLibName(u"" SDUI_DLL_NAME); - if (aDialogLibrary.is() || aDialogLibrary.loadRelative(&thisModule, sLibName)) - fp = reinterpret_cast( - aDialogLibrary.getFunctionSymbol("SdCreateDialogFactory")); -#else - fp = SdCreateDialogFactory; -#endif - if (fp) - return fp(); - return nullptr; + auto xService = css::presentation::CreateDialogFactoryService::create( + comphelper::getProcessComponentContext()); + assert(xService); + // get a factory instance + SdAbstractDialogFactory* pFactory + = reinterpret_cast(xService->getSomething({})); + assert(pFactory); + return pFactory; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sduiexp.cxx b/sd/source/ui/dlg/sduiexp.cxx index 62901c70d0aa..63354ab7ed58 100644 --- a/sd/source/ui/dlg/sduiexp.cxx +++ b/sd/source/ui/dlg/sduiexp.cxx @@ -19,14 +19,49 @@ #include "sddlgfact.hxx" #include +#include +#include class SdAbstractDialogFactory; -extern "C" { -SAL_DLLPUBLIC_EXPORT SdAbstractDialogFactory* SdCreateDialogFactory() +/// anonymous implementation namespace +namespace { - static SdAbstractDialogFactory_Impl aFactory; - return &aFactory; +class CreateDialogFactoryService + : public ::cppu::WeakImplHelper +{ +public: + // css::lang::XServiceInfo: + virtual OUString SAL_CALL getImplementationName() override + { + return "com.sun.star.presentation.comp.CreateDialogFactoryService"; + } + virtual sal_Bool SAL_CALL supportsService(const OUString& serviceName) override + { + return cppu::supportsService(this, serviceName); + } + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override + { + return { "com.sun.star.presentation.CreateDialogFactoryService" }; + } + + // XUnoTunnel + virtual sal_Int64 SAL_CALL + getSomething(const ::css::uno::Sequence<::sal_Int8>& /*aIdentifier*/) override + { + static SdAbstractDialogFactory_Impl aFactory; + return reinterpret_cast(static_cast(&aFactory)); + } +}; + +} // closing anonymous implementation namespace + +extern "C" { +SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_presentation_CreateDialogFactoryService_get_implementation( + css::uno::XComponentContext*, css::uno::Sequence const&) +{ + return cppu::acquire(new CreateDialogFactoryService); } }