diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-04 12:48:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-05 11:37:50 +0200 |
commit | 87e5ee310959d535c53a083258edff1b3b1335bd (patch) | |
tree | ae219c19102c8336dd99d687d6e1c38c4d66325c /canvas/source/vcl | |
parent | 0e60923e83a51c00b2769e9a8b9d9346df34640b (diff) |
canvas/vcl: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: Ifcd31616228234433d8d46fef50707de9d17f3b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98092
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas/source/vcl')
-rw-r--r-- | canvas/source/vcl/canvas.cxx | 12 | ||||
-rw-r--r-- | canvas/source/vcl/canvas.hxx | 3 | ||||
-rw-r--r-- | canvas/source/vcl/services.cxx | 69 | ||||
-rw-r--r-- | canvas/source/vcl/spritecanvas.cxx | 12 | ||||
-rw-r--r-- | canvas/source/vcl/spritecanvas.hxx | 3 | ||||
-rw-r--r-- | canvas/source/vcl/vclcanvas.component | 8 |
6 files changed, 27 insertions, 80 deletions
diff --git a/canvas/source/vcl/canvas.cxx b/canvas/source/vcl/canvas.cxx index 4713f8ab9d34..e8f6ffe0c62a 100644 --- a/canvas/source/vcl/canvas.cxx +++ b/canvas/source/vcl/canvas.cxx @@ -114,7 +114,7 @@ namespace vclcanvas OUString SAL_CALL Canvas::getServiceName( ) { - return CANVAS_SERVICE_NAME; + return "com.sun.star.rendering.Canvas.VCL"; } bool Canvas::repaint( const GraphicObjectSharedPtr& rGrf, @@ -130,4 +130,14 @@ namespace vclcanvas } } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_rendering_Canvas_VCL_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args) +{ + auto p = new vclcanvas::Canvas(args, context); + cppu::acquire(p); + p->initialize(); + return static_cast<cppu::OWeakObject*>(p); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/vcl/canvas.hxx b/canvas/source/vcl/canvas.hxx index 6a3c66b00d75..62f71b216848 100644 --- a/canvas/source/vcl/canvas.hxx +++ b/canvas/source/vcl/canvas.hxx @@ -41,9 +41,6 @@ #include "devicehelper.hxx" #include "repainttarget.hxx" -#define CANVAS_SERVICE_NAME "com.sun.star.rendering.Canvas.VCL" -#define CANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.Canvas.VCL" - namespace vclcanvas { typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas, diff --git a/canvas/source/vcl/services.cxx b/canvas/source/vcl/services.cxx deleted file mode 100644 index 7b130c6fda32..000000000000 --- a/canvas/source/vcl/services.cxx +++ /dev/null @@ -1,69 +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 <sal/config.h> - -#include <comphelper/servicedecl.hxx> - -#include "canvas.hxx" -#include "spritecanvas.hxx" - - -using namespace ::com::sun::star; - -namespace sdecl = comphelper::service_decl; - -namespace vclcanvas -{ - static uno::Reference<uno::XInterface> initCanvas( Canvas* pCanvas ) - { - uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas)); - pCanvas->initialize(); - return xRet; - } - - sdecl::class_<Canvas, sdecl::with_args<true> > const serviceImpl1(&initCanvas); - const sdecl::ServiceDecl vclCanvasDecl( - serviceImpl1, - CANVAS_IMPLEMENTATION_NAME, - CANVAS_SERVICE_NAME ); - - static uno::Reference<uno::XInterface> initSpriteCanvas( SpriteCanvas* pCanvas ) - { - uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas)); - pCanvas->initialize(); - return xRet; - } - - sdecl::class_<SpriteCanvas, sdecl::with_args<true> > const serviceImpl2(&initSpriteCanvas); - const sdecl::ServiceDecl vclSpriteCanvasDecl( - serviceImpl2, - SPRITECANVAS_IMPLEMENTATION_NAME, - SPRITECANVAS_SERVICE_NAME ); -} - -// The C shared lib entry points -extern "C" -SAL_DLLPUBLIC_EXPORT void* vclcanvas_component_getFactory( char const* pImplName, - void*, void* ) -{ - return sdecl::component_getFactoryHelper( pImplName, {&vclcanvas::vclCanvasDecl, &vclcanvas::vclSpriteCanvasDecl} ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/vcl/spritecanvas.cxx b/canvas/source/vcl/spritecanvas.cxx index 90aa55228b28..a82bf0d4db18 100644 --- a/canvas/source/vcl/spritecanvas.cxx +++ b/canvas/source/vcl/spritecanvas.cxx @@ -128,7 +128,7 @@ namespace vclcanvas OUString SAL_CALL SpriteCanvas::getServiceName( ) { - return SPRITECANVAS_SERVICE_NAME; + return "com.sun.star.rendering.SpriteCanvas.VCL"; } bool SpriteCanvas::repaint( const GraphicObjectSharedPtr& rGrf, @@ -144,4 +144,14 @@ namespace vclcanvas } } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_rendering_SpriteCanvas_VCL_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args) +{ + auto p = new vclcanvas::SpriteCanvas(args, context); + cppu::acquire(p); + p->initialize(); + return static_cast<cppu::OWeakObject*>(p); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/vcl/spritecanvas.hxx b/canvas/source/vcl/spritecanvas.hxx index fcca957dbc5c..06c70faca2c3 100644 --- a/canvas/source/vcl/spritecanvas.hxx +++ b/canvas/source/vcl/spritecanvas.hxx @@ -46,9 +46,6 @@ #include "repainttarget.hxx" -#define SPRITECANVAS_SERVICE_NAME "com.sun.star.rendering.SpriteCanvas.VCL" -#define SPRITECANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.SpriteCanvas.VCL" - namespace vclcanvas { typedef ::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas, diff --git a/canvas/source/vcl/vclcanvas.component b/canvas/source/vcl/vclcanvas.component index ecf2fa7b3e77..c2e0ffc09758 100644 --- a/canvas/source/vcl/vclcanvas.component +++ b/canvas/source/vcl/vclcanvas.component @@ -18,11 +18,13 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="vclcanvas" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.rendering.Canvas.VCL"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.rendering.Canvas.VCL" + constructor="com_sun_star_comp_rendering_Canvas_VCL_get_implementation"> <service name="com.sun.star.rendering.Canvas.VCL"/> </implementation> - <implementation name="com.sun.star.comp.rendering.SpriteCanvas.VCL"> + <implementation name="com.sun.star.comp.rendering.SpriteCanvas.VCL" + constructor="com_sun_star_comp_rendering_SpriteCanvas_VCL_get_implementation"> <service name="com.sun.star.rendering.SpriteCanvas.VCL"/> </implementation> </component> |