[Libreoffice-commits] core.git: filter/source solenv/bin

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Jul 12 18:02:53 UTC 2020


 filter/source/svg/svgfilter.component |    8 +++--
 filter/source/svg/svgfilter.cxx       |   54 ++++++++++++++--------------------
 filter/source/svg/svgfilter.hxx       |    8 ++++-
 filter/source/svg/svgwriter.cxx       |   22 +++++++++++++
 filter/source/svg/svgwriter.hxx       |    7 +++-
 solenv/bin/native-code.py             |    4 +-
 6 files changed, 66 insertions(+), 37 deletions(-)

New commits:
commit 74f4a1e4a8898b87e4b90804d369f1bfa49e6cbb
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Jul 11 20:37:10 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 12 20:02:14 2020 +0200

    filter/svg: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: I6a049364726327d1be10f72174aced5bade271a4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98571
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/svg/svgfilter.component b/filter/source/svg/svgfilter.component
index 612d523502c9..479748f38655 100644
--- a/filter/source/svg/svgfilter.component
+++ b/filter/source/svg/svgfilter.component
@@ -18,13 +18,15 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="svgfilter" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.Draw.SVGFilter">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.Draw.SVGFilter"
+    constructor="filter_SVGFilter_get_implementation">
     <service name="com.sun.star.document.ImportFilter"/>
     <service name="com.sun.star.document.ExportFilter"/>
     <service name="com.sun.star.document.ExtendedTypeDetection"/>
   </implementation>
-  <implementation name="com.sun.star.comp.Draw.SVGWriter">
+  <implementation name="com.sun.star.comp.Draw.SVGWriter"
+    constructor="filter_SVGWriter_get_implementation">
     <service name="com.sun.star.svg.SVGWriter"/>
   </implementation>
 </component>
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 1757fa42f758..41cd98e4dbf7 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -21,7 +21,7 @@
 #include <cstdio>
 
 #include <comphelper/lok.hxx>
-#include <comphelper/servicedecl.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/drawing/XDrawPage.hpp>
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <com/sun/star/drawing/XDrawView.hpp>
@@ -825,37 +825,29 @@ OUString SAL_CALL SVGFilter::detect(Sequence<PropertyValue>& rDescriptor)
     return aRetval;
 }
 
-#define SVG_FILTER_IMPL_NAME "com.sun.star.comp.Draw.SVGFilter"
-#define SVG_WRITER_IMPL_NAME "com.sun.star.comp.Draw.SVGWriter"
-
-namespace sdecl = comphelper::service_decl;
- sdecl::class_<SVGFilter> const serviceFilterImpl;
- const sdecl::ServiceDecl svgFilter(
-     serviceFilterImpl,
-     SVG_FILTER_IMPL_NAME,
-     "com.sun.star.document.ImportFilter;"
-     "com.sun.star.document.ExportFilter;"
-     "com.sun.star.document.ExtendedTypeDetection" );
-
- sdecl::class_<SVGWriter, sdecl::with_args<true> > const serviceWriterImpl;
- const sdecl::ServiceDecl svgWriter(
-     serviceWriterImpl,
-     SVG_WRITER_IMPL_NAME,
-     "com.sun.star.svg.SVGWriter" );
-
-// The C shared lib entry points
-extern "C" SAL_DLLPUBLIC_EXPORT void* svgfilter_component_getFactory(
-    char const* pImplName, void*, void*)
+//  XServiceInfo
+sal_Bool SVGFilter::supportsService(const OUString& sServiceName)
 {
-    if ( rtl_str_compare (pImplName, SVG_FILTER_IMPL_NAME) == 0 )
-    {
-        return sdecl::component_getFactoryHelper( pImplName, {&svgFilter} );
-    }
-    else if ( rtl_str_compare (pImplName, SVG_WRITER_IMPL_NAME) == 0 )
-    {
-        return sdecl::component_getFactoryHelper( pImplName, {&svgWriter} );
-    }
-    return nullptr;
+    return cppu::supportsService(this, sServiceName);
 }
