Create an UNO service to do the symbol lookup in sw
which means I can remove one usage of gb_Library_set_plugin_for, which is blocking linking the sw module into --enable-mergelibs=more Change-Id: I8c199421c66de2dcf339ccc2d5cb9340d3bea914 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164429 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
06d8c1e9d8
commit
cba736567a
16 changed files with 127 additions and 89 deletions
|
@ -3746,6 +3746,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/text,\
|
|||
ColumnSeparatorStyle \
|
||||
ControlCharacter \
|
||||
DateDisplayFormat \
|
||||
DialogFactoryService \
|
||||
DocumentStatistic \
|
||||
FilenameDisplayFormat \
|
||||
FontEmphasis \
|
||||
|
|
38
offapi/com/sun/star/text/DialogFactoryService.idl
Normal file
38
offapi/com/sun/star/text/DialogFactoryService.idl
Normal file
|
@ -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 text {
|
||||
|
||||
/**
|
||||
The sw module uses this to get a pointer to the from the swui module.
|
||||
Because we have a dependency in our modules that goes the "wrong" way.
|
||||
|
||||
@since LibreOffice 24.8
|
||||
|
||||
@internal
|
||||
|
||||
ATTENTION: This is marked <em>internal</em> and does not
|
||||
have the <em>published</em> flag, which means it is subject to
|
||||
change without notice and should not be used outside the LibreOffice core.
|
||||
*/
|
||||
service DialogFactoryService : com::sun::star::lang::XUnoTunnel;
|
||||
|
||||
}; }; }; };
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
$(eval $(call gb_Library_Library,swui))
|
||||
|
||||
$(eval $(call gb_Library_set_plugin_for,swui,sw))
|
||||
$(eval $(call gb_Library_set_componentfile,swui,sw/util/swui,services))
|
||||
|
||||
$(eval $(call gb_Library_set_include,swui,\
|
||||
-I$(SRCDIR)/sw/inc \
|
||||
|
@ -72,6 +72,7 @@ $(eval $(call gb_Library_use_libraries,swui,\
|
|||
svx \
|
||||
svx \
|
||||
svxcore \
|
||||
sw \
|
||||
tk \
|
||||
tl \
|
||||
ucbhelper \
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include <osl/module.hxx>
|
||||
#include <tools/svlibrary.h>
|
||||
#include <vcl/abstdlg.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <com/sun/star/text/DialogFactoryService.hpp>
|
||||
|
||||
class SwAbstractDialogFactory;
|
||||
|
||||
|
@ -62,16 +64,11 @@ void SwDialogsTest::setUp()
|
|||
component_ = loadFromDesktop(
|
||||
"private:factory/swriter", "com.sun.star.text.TextDocument");
|
||||
// Make sure the swui library's global pSwResMgr is initialized
|
||||
// (alternatively to dynamically loading the library, SwCreateDialogFactory
|
||||
// could be declared in an include file and this CppunitTest link against
|
||||
// the swui library):
|
||||
OUString url("${LO_LIB_DIR}/" SVLIBRARY("swui"));
|
||||
rtl::Bootstrap::expandMacros(url); //TODO: detect failure
|
||||
CPPUNIT_ASSERT(libSwui_.load(url, SAL_LOADMODULE_GLOBAL));
|
||||
auto fn = reinterpret_cast<Fn>(
|
||||
libSwui_.getFunctionSymbol("SwCreateDialogFactory"));
|
||||
CPPUNIT_ASSERT(fn != nullptr);
|
||||
(*fn)();
|
||||
auto xService = css::text::DialogFactoryService::create(comphelper::getProcessComponentContext());
|
||||
CPPUNIT_ASSERT(xService.is());
|
||||
// get a factory instance
|
||||
SwAbstractDialogFactory* pFactory = reinterpret_cast<SwAbstractDialogFactory*>(xService->getSomething({}));
|
||||
CPPUNIT_ASSERT(pFactory != nullptr);
|
||||
}
|
||||
|
||||
void SwDialogsTest::tearDown()
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
#include <osl/module.hxx>
|
||||
#include <tools/svlibrary.h>
|
||||
#include <vcl/abstdlg.hxx>
|
||||
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <com/sun/star/text/DialogFactoryService.hpp>
|
||||
#include <swdll.hxx>
|
||||
|
||||
class SwAbstractDialogFactory;
|
||||
|
@ -59,16 +60,11 @@ void SwDialogsTest2::setUp()
|
|||
ScreenshotTest::setUp();
|
||||
SwGlobals::ensure();
|
||||
// Make sure the swui library's global pSwResMgr is initialized
|
||||
// (alternatively to dynamically loading the library, SwCreateDialogFactory
|
||||
// could be declared in an include file and this CppunitTest link against
|
||||
// the swui library):
|
||||
OUString url("${LO_LIB_DIR}/" SVLIBRARY("swui"));
|
||||
rtl::Bootstrap::expandMacros(url); //TODO: detect failure
|
||||
CPPUNIT_ASSERT(libSwui_.load(url, SAL_LOADMODULE_GLOBAL));
|
||||
auto fn = reinterpret_cast<Fn>(
|
||||
libSwui_.getFunctionSymbol("SwCreateDialogFactory"));
|
||||
CPPUNIT_ASSERT(fn != nullptr);
|
||||
(*fn)();
|
||||
auto xService = css::text::DialogFactoryService::create(comphelper::getProcessComponentContext());
|
||||
CPPUNIT_ASSERT(xService.is());
|
||||
// get a factory instance
|
||||
SwAbstractDialogFactory* pFactory = reinterpret_cast<SwAbstractDialogFactory*>(xService->getSomething({}));
|
||||
CPPUNIT_ASSERT(pFactory != nullptr);
|
||||
}
|
||||
|
||||
void SwDialogsTest2::registerKnownDialogsByID(mapType& /*rKnownDialogs*/)
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
*/
|
||||
|
||||
#include "swdlgfact.hxx"
|
||||
|
||||
#include <swuiexp.hxx>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||
|
||||
namespace swui
|
||||
{
|
||||
|
@ -30,10 +31,44 @@ SwAbstractDialogFactory& GetFactory()
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
SAL_DLLPUBLIC_EXPORT SwAbstractDialogFactory* SwCreateDialogFactory()
|
||||
/// anonymous implementation namespace
|
||||
namespace
|
||||
{
|
||||
return &::swui::GetFactory();
|
||||
class DialogFactoryService
|
||||
: public ::cppu::WeakImplHelper<css::lang::XServiceInfo, css::lang::XUnoTunnel>
|
||||
{
|
||||
public:
|
||||
// css::lang::XServiceInfo:
|
||||
virtual OUString SAL_CALL getImplementationName() override
|
||||
{
|
||||
return "com.sun.star.text.comp.DialogFactoryService";
|
||||
}
|
||||
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.text.DialogFactoryService" };
|
||||
}
|
||||
|
||||
// XUnoTunnel
|
||||
virtual sal_Int64 SAL_CALL
|
||||
getSomething(const ::css::uno::Sequence<::sal_Int8>& /*aIdentifier*/) override
|
||||
{
|
||||
SwAbstractDialogFactory* pFactory = &::swui::GetFactory();
|
||||
return reinterpret_cast<sal_Int64>(pFactory);
|
||||
}
|
||||
};
|
||||
|
||||
} // closing anonymous implementation namespace
|
||||
|
||||
extern "C" {
|
||||
SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
com_sun_star_text_DialogFactoryService_get_implementation(css::uno::XComponentContext*,
|
||||
css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
return cppu::acquire(new DialogFactoryService);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,38 +18,17 @@
|
|||
*/
|
||||
|
||||
#include <swabstdlg.hxx>
|
||||
|
||||
#include <osl/module.hxx>
|
||||
|
||||
typedef SwAbstractDialogFactory* (*SwFuncPtrCreateDialogFactory)();
|
||||
|
||||
#ifndef DISABLE_DYNLOADING
|
||||
|
||||
extern "C" { static void thisModule() {} }
|
||||
|
||||
#else
|
||||
|
||||
extern "C" SwAbstractDialogFactory* SwCreateDialogFactory();
|
||||
|
||||
#endif
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <com/sun/star/text/DialogFactoryService.hpp>
|
||||
|
||||
SwAbstractDialogFactory* SwAbstractDialogFactory::Create()
|
||||
{
|
||||
SwFuncPtrCreateDialogFactory fp = nullptr;
|
||||
#ifndef DISABLE_DYNLOADING
|
||||
static ::osl::Module aDialogLibrary;
|
||||
static constexpr OUStringLiteral sLibName(u"" SWUI_DLL_NAME);
|
||||
if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, sLibName,
|
||||
SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) )
|
||||
fp = reinterpret_cast<SwAbstractDialogFactory* (SAL_CALL*)()>(
|
||||
aDialogLibrary.getFunctionSymbol( "SwCreateDialogFactory" ));
|
||||
#else
|
||||
fp = SwCreateDialogFactory;
|
||||
#endif
|
||||
|
||||
if ( fp )
|
||||
return fp();
|
||||
return nullptr;
|
||||
auto xService = css::text::DialogFactoryService::create(comphelper::getProcessComponentContext());
|
||||
assert(xService);
|
||||
// get a factory instance
|
||||
SwAbstractDialogFactory* pFactory = reinterpret_cast<SwAbstractDialogFactory*>(xService->getSomething({}));
|
||||
assert(pFactory);
|
||||
return pFactory;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
25
sw/util/swui.component
Normal file
25
sw/util/swui.component
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* 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 .
|
||||
-->
|
||||
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.text.comp.DialogFactoryService"
|
||||
constructor="com_sun_star_text_DialogFactoryService_get_implementation">
|
||||
<service name="com.sun.star.text.DialogFactoryService"/>
|
||||
</implementation>
|
||||
</component>
|
|
@ -11,11 +11,6 @@
|
|||
#include <vcl/FilterConfigItem.hxx>
|
||||
#include "commonfuzzer.hxx"
|
||||
|
||||
extern "C" void* SwCreateDialogFactory()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" bool TestImportDOCX(SvStream &rStream);
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#include <libxml/parser.h>
|
||||
#include "commonfuzzer.hxx"
|
||||
|
||||
extern "C" void* SwCreateDialogFactory() { return nullptr; }
|
||||
|
||||
extern "C" bool TestPDFExportFODT(SvStream& rStream);
|
||||
|
||||
static void silent_error_func(void*, const char* /*format*/, ...) {}
|
||||
|
|
|
@ -11,11 +11,6 @@
|
|||
#include <vcl/FilterConfigItem.hxx>
|
||||
#include "commonfuzzer.hxx"
|
||||
|
||||
extern "C" void* SwCreateDialogFactory()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" bool TestImportFODT(SvStream &rStream);
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include <vcl/FilterConfigItem.hxx>
|
||||
#include "commonfuzzer.hxx"
|
||||
|
||||
extern "C" void* SwCreateDialogFactory() { return nullptr; }
|
||||
|
||||
extern "C" bool TestImportHTML(SvStream& rStream);
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
|
||||
|
|
|
@ -67,11 +67,6 @@ extern "C" void* lo_get_custom_widget_func(const char*)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" void* SwCreateDialogFactory()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" bool TestImportRTF(SvStream &rStream);
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
|
||||
|
|
|
@ -107,11 +107,6 @@ extern "C" void* lo_get_custom_widget_func(const char*)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" void* SwCreateDialogFactory()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" bool TestImportWW2(SvStream &rStream);
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
|
||||
|
|
|
@ -109,11 +109,6 @@ extern "C" void* lo_get_custom_widget_func(const char*)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" void* SwCreateDialogFactory()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" bool TestImportWW6(SvStream &rStream);
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
|
||||
|
|
|
@ -109,11 +109,6 @@ extern "C" void* lo_get_custom_widget_func(const char*)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" void* SwCreateDialogFactory()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" bool TestImportWW8(SvStream &rStream);
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
|
||||
|
|
Loading…
Reference in a new issue