[Libreoffice-commits] core.git: cppcanvas/source cui/Library_cui.mk cui/source cui/util solenv/bin
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 6 10:25:51 UTC 2020
cppcanvas/source/uno/mtfrenderer.component | 5 +--
cppcanvas/source/uno/uno_mtfrenderer.cxx | 48 +++++++++++++++++++++--------
cppcanvas/source/uno/uno_mtfrenderer.hxx | 44 --------------------------
cui/Library_cui.mk | 1
cui/source/dialogs/colorpicker.cxx | 20 +++---------
cui/source/inc/colorpicker.hxx | 47 ----------------------------
cui/source/uno/services.cxx | 41 ------------------------
cui/util/cui.component | 5 +--
solenv/bin/native-code.py | 6 ++-
9 files changed, 52 insertions(+), 165 deletions(-)
New commits:
commit 29c5e1ccbe28751297699eb184a861ee6b2f2f7e
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Jul 5 15:37:54 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 6 12:25:13 2020 +0200
cui,cppcanvas: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: Id603bc26f95d3da86b8c7360a7bde8eee97049ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98141
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/cppcanvas/source/uno/mtfrenderer.component b/cppcanvas/source/uno/mtfrenderer.component
index cac7384e9bee..36020729fd30 100644
--- a/cppcanvas/source/uno/mtfrenderer.component
+++ b/cppcanvas/source/uno/mtfrenderer.component
@@ -8,8 +8,9 @@
*
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="mtfrenderer" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.rendering.MtfRenderer">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.rendering.MtfRenderer"
+ constructor="com_sun_star_comp_rendering_MtfRenderer_get_implementation">
<service name="com.sun.star.rendering.MtfRenderer"/>
</implementation>
</component>
diff --git a/cppcanvas/source/uno/uno_mtfrenderer.cxx b/cppcanvas/source/uno/uno_mtfrenderer.cxx
index 25540e2a54c1..76037892b4d0 100644
--- a/cppcanvas/source/uno/uno_mtfrenderer.cxx
+++ b/cppcanvas/source/uno/uno_mtfrenderer.cxx
@@ -7,13 +7,42 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include "uno_mtfrenderer.hxx"
#include <cppcanvas/vclfactory.hxx>
-#include <comphelper/servicedecl.hxx>
#include <o3tl/any.hxx>
+#include <com/sun/star/rendering/XMtfRenderer.hpp>
+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <vcl/gdimtf.hxx>
using namespace ::com::sun::star;
+typedef cppu::WeakComponentImplHelper<css::rendering::XMtfRenderer, css::beans::XFastPropertySet> MtfRendererBase;
+
+namespace {
+
+class MtfRenderer : private cppu::BaseMutex, public MtfRendererBase
+{
+public:
+ MtfRenderer (css::uno::Sequence<css::uno::Any> const& args,
+ css::uno::Reference<css::uno::XComponentContext> const&);
+
+ // XMtfRenderer iface
+ void SAL_CALL setMetafile (const css::uno::Sequence< sal_Int8 >& rMtf) override;
+ void SAL_CALL draw (double fScaleX, double fScaleY) override;
+
+ // XFastPropertySet
+ // setFastPropertyValue (0, GDIMetaFile*) is used to speedup the rendering
+ virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 /*nHandle*/) override { return css::uno::Any(); }
+ virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const css::uno::Any&) override;
+
+private:
+ GDIMetaFile* mpMetafile;
+ css::uno::Reference<css::rendering::XBitmapCanvas> mxCanvas;
+};
+
void MtfRenderer::setMetafile (const uno::Sequence< sal_Int8 >& /*rMtf*/)
{
// printf ("MtfRenderer::setMetafile unimplemented, use fast property set or implement me\n");
@@ -45,18 +74,13 @@ MtfRenderer::MtfRenderer (uno::Sequence<uno::Any> const& aArgs, uno::Reference<u
}
}
-namespace sdecl = comphelper::service_decl;
- const sdecl::ServiceDecl MtfRendererDecl(
- sdecl::class_<MtfRenderer, sdecl::with_args<true> >(),
- "com.sun.star.comp.rendering.MtfRenderer",
- "com.sun.star.rendering.MtfRenderer" );
+} // namespace
-// The C shared lib entry points
-extern "C"
-SAL_DLLPUBLIC_EXPORT void* mtfrenderer_component_getFactory( char const* pImplName,
- void*, void* )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_comp_rendering_MtfRenderer_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
{
- return sdecl::component_getFactoryHelper( pImplName, {&MtfRendererDecl} );
+ return cppu::acquire(new MtfRenderer(args, context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/uno/uno_mtfrenderer.hxx b/cppcanvas/source/uno/uno_mtfrenderer.hxx
deleted file mode 100644
index 6cb720a31d00..000000000000
--- a/cppcanvas/source/uno/uno_mtfrenderer.hxx
+++ /dev/null
@@ -1,44 +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/.
- */
-
-#ifndef INCLUDED_CPPCANVAS_SOURCE_UNO_UNO_MTFRENDERER_HXX
-#define INCLUDED_CPPCANVAS_SOURCE_UNO_UNO_MTFRENDERER_HXX
-#include <com/sun/star/rendering/XMtfRenderer.hpp>
-#include <com/sun/star/rendering/XBitmapCanvas.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/beans/XFastPropertySet.hpp>
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
-#include <vcl/gdimtf.hxx>
-
-typedef cppu::WeakComponentImplHelper<css::rendering::XMtfRenderer, css::beans::XFastPropertySet> MtfRendererBase;
-
-class MtfRenderer : private cppu::BaseMutex, public MtfRendererBase
-{
-public:
- MtfRenderer (css::uno::Sequence<css::uno::Any> const& args,
- css::uno::Reference<css::uno::XComponentContext> const&);
-
- // XMtfRenderer iface
- void SAL_CALL setMetafile (const css::uno::Sequence< sal_Int8 >& rMtf) override;
- void SAL_CALL draw (double fScaleX, double fScaleY) override;
-
- // XFastPropertySet
- // setFastPropertyValue (0, GDIMetaFile*) is used to speedup the rendering
- virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 /*nHandle*/) override { return css::uno::Any(); }
- virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const css::uno::Any&) override;
-
-private:
- GDIMetaFile* mpMetafile;
- css::uno::Reference<css::rendering::XBitmapCanvas> mxCanvas;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 09f355776341..583cc5c74346 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -226,7 +226,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/tabpages/tpshadow \
cui/source/tabpages/tptrans \
cui/source/tabpages/transfrm \
- cui/source/uno/services \
))
# vim: set noet sw=4 ts=4:
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index ca5172f800ec..2dc7e779740c 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -33,7 +33,6 @@
#include <vcl/weld.hxx>
#include <svx/hexcolorcontrol.hxx>
#include <basegfx/color/bcolortools.hxx>
-#include <colorpicker.hxx>
#include <cmath>
#include <o3tl/typed_flags_set.hxx>
@@ -1240,20 +1239,13 @@ private:
}
-OUString ColorPicker_getImplementationName()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_cui_ColorPicker_get_implementation(
+ css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const&)
{
- return "com.sun.star.cui.ColorPicker";
+ return cppu::acquire( new ColorPicker );
}
-Reference< XInterface > ColorPicker_createInstance( Reference< XComponentContext > const & )
-{
- return static_cast<XWeak*>( new ColorPicker );
-}
-
-Sequence< OUString > ColorPicker_getSupportedServiceNames()
-{
- return { "com.sun.star.ui.dialogs.ColorPicker" };
-}
const OUStringLiteral gsColorKey( "Color" );
const OUStringLiteral gsModeKey( "Mode" );
@@ -1277,7 +1269,7 @@ void SAL_CALL ColorPicker::initialize( const Sequence< Any >& aArguments )
// XInitialization
OUString SAL_CALL ColorPicker::getImplementationName( )
{
- return ColorPicker_getImplementationName();
+ return "com.sun.star.cui.ColorPicker";
}
sal_Bool SAL_CALL ColorPicker::supportsService( const OUString& sServiceName )
@@ -1287,7 +1279,7 @@ sal_Bool SAL_CALL ColorPicker::supportsService( const OUString& sServiceName )
Sequence< OUString > SAL_CALL ColorPicker::getSupportedServiceNames( )
{
- return ColorPicker_getSupportedServiceNames();
+ return { "com.sun.star.ui.dialogs.ColorPicker" };
}
// XPropertyAccess
diff --git a/cui/source/inc/colorpicker.hxx b/cui/source/inc/colorpicker.hxx
deleted file mode 100644
index 7c05ebabcc46..000000000000
--- a/cui/source/inc/colorpicker.hxx
+++ /dev/null
@@ -1,47 +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_CUI_SOURCE_INC_COLORPICKER_HXX
-#define INCLUDED_CUI_SOURCE_INC_COLORPICKER_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::uno {
- class XComponentContext;
- class XInterface;
-}
-
-namespace cui {
-
-OUString ColorPicker_getImplementationName();
-
-css::uno::Reference<css::uno::XInterface> ColorPicker_createInstance(
- css::uno::Reference<css::uno::XComponentContext> const &);
-
-/// @throws css::uno::RuntimeException
-css::uno::Sequence<OUString> ColorPicker_getSupportedServiceNames();
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/uno/services.cxx b/cui/source/uno/services.cxx
deleted file mode 100644
index 62c6bbaf47a1..000000000000
--- a/cui/source/uno/services.cxx
+++ /dev/null
@@ -1,41 +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/types.h>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implementationentry.hxx>
-
-#include <colorpicker.hxx>
-
-using namespace com::sun::star;
-
-namespace
-{
- cppu::ImplementationEntry const entries[] = {
- { &::cui::ColorPicker_createInstance, &::cui::ColorPicker_getImplementationName, &::cui::ColorPicker_getSupportedServiceNames, &cppu::createSingleComponentFactory, nullptr, 0 },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
- };
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * cui_component_getFactory( char const * implName, void * serviceManager, void * registryKey)
-{
- return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/util/cui.component b/cui/util/cui.component
index e4a5c124ff49..37023b4e1fa1 100644
--- a/cui/util/cui.component
+++ b/cui/util/cui.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="cui" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.cui.ColorPicker">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.cui.ColorPicker"
+ constructor="com_sun_star_cui_ColorPicker_get_implementation">
<service name="com.sun.star.ui.dialogs.ColorPicker"/>
</implementation>
</component>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index cdafb9c550d7..e18af665c835 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -47,7 +47,6 @@ core_factory_list = [
("libutllo.a", "utl_component_getFactory"),
("libxoflo.a", "xof_component_getFactory"),
("libxstor.a", "xstor_component_getFactory"),
- ("libmtfrendererlo.a", "mtfrenderer_component_getFactory"),
("libxmlfdlo.a", "xmlfd_component_getFactory"),
("libxmlfalo.a", "xmlfa_component_getFactory"),
("libodfflatxmllo.a", "odfflatxml_component_getFactory"),
@@ -59,7 +58,6 @@ core_factory_list = [
("libsvgiolo.a", "svgio_component_getFactory"),
("libsvtlo.a", "svt_component_getFactory"),
("libMacOSXSpelllo.a", "MacOSXSpell_component_getFactory", "#ifdef IOS"),
- ("libcuilo.a", "cui_component_getFactory"),
("libproxyfaclo.a", "proxyfac_component_getFactory"),
("libguesslanglo.a", "guesslang_component_getFactory"),
("libbiblo.a", "bib_component_getFactory"),
@@ -147,6 +145,10 @@ core_constructor_list = [
"com_sun_star_comp_configuration_ReadOnlyAccess_get_implementation",
"com_sun_star_comp_configuration_ReadWriteAccess_get_implementation",
"com_sun_star_comp_configuration_Update_get_implementation",
+# cppcanvas/source/uno/mtfrenderer.component
+ "com_sun_star_comp_rendering_MtfRenderer_get_implementation",
+# cui/util/cui.component
+ "com_sun_star_cui_ColorPicker_get_implementation",
# dbaccess/util/dba.component
"com_sun_star_comp_dba_ORowSet_get_implementation",
# extensions/source/logging/log.component
More information about the Libreoffice-commits
mailing list