+OUString SVGFilter::getImplementationName()
+{
+    return "com.sun.star.comp.Draw.SVGFilter";
+}
+css::uno::Sequence< OUString > SVGFilter::getSupportedServiceNames()
+{
+    return { "com.sun.star.document.ImportFilter",
+            "com.sun.star.document.ExportFilter",
+            "com.sun.star.document.ExtendedTypeDetection" };
+}
+
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_SVGFilter_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
+{
+    return cppu::acquire(new SVGFilter(context));
+}
+
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index 6ad17b1f6732..b06889a1a489 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/document/XExtendedFilterDetection.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
 #include <cppuhelper/implbase.hxx>
 #include <com/sun/star/xml/sax/XWriter.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
@@ -158,7 +159,7 @@ class EditFieldInfo;
 class SVGFilter : public cppu::WeakImplHelper < XFilter,
                                                  XImporter,
                                                  XExporter,
-                                                 XExtendedFilterDetection >
+                                                 XExtendedFilterDetection, XServiceInfo >
 {
 public:
     typedef std::unordered_map< Reference< XInterface >, ObjectRepresentation >    ObjectMap;
@@ -287,6 +288,11 @@ public:
 
     explicit SVGFilter( const Reference< XComponentContext >& rxCtx );
     virtual    ~SVGFilter() override;
+
+    //  XServiceInfo
+    virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override;
+    virtual OUString SAL_CALL getImplementationName() override;
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 };
 
 #endif // INCLUDED_FILTER_SOURCE_SVG_SVGFILTER_HXX
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 4baddb4743e9..d46c77ff37ea 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -22,6 +22,7 @@
 #include "svgwriter.hxx"
 
 #include <comphelper/base64.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <sal/log.hxx>
 #include <vcl/unohelp.hxx>
 #include <vcl/cvtgrf.hxx>
@@ -3839,4 +3840,25 @@ void SAL_CALL SVGWriter::write( const Reference<XDocumentHandler>& rxDocHandler,
     pWriter->writeMtf( aMtf );
 }
 
+//  XServiceInfo
+sal_Bool SVGWriter::supportsService(const OUString& sServiceName)
+{
+    return cppu::supportsService(this, sServiceName);
+}
+OUString SVGWriter::getImplementationName()
+{
+    return "com.sun.star.comp.Draw.SVGWriter";
+}
+css::uno::Sequence< OUString > SVGWriter::getSupportedServiceNames()
+{
+    return { "com.sun.star.svg.SVGWriter" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_SVGWriter_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
+{
+    return cppu::acquire(new SVGWriter(args, context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index 065d0585bb88..b3070d758ab2 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -369,7 +369,7 @@ public:
 };
 
 
-class SVGWriter : public cppu::WeakImplHelper< XSVGWriter >
+class SVGWriter : public cppu::WeakImplHelper< XSVGWriter, XServiceInfo >
 {
 private:
     Reference< XComponentContext >                      mxContext;
@@ -383,6 +383,11 @@ public:
     // XSVGWriter
     virtual void SAL_CALL write( const Reference<XDocumentHandler>& rxDocHandler,
                                  const Sequence<sal_Int8>& rMtfSeq ) override;
+
+    //  XServiceInfo
+    virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override;
+    virtual OUString SAL_CALL getImplementationName() override;
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 };
 
 #endif // INCLUDED_FILTER_SOURCE_SVG_SVGWRITER_HXX
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index b2a0aed722ad..e7394bf01852 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -505,7 +505,6 @@ calc_constructor_list = [
 
 draw_factory_list = [
     ("libsdlo.a", "sd_component_getFactory"),
-    ("libsvgfilterlo.a", "svgfilter_component_getFactory"),
     ("libemboleobj.a", "emboleobj_component_getFactory"),
     ]
 
@@ -533,6 +532,9 @@ draw_constructor_list = [
     "com_sun_star_comp_deployment_help_PackageRegistryBackend_get_implementation",
     "com_sun_star_comp_deployment_script_PackageRegistryBackend_get_implementation",
     "com_sun_star_comp_deployment_sfwk_PackageRegistryBackend_get_implementation",
+# filter/source/svg/svgfilter.component
+    "filter_SVGFilter_get_implementation",
+    "filter_SVGWriter_get_implementation",
 # sd/util/sd.component
     "RandomAnimationNode_get_implementation",
     "com_sun_star_comp_Draw_framework_BasicPaneFactory_get_implementation",


More information about the Libreoffice-commits mailing list