summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-11 20:37:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-12 20:02:14 +0200
commit74f4a1e4a8898b87e4b90804d369f1bfa49e6cbb (patch)
tree0df13e39da4a88bfde581b0f0bdb2a556b7c6c5d /filter
parent466e63ed692974c1b7529f22574538178e8928af (diff)
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@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/svg/svgfilter.component8
-rw-r--r--filter/source/svg/svgfilter.cxx54
-rw-r--r--filter/source/svg/svgfilter.hxx8
-rw-r--r--filter/source/svg/svgwriter.cxx22
-rw-r--r--filter/source/svg/svgwriter.hxx7
5 files changed, 63 insertions, 36 deletions
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