drawinglayer: create instances with uno constructors

See tdf#74608 for motivation

Change-Id: I38de5ec7b9e376ef8868bebbe7f30240de81c241
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98219
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2020-07-06 18:46:12 +02:00 committed by Noel Grandin
parent 33509fd948
commit 125f3c4c93
6 changed files with 16 additions and 138 deletions

View file

@ -187,7 +187,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/tools/emfpcustomlinecap \
drawinglayer/source/tools/wmfemfhelper \
drawinglayer/source/tools/primitive2dxmldump \
drawinglayer/source/drawinglayeruno/drawinglayeruno \
drawinglayer/source/drawinglayeruno/xprimitive2drenderer \
drawinglayer/source/texture/texture \
drawinglayer/source/dumper/XShapeDumper \

View file

@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="drawinglayer" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="drawinglayer::unorenderer::XPrimitive2DRenderer">
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="drawinglayer::unorenderer::XPrimitive2DRenderer"
constructor="drawinglayer_XPrimitive2DRenderer">
<service name="com.sun.star.graphic.Primitive2DTools"/>
</implementation>
</component>

View file

@ -1,55 +0,0 @@
/* -*- 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 .
*/
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <cppuhelper/factory.hxx>
#include "xprimitive2drenderer.hxx"
using namespace ::com::sun::star;
extern "C"
{
SAL_DLLPUBLIC_EXPORT void* drawinglayer_component_getFactory( const char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
{
uno::Reference< lang::XSingleServiceFactory > xFactory;
void* pRet = nullptr;
if(drawinglayer::unorenderer::XPrimitive2DRenderer_getImplementationName().equalsAscii(pImplName))
{
xFactory = ::cppu::createSingleFactory(
static_cast< lang::XMultiServiceFactory * >(pServiceManager),
drawinglayer::unorenderer::XPrimitive2DRenderer_getImplementationName(),
drawinglayer::unorenderer::XPrimitive2DRenderer_createInstance,
drawinglayer::unorenderer::XPrimitive2DRenderer_getSupportedServiceNames());
}
if(xFactory.is())
{
xFactory->acquire();
pRet = xFactory.get();
}
return pRet;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -20,8 +20,8 @@
#include <sal/config.h>
#include <com/sun/star/graphic/XPrimitive2DRenderer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequence.hxx>
@ -35,8 +35,6 @@
#include <converters.hxx>
#include "xprimitive2drenderer.hxx"
using namespace ::com::sun::star;
@ -70,32 +68,7 @@ namespace drawinglayer::unorenderer
};
}
} // end of namespace drawinglayer::unorenderer
// uno functions
namespace drawinglayer::unorenderer
{
uno::Sequence< OUString > XPrimitive2DRenderer_getSupportedServiceNames()
{
return { "com.sun.star.graphic.Primitive2DTools" };
}
OUString XPrimitive2DRenderer_getImplementationName()
{
return "drawinglayer::unorenderer::XPrimitive2DRenderer";
}
uno::Reference< uno::XInterface > XPrimitive2DRenderer_createInstance(const uno::Reference< lang::XMultiServiceFactory >&)
{
return static_cast< ::cppu::OWeakObject* >(new XPrimitive2DRenderer);
}
} // end of namespace drawinglayer::unorenderer
namespace drawinglayer::unorenderer
{
XPrimitive2DRenderer::XPrimitive2DRenderer()
{
}
@ -175,7 +148,7 @@ namespace drawinglayer::unorenderer
OUString SAL_CALL XPrimitive2DRenderer::getImplementationName()
{
return XPrimitive2DRenderer_getImplementationName();
return "drawinglayer::unorenderer::XPrimitive2DRenderer";
}
sal_Bool SAL_CALL XPrimitive2DRenderer::supportsService(const OUString& rServiceName)
@ -185,9 +158,17 @@ namespace drawinglayer::unorenderer
uno::Sequence< OUString > SAL_CALL XPrimitive2DRenderer::getSupportedServiceNames()
{
return XPrimitive2DRenderer_getSupportedServiceNames();
return { "com.sun.star.graphic.Primitive2DTools" };
}
} // end of namespace
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
drawinglayer_XPrimitive2DRenderer(
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& )
{
return cppu::acquire(new drawinglayer::unorenderer::XPrimitive2DRenderer());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -1,49 +0,0 @@
/* -*- 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 .
*/
#ifndef INCLUDED_DRAWINGLAYER_SOURCE_DRAWINGLAYERUNO_XPRIMITIVE2DRENDERER_HXX
#define INCLUDED_DRAWINGLAYER_SOURCE_DRAWINGLAYERUNO_XPRIMITIVE2DRENDERER_HXX
#include <sal/config.h>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/ustring.hxx>
namespace com::sun::star {
namespace lang { class XMultiServiceFactory; }
namespace uno { class XInterface; }
}
namespace drawinglayer::unorenderer {
css::uno::Sequence<OUString>
XPrimitive2DRenderer_getSupportedServiceNames();
OUString XPrimitive2DRenderer_getImplementationName();
css::uno::Reference<css::uno::XInterface>
XPrimitive2DRenderer_createInstance(
css::uno::Reference<css::lang::XMultiServiceFactory> const &);
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -22,7 +22,6 @@ import xml.etree.ElementTree as ET
core_factory_list = [
("libembobj.a", "embobj_component_getFactory"),
("libevtattlo.a", "evtatt_component_getFactory"),
("libdrawinglayerlo.a", "drawinglayer_component_getFactory"),
("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
("libfsstoragelo.a", "fsstorage_component_getFactory"),
("libhyphenlo.a", "hyphen_component_getFactory"),
@ -148,6 +147,8 @@ core_constructor_list = [
"com_sun_star_cui_ColorPicker_get_implementation",
# dbaccess/util/dba.component
"com_sun_star_comp_dba_ORowSet_get_implementation",
# drawinglayer/drawinglayer.component
"drawinglayer_XPrimitive2DRenderer",
# emfio/emfio.component
"emfio_emfreader_XEmfParser_get_implementation",
# extensions/source/logging/log.component