Create an UNO service to do the cui symbol lookup in vcl
which means I can remove one usage of gb_Library_set_plugin_for, which is blocking linking the cui module into --enable-mergelibs=more Change-Id: Ic6cd48377627f94747037c7247a1cd398738b390 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163820 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
ff197bf1a9
commit
47bfbbdb73
10 changed files with 90 additions and 40 deletions
|
@ -179,7 +179,6 @@ with open("bin/find-can-be-private-symbols.functions.results", "wt") as f:
|
|||
# dynamically loaded
|
||||
elif sym.endswith("get_implementation"): continue
|
||||
elif sym.endswith("component_getFactory"): continue
|
||||
elif sym == "CreateDialogFactory": continue
|
||||
elif sym == "CreateUnoWrapper": continue
|
||||
elif sym == "ExportDOC": continue
|
||||
elif sym == "ExportRTF": continue
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
$(eval $(call gb_Library_Library,cui))
|
||||
|
||||
$(eval $(call gb_Library_set_plugin_for,cui,vcl))
|
||||
|
||||
$(eval $(call gb_Library_set_componentfile,cui,cui/util/cui,services))
|
||||
|
||||
$(eval $(call gb_Library_set_include,cui,\
|
||||
|
@ -62,6 +60,7 @@ $(eval $(call gb_Library_use_libraries,cui,\
|
|||
tl \
|
||||
ucbhelper \
|
||||
utl \
|
||||
vcl \
|
||||
$(if $(ENABLE_BREAKPAD), \
|
||||
crashreport \
|
||||
) \
|
||||
|
|
|
@ -19,18 +19,50 @@
|
|||
|
||||
#include "dlgfact.hxx"
|
||||
#include <sal/types.h>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||
|
||||
namespace cui
|
||||
/// anonymous implementation namespace
|
||||
namespace
|
||||
{
|
||||
static AbstractDialogFactory_Impl* GetFactory()
|
||||
class GetCreateDialogFactoryService
|
||||
: public ::cppu::WeakImplHelper<css::lang::XServiceInfo, css::lang::XUnoTunnel>
|
||||
{
|
||||
static AbstractDialogFactory_Impl* pFactory = new AbstractDialogFactory_Impl;
|
||||
return pFactory;
|
||||
}
|
||||
}
|
||||
public:
|
||||
// css::lang::XServiceInfo:
|
||||
virtual OUString SAL_CALL getImplementationName() override
|
||||
{
|
||||
return "com.sun.star.cui.GetCreateDialogFactoryService";
|
||||
}
|
||||
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.cui.GetCreateDialogFactoryService" };
|
||||
}
|
||||
|
||||
// XUnoTunnel
|
||||
virtual sal_Int64 SAL_CALL
|
||||
getSomething(const ::css::uno::Sequence<::sal_Int8>& /*aIdentifier*/) override
|
||||
{
|
||||
// Noting that we have to return a pointer to **VclAbstractDialogFactory** otherwise
|
||||
// the dynamic_casting on the other end will fail on Windows (possibly because of the virtual base involved).
|
||||
static VclAbstractDialogFactory* pFactory = new AbstractDialogFactory_Impl;
|
||||
return reinterpret_cast<sal_Int64>(pFactory);
|
||||
}
|
||||
};
|
||||
|
||||
} // closing anonymous implementation namespace
|
||||
|
||||
extern "C" {
|
||||
SAL_DLLPUBLIC_EXPORT VclAbstractDialogFactory* CreateDialogFactory() { return ::cui::GetFactory(); }
|
||||
SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
com_sun_star_cui_GetCreateDialogFactoryService(css::uno::XComponentContext*,
|
||||
css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
return cppu::acquire(new GetCreateDialogFactoryService);
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -25,4 +25,8 @@
|
|||
<service name="com.sun.star.ui.dialogs.ColorPicker"/>
|
||||
<service name="com.sun.star.ui.dialogs.AsynchronousColorPicker"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.cui.GetCreateDialogFactoryService"
|
||||
constructor="com_sun_star_cui_GetCreateDialogFactoryService">
|
||||
<service name="com.sun.star.cui.GetCreateDialogFactoryService"/>
|
||||
</implementation>
|
||||
</component>
|
||||
|
|
|
@ -101,6 +101,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/configuration,\
|
|||
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/cui,\
|
||||
AsynchronousColorPicker \
|
||||
ColorPicker \
|
||||
GetCreateDialogFactoryService \
|
||||
))
|
||||
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/datatransfer,\
|
||||
DataFormatTranslator \
|
||||
|
|
38
offapi/com/sun/star/cui/GetCreateDialogFactoryService.idl
Normal file
38
offapi/com/sun/star/cui/GetCreateDialogFactoryService.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 cui {
|
||||
|
||||
/**
|
||||
The vcl module uses this to call ::cui::GetFactory() in the cui 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 GetCreateDialogFactoryService : com::sun::star::lang::XUnoTunnel;
|
||||
|
||||
}; }; }; };
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -118,6 +118,7 @@ core_constructor_list = [
|
|||
"com_sun_star_comp_rendering_MtfRenderer_get_implementation",
|
||||
# cui/util/cui.component
|
||||
("com_sun_star_cui_ColorPicker_get_implementation", "#if !ENABLE_FUZZERS"),
|
||||
"com_sun_star_cui_GetCreateDialogFactoryService",
|
||||
# dbaccess/util/dba.component
|
||||
"com_sun_star_comp_dba_DataAccessDescriptorFactory",
|
||||
"com_sun_star_comp_dba_OCommandDefinition",
|
||||
|
|
|
@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_a11y, \
|
|||
acc \
|
||||
sal \
|
||||
cppu \
|
||||
cui \
|
||||
subsequenttest \
|
||||
test \
|
||||
unotest \
|
||||
|
|
|
@ -17,41 +17,18 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <osl/module.hxx>
|
||||
#include <vcl/abstdlg.hxx>
|
||||
#include <vcl/bitmapex.hxx>
|
||||
#include <com/sun/star/cui/GetCreateDialogFactoryService.hpp>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
||||
typedef VclAbstractDialogFactory*(SAL_CALL* FuncPtrCreateDialogFactory)();
|
||||
|
||||
#ifndef DISABLE_DYNLOADING
|
||||
extern "C" {
|
||||
static void thisModule() {}
|
||||
}
|
||||
#else
|
||||
extern "C" VclAbstractDialogFactory* CreateDialogFactory();
|
||||
#endif
|
||||
|
||||
VclAbstractDialogFactory* VclAbstractDialogFactory::Create()
|
||||
{
|
||||
static auto fp = []() -> FuncPtrCreateDialogFactory {
|
||||
#ifndef DISABLE_DYNLOADING
|
||||
::osl::Module aDialogLibrary;
|
||||
if (aDialogLibrary.loadRelative(&thisModule, CUI_DLL_NAME,
|
||||
SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY))
|
||||
{
|
||||
auto const p = reinterpret_cast<FuncPtrCreateDialogFactory>(
|
||||
aDialogLibrary.getFunctionSymbol("CreateDialogFactory"));
|
||||
aDialogLibrary.release();
|
||||
return p;
|
||||
}
|
||||
return nullptr;
|
||||
#else
|
||||
return CreateDialogFactory;
|
||||
#endif
|
||||
}();
|
||||
if (fp)
|
||||
return fp();
|
||||
return nullptr;
|
||||
auto xService
|
||||
= css::cui::GetCreateDialogFactoryService::create(comphelper::getProcessComponentContext());
|
||||
return reinterpret_cast<VclAbstractDialogFactory*>(xService->getSomething({}));
|
||||
}
|
||||
|
||||
VclAbstractDialog::~VclAbstractDialog() {}
|
||||
|
|
|
@ -79,8 +79,6 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" void* CreateDialogFactory() { return nullptr; }
|
||||
|
||||
extern "C" bool GetSpecialCharsForEdit() { return false; }
|
||||
|
||||
extern "C"
|
||||
|
|
Loading…
Reference in a new issue