diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-06 18:46:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-07 11:56:41 +0200 |
commit | 125f3c4c930bd28a42c6819417b11b885e4586fc (patch) | |
tree | 361fbc8cbfa1e40ab7628fb7ef00bc335177cf04 /drawinglayer | |
parent | 33509fd9483099470160abb66074c5d052b31eda (diff) |
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>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/Library_drawinglayer.mk | 1 | ||||
-rw-r--r-- | drawinglayer/drawinglayer.component | 5 | ||||
-rw-r--r-- | drawinglayer/source/drawinglayeruno/drawinglayeruno.cxx | 55 | ||||
-rw-r--r-- | drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx | 41 | ||||
-rw-r--r-- | drawinglayer/source/drawinglayeruno/xprimitive2drenderer.hxx | 49 |
5 files changed, 14 insertions, 137 deletions
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 24b8055836d0..43a42b83b42c 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -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 \ diff --git a/drawinglayer/drawinglayer.component b/drawinglayer/drawinglayer.component index 146df69790b5..0b35eab47b83 100644 --- a/drawinglayer/drawinglayer.component +++ b/drawinglayer/drawinglayer.component @@ -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> diff --git a/drawinglayer/source/drawinglayeruno/drawinglayeruno.cxx b/drawinglayer/source/drawinglayeruno/drawinglayeruno.cxx deleted file mode 100644 index 52438318e77f..000000000000 --- a/drawinglayer/source/drawinglayeruno/drawinglayeruno.cxx +++ /dev/null @@ -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: */ diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx index e4708c4131b4..66b29591df7e 100644 --- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx +++ b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx @@ -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: */ diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.hxx b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.hxx deleted file mode 100644 index ba18f9ba3096..000000000000 --- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.hxx +++ /dev/null @@ -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: */ |