[Libreoffice-commits] core.git: canvas/Library_vclcanvas.mk canvas/source solenv/bin

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Jul 5 09:38:33 UTC 2020


 canvas/Library_vclcanvas.mk           |    1 
 canvas/source/vcl/canvas.cxx          |   12 +++++
 canvas/source/vcl/canvas.hxx          |    3 -
 canvas/source/vcl/services.cxx        |   69 ----------------------------------
 canvas/source/vcl/spritecanvas.cxx    |   12 +++++
 canvas/source/vcl/spritecanvas.hxx    |    3 -
 canvas/source/vcl/vclcanvas.component |    8 ++-
 solenv/bin/native-code.py             |    4 +
 8 files changed, 30 insertions(+), 82 deletions(-)

New commits:
commit 87e5ee310959d535c53a083258edff1b3b1335bd
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Jul 4 12:48:14 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 5 11:37:50 2020 +0200

    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 at collabora.co.uk>

diff --git a/canvas/Library_vclcanvas.mk b/canvas/Library_vclcanvas.mk
index 40e5de9eb61d..27a54ba651a6 100644
--- a/canvas/Library_vclcanvas.mk
+++ b/canvas/Library_vclcanvas.mk
@@ -59,7 +59,6 @@ $(eval $(call gb_Library_add_exception_objects,vclcanvas,\
 	canvas/source/vcl/canvashelper \
 	canvas/source/vcl/devicehelper \
 	canvas/source/vcl/impltools \
-	canvas/source/vcl/services \
 	canvas/source/vcl/spritecanvas \
 	canvas/source/vcl/spritecanvashelper \
 	canvas/source/vcl/spritedevicehelper \
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>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 4713dff269e6..0a2c3c7285cd 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -49,7 +49,6 @@ core_factory_list = [
     ("libutllo.a", "utl_component_getFactory"),
     ("libxoflo.a", "xof_component_getFactory"),
     ("libxstor.a", "xstor_component_getFactory"),
-    ("libvclcanvaslo.a", "vclcanvas_component_getFactory"),
     ("libmtfrendererlo.a", "mtfrenderer_component_getFactory"),
     ("libxmlfdlo.a", "xmlfd_component_getFactory"),
     ("libxmlfalo.a", "xmlfa_component_getFactory"),
@@ -77,6 +76,9 @@ core_constructor_list = [
     "stardiv_UnoControls_StatusIndicator_get_implementation",
 # canvas/source/factory/canvasfactory.component
     "com_sun_star_comp_rendering_CanvasFactory_get_implementation",
+# canvas/source/vcl/vclcanvas.component
+    "com_sun_star_comp_rendering_Canvas_VCL_get_implementation",
+    "com_sun_star_comp_rendering_SpriteCanvas_VCL_get_implementation",
 # chart2/source/chartcore.component
     "com_sun_star_chart2_ExponentialScaling_get_implementation",
     "com_sun_star_chart2_LinearScaling_get_implementation",


More information about the Libreoffice-commits mailing list