summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-03-05 12:02:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-05 13:07:36 +0100
commite311a4b87bad35a50812574dd9a96d6f4cd8dfd8 (patch)
treef8b4cb852f6f11f07b26ed27936cb3f7bb94bfd3 /sc/source
parent66fefd9a7d646d993ba8a2106c712865fe4e0ae1 (diff)
Create an UNO service to do the symbol lookup in sc
which means I can remove one usage of gb_Library_set_plugin_for, which is blocking linking the accessibility module into --enable-mergelibs=more Change-Id: I389fcafd80f1a450befbffdc252be497ba20f6d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/attrdlg/scabstdlg.cxx34
-rw-r--r--sc/source/ui/attrdlg/scuiexp.cxx41
2 files changed, 45 insertions, 30 deletions
diff --git a/sc/source/ui/attrdlg/scabstdlg.cxx b/sc/source/ui/attrdlg/scabstdlg.cxx
index a8a457c5c985..9696147639fe 100644
--- a/sc/source/ui/attrdlg/scabstdlg.cxx
+++ b/sc/source/ui/attrdlg/scabstdlg.cxx
@@ -21,35 +21,17 @@
#include <osl/module.hxx>
#include <tools/svlibrary.h>
-
-typedef ScAbstractDialogFactory* (*ScFuncPtrCreateDialogFactory)();
-
-#ifndef DISABLE_DYNLOADING
-
-extern "C" { static void thisModule() {} }
-
-#else
-
-extern "C" ScAbstractDialogFactory* ScCreateDialogFactory();
-
-#endif
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/sheet/CreateDialogFactoryService.hpp>
ScAbstractDialogFactory* ScAbstractDialogFactory::Create()
{
- ScFuncPtrCreateDialogFactory fp = nullptr;
-#ifndef DISABLE_DYNLOADING
- static ::osl::Module aDialogLibrary;
-
- if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, SVLIBRARY("scui"),
- SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) )
- fp = reinterpret_cast<ScAbstractDialogFactory* (SAL_CALL*)()>(
- aDialogLibrary.getFunctionSymbol( "ScCreateDialogFactory" ));
-#else
- fp = ScCreateDialogFactory;
-#endif
- if ( fp )
- return fp();
- return nullptr;
+ auto xService = css::sheet::CreateDialogFactoryService::create(comphelper::getProcessComponentContext());
+ assert(xService);
+ // get a factory instance
+ ScAbstractDialogFactory* pFactory = reinterpret_cast<ScAbstractDialogFactory*>(xService->getSomething({}));
+ assert(pFactory);
+ return pFactory;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/attrdlg/scuiexp.cxx b/sc/source/ui/attrdlg/scuiexp.cxx
index 4351539a9055..1179050037b2 100644
--- a/sc/source/ui/attrdlg/scuiexp.cxx
+++ b/sc/source/ui/attrdlg/scuiexp.cxx
@@ -21,13 +21,46 @@
#include "scdlgfact.hxx"
#include <sal/types.h>
+#include <cppuhelper/supportsservice.hxx>
+
+/// 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.sheet.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.sheet.CreateDialogFactoryService" };
+ }
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL
+ getSomething(const ::css::uno::Sequence<::sal_Int8>& /*aIdentifier*/) override
+ {
+ static ScAbstractDialogFactory_Impl aFactory;
+ return reinterpret_cast<sal_Int64>(static_cast<ScAbstractDialogFactory*>(&aFactory));
+ }
+};
+
+} // closing anonymous implementation namespace
extern "C" {
-SAL_DLLPUBLIC_EXPORT ScAbstractDialogFactory* ScCreateDialogFactory()
+SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_sheet_CreateDialogFactoryService_get_implementation(
+ css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const&)
{
- static ScAbstractDialogFactory_Impl aFactory;
- return &aFactory;
+ return cppu::acquire(new CreateDialogFactoryService);
}
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */