summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-03-05 14:40:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-05 18:31:48 +0100
commit4ed1536c6eed2a7919a80c7f92617aa0a4058263 (patch)
tree431ef4746cec1f15c8992fb3da1c6eb4a07c75de /sd/source
parentbacb92275c0c474d09146c0409cb547aef6551cf (diff)
Create an UNO service to do the symbol lookup in sd
which means I can remove one usage of gb_Library_set_plugin_for, which is blocking linking the sd module into --enable-mergelibs=more Change-Id: I90dae749f777446f67342d121e4dc29b974cb9b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164423 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/console/presenter.component4
-rw-r--r--sd/source/ui/dlg/sdabstdlg.cxx39
-rw-r--r--sd/source/ui/dlg/sduiexp.cxx41
3 files changed, 52 insertions, 32 deletions
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">
<service name="com.sun.star.frame.ProtocolHandler"/>
</implementation>
+ <implementation name="com.sun.star.presentation.comp.CreateDialogFactoryService"
+ constructor="com_sun_star_presentation_CreateDialogFactoryService_get_implementation">
+ <service name="com.sun.star.presentation.CreateDialogFactoryService"/>
+ </implementation>
</component>
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 <sdabstdlg.hxx>
-
-#include <osl/module.hxx>
-
-typedef SdAbstractDialogFactory* (*SdFuncPtrCreateDialogFactory)();
-
-#ifndef DISABLE_DYNLOADING
-
-extern "C" {
-static void thisModule() {}
-}
-
-#else
-
-extern "C" SdAbstractDialogFactory* SdCreateDialogFactory();
-
-#endif
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/presentation/CreateDialogFactoryService.hpp>
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<SdAbstractDialogFactory*(SAL_CALL*)()>(
- 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<SdAbstractDialogFactory*>(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 <sal/types.h>
+#include <cppuhelper/supportsservice.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
class SdAbstractDialogFactory;
+/// anonymous implementation namespace
+namespace
+{
+class CreateDialogFactoryService
+ : public ::cppu::WeakImplHelper<css::lang::XServiceInfo, css::lang::XUnoTunnel>
+{
+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<OUString> 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<sal_Int64>(static_cast<SdAbstractDialogFactory*>(&aFactory));
+ }
+};
+
+} // closing anonymous implementation namespace
+
extern "C" {
-SAL_DLLPUBLIC_EXPORT SdAbstractDialogFactory* SdCreateDialogFactory()
+SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_presentation_CreateDialogFactoryService_get_implementation(
+ css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const&)
{
- static SdAbstractDialogFactory_Impl aFactory;
- return &aFactory;
+ return cppu::acquire(new CreateDialogFactoryService);
}
}