Create an UNO service to do the symbol lookup in toolkit::AccessibilityClient
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: I8664ae1d2da4526cc7eab79b36e1589eb391d7c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163680 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
b1f84f5479
commit
1af510e951
6 changed files with 108 additions and 36 deletions
|
@ -9,7 +9,7 @@
|
|||
|
||||
$(eval $(call gb_Library_Library,acc))
|
||||
|
||||
$(eval $(call gb_Library_set_plugin_for,acc,tk))
|
||||
$(eval $(call gb_Library_set_componentfile,acc,accessibility/util/acc,services))
|
||||
|
||||
$(eval $(call gb_Library_set_include,acc,\
|
||||
$$(INCLUDE) \
|
||||
|
@ -33,6 +33,7 @@ $(eval $(call gb_Library_use_libraries,acc,\
|
|||
sot \
|
||||
svl \
|
||||
svt \
|
||||
tk \
|
||||
tl \
|
||||
utl \
|
||||
vcl \
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <config_features.h>
|
||||
#include <config_feature_desktop.h>
|
||||
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
#include <toolkit/awt/vclxwindows.hxx>
|
||||
#include <toolkit/helper/accessiblefactory.hxx>
|
||||
#include <vcl/accessiblefactory.hxx>
|
||||
|
@ -471,6 +472,35 @@ Reference< XAccessible > AccessibleFactory::createEditBrowseBoxTableCellAccess(
|
|||
} // anonymous namespace
|
||||
|
||||
#if HAVE_FEATURE_DESKTOP
|
||||
|
||||
/// anonymous implementation namespace
|
||||
namespace {
|
||||
|
||||
class GetStandardAccessibleFactoryService:
|
||||
public ::cppu::WeakImplHelper<
|
||||
css::lang::XServiceInfo,
|
||||
css::lang::XUnoTunnel>
|
||||
{
|
||||
public:
|
||||
// css::lang::XServiceInfo:
|
||||
virtual OUString SAL_CALL getImplementationName() override
|
||||
{ return "com.sun.star.accessibility.comp.GetStandardAccessibleFactoryService"; }
|
||||
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.accessibility.GetStandardAccessibleFactoryService" }; }
|
||||
|
||||
// XUnoTunnel
|
||||
virtual sal_Int64 SAL_CALL getSomething( const ::css::uno::Sequence< ::sal_Int8 >& /*aIdentifier*/ ) override
|
||||
{
|
||||
::toolkit::IAccessibleFactory* pFactory = new AccessibleFactory;
|
||||
pFactory->acquire();
|
||||
return reinterpret_cast<sal_Int64>(pFactory);
|
||||
}
|
||||
};
|
||||
|
||||
} // closing anonymous implementation namespace
|
||||
|
||||
/* this is the entry point to retrieve a factory for the toolkit-level Accessible/Contexts supplied
|
||||
by this library
|
||||
|
||||
|
@ -479,11 +509,12 @@ Reference< XAccessible > AccessibleFactory::createEditBrowseBoxTableCellAccess(
|
|||
*/
|
||||
extern "C"
|
||||
{
|
||||
SAL_DLLPUBLIC_EXPORT void* getStandardAccessibleFactory()
|
||||
SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
|
||||
com_sun_star_accessibility_GetStandardAccessibleFactoryService_get_implementation(
|
||||
css::uno::XComponentContext *,
|
||||
css::uno::Sequence<css::uno::Any> const &)
|
||||
{
|
||||
::toolkit::IAccessibleFactory* pFactory = new AccessibleFactory;
|
||||
pFactory->acquire();
|
||||
return pFactory;
|
||||
return cppu::acquire(new GetStandardAccessibleFactoryService);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
26
accessibility/util/acc.component
Normal file
26
accessibility/util/acc.component
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?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.accessibility.comp.GetStandardAccessibleFactoryService"
|
||||
constructor="com_sun_star_accessibility_GetStandardAccessibleFactoryService_get_implementation">
|
||||
<service name="com.sun.star.accessibility.GetStandardAccessibleFactoryService"/>
|
||||
</implementation>
|
||||
</component>
|
|
@ -1630,6 +1630,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/accessibility,\
|
|||
AccessibleTableModelChange \
|
||||
AccessibleTableModelChangeType \
|
||||
AccessibleTextType \
|
||||
GetStandardAccessibleFactoryService \
|
||||
IllegalAccessibleComponentStateException \
|
||||
TextSegment \
|
||||
MSAAService \
|
||||
|
|
|
@ -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 accessibility {
|
||||
|
||||
/**
|
||||
The toolkit module uses this to get a pointer to the AccessibleFactory from the acc 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 GetStandardAccessibleFactoryService : com::sun::star::lang::XUnoTunnel;
|
||||
|
||||
}; }; }; };
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -23,13 +23,14 @@
|
|||
#include <sal/config.h>
|
||||
|
||||
#include <toolkit/helper/accessiblefactory.hxx>
|
||||
#include <osl/module.h>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
#include <osl/mutex.hxx>
|
||||
#include <rtl/ref.hxx>
|
||||
#include <tools/svlibrary.h>
|
||||
|
||||
#include <helper/accessibilityclient.hxx>
|
||||
#include <com/sun/star/accessibility/GetStandardAccessibleFactoryService.hpp>
|
||||
|
||||
namespace toolkit
|
||||
{
|
||||
|
@ -38,14 +39,6 @@ namespace toolkit
|
|||
|
||||
namespace
|
||||
{
|
||||
#ifndef DISABLE_DYNLOADING
|
||||
oslModule s_hAccessibleImplementationModule = nullptr;
|
||||
#endif
|
||||
#if HAVE_FEATURE_DESKTOP
|
||||
#if !ENABLE_WASM_STRIP_ACCESSIBILITY
|
||||
GetStandardAccComponentFactory s_pAccessibleFactoryFunc = nullptr;
|
||||
#endif
|
||||
#endif
|
||||
::rtl::Reference< IAccessibleFactory > s_pFactory;
|
||||
}
|
||||
|
||||
|
@ -58,16 +51,6 @@ namespace toolkit
|
|||
{
|
||||
}
|
||||
|
||||
#if !ENABLE_WASM_STRIP_ACCESSIBILITY
|
||||
#if HAVE_FEATURE_DESKTOP
|
||||
#ifndef DISABLE_DYNLOADING
|
||||
extern "C" { static void thisModule() {} }
|
||||
#else
|
||||
extern "C" void *getStandardAccessibleFactory();
|
||||
#endif
|
||||
#endif // HAVE_FEATURE_DESKTOP
|
||||
#endif // ENABLE_WASM_STRIP_ACCESSIBILITY
|
||||
|
||||
void AccessibilityClient::ensureInitialized()
|
||||
{
|
||||
if ( m_bInitialized )
|
||||
|
@ -77,20 +60,12 @@ namespace toolkit
|
|||
|
||||
#if !ENABLE_WASM_STRIP_ACCESSIBILITY
|
||||
#if HAVE_FEATURE_DESKTOP
|
||||
// load the library implementing the factory
|
||||
if (!s_pFactory)
|
||||
{
|
||||
#ifndef DISABLE_DYNLOADING
|
||||
s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, u"" SVLIBRARY( "acc" ) ""_ustr.pData, 0 );
|
||||
assert(s_hAccessibleImplementationModule);
|
||||
s_pAccessibleFactoryFunc = reinterpret_cast<GetStandardAccComponentFactory>(
|
||||
osl_getFunctionSymbol( s_hAccessibleImplementationModule, u"getStandardAccessibleFactory"_ustr.pData ));
|
||||
#else
|
||||
s_pAccessibleFactoryFunc = getStandardAccessibleFactory;
|
||||
#endif // DISABLE_DYNLOADING
|
||||
|
||||
assert(s_pAccessibleFactoryFunc);
|
||||
IAccessibleFactory* pFactory = static_cast< IAccessibleFactory* >( (*s_pAccessibleFactoryFunc)() );
|
||||
auto xService = css::accessibility::GetStandardAccessibleFactoryService::create(comphelper::getProcessComponentContext());
|
||||
assert(xService);
|
||||
// get a factory instance
|
||||
IAccessibleFactory* pFactory = reinterpret_cast<IAccessibleFactory*>(xService->getSomething({}));
|
||||
assert(pFactory);
|
||||
s_pFactory = pFactory;
|
||||
pFactory->release();
|
||||
|
|
Loading…
Reference in a new issue