summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-12 20:25:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-13 08:48:38 +0200
commitdf2a7a79322df1fb2ff301b6b1b4ea243b7fda28 (patch)
tree851328a65e9ed49cbb0c8192afd78abe8c44820c
parentcea25cb5eda6bcef6c74c735a2c38dea57191a1b (diff)
filter/graphic: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I28b6c5a532f55c88bad46573c123f92766b5af91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98610 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--filter/Library_graphicfilter.mk1
-rw-r--r--filter/source/graphic/GraphicExportFilter.cxx21
-rw-r--r--filter/source/graphic/GraphicExportFilter.hxx8
-rw-r--r--filter/source/graphic/Services.cxx42
-rw-r--r--filter/source/graphic/graphicfilter.component5
5 files changed, 31 insertions, 46 deletions
diff --git a/filter/Library_graphicfilter.mk b/filter/Library_graphicfilter.mk
index b6b760f1dbfc..110e9b4d8a13 100644
--- a/filter/Library_graphicfilter.mk
+++ b/filter/Library_graphicfilter.mk
@@ -48,7 +48,6 @@ $(eval $(call gb_Library_use_libraries,graphicfilter,\
$(eval $(call gb_Library_add_exception_objects,graphicfilter,\
filter/source/graphic/GraphicExportFilter \
- filter/source/graphic/Services \
))
# vim: set noet sw=4 ts=4:
diff --git a/filter/source/graphic/GraphicExportFilter.cxx b/filter/source/graphic/GraphicExportFilter.cxx
index 548a2c4e1407..b498e71dd4e3 100644
--- a/filter/source/graphic/GraphicExportFilter.cxx
+++ b/filter/source/graphic/GraphicExportFilter.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/frame/XModel.hpp>
+#include <cppuhelper/supportsservice.hxx>
#include <vcl/graphicfilter.hxx>
#include <svl/outstrm.hxx>
#include <svtools/DocumentToGraphicRenderer.hxx>
@@ -40,6 +41,20 @@ GraphicExportFilter::GraphicExportFilter( const uno::Reference< uno::XComponentC
GraphicExportFilter::~GraphicExportFilter()
{}
+// XServiceInfo
+sal_Bool GraphicExportFilter::supportsService(const OUString& sServiceName)
+{
+ return cppu::supportsService(this, sServiceName);
+}
+OUString GraphicExportFilter::getImplementationName()
+{
+ return "com.sun.star.comp.GraphicExportFilter";
+}
+css::uno::Sequence< OUString > GraphicExportFilter::getSupportedServiceNames()
+{
+ return { "com.sun.star.document.ExportFilter" };
+}
+
void GraphicExportFilter::gatherProperties( const uno::Sequence< beans::PropertyValue > & rProperties )
{
OUString aInternalFilterName;
@@ -210,4 +225,10 @@ void SAL_CALL GraphicExportFilter::initialize( const uno::Sequence< uno::Any > &
{
}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_GraphicExportFilter_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new GraphicExportFilter(context));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphic/GraphicExportFilter.hxx b/filter/source/graphic/GraphicExportFilter.hxx
index e35404250d13..d9d4c5a898ac 100644
--- a/filter/source/graphic/GraphicExportFilter.hxx
+++ b/filter/source/graphic/GraphicExportFilter.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -36,7 +37,7 @@ namespace com::sun::star {
}
class GraphicExportFilter :
- public cppu::WeakImplHelper < css::document::XFilter, css::document::XExporter, css::lang::XInitialization >
+ public cppu::WeakImplHelper < css::document::XFilter, css::document::XExporter, css::lang::XInitialization, css::lang::XServiceInfo >
{
css::uno::Reference< css::uno::XComponentContext > mxContext;
css::uno::Reference< css::lang::XComponent > mxDocument;
@@ -60,6 +61,11 @@ public:
explicit GraphicExportFilter( const css::uno::Reference< css::uno::XComponentContext > & rxContext );
virtual ~GraphicExportFilter() 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;
+
// XFilter
virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue > & rDescriptor ) override;
virtual void SAL_CALL cancel( ) override;
diff --git a/filter/source/graphic/Services.cxx b/filter/source/graphic/Services.cxx
deleted file mode 100644
index 49c86b5a8f92..000000000000
--- a/filter/source/graphic/Services.cxx
+++ /dev/null
@@ -1,42 +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 "GraphicExportFilter.hxx"
-#include <comphelper/servicedecl.hxx>
-
-#define GRAPHIC_EXPORT_FILTER_SERVICE "com.sun.star.comp.GraphicExportFilter"
-
-comphelper::service_decl::class_<GraphicExportFilter> const serviceGraphicExportFilter;
-const comphelper::service_decl::ServiceDecl graphicExportFilter(
- serviceGraphicExportFilter,
- GRAPHIC_EXPORT_FILTER_SERVICE,
- "com.sun.star.document.ExportFilter" );
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* graphicfilter_component_getFactory(
- char const* pImplementationName, void*, void*)
-{
- if ( rtl_str_compare (pImplementationName, GRAPHIC_EXPORT_FILTER_SERVICE) == 0 )
- {
- return comphelper::service_decl::component_getFactoryHelper( pImplementationName, {&graphicExportFilter} );
- }
- return nullptr;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/graphic/graphicfilter.component b/filter/source/graphic/graphicfilter.component
index 14afb9377d02..1040d14400bc 100644
--- a/filter/source/graphic/graphicfilter.component
+++ b/filter/source/graphic/graphicfilter.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="graphicfilter" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.GraphicExportFilter">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.GraphicExportFilter"
+ constructor="filter_GraphicExportFilter_get_implementation">
<service name="com.sun.star.document.ExportFilter"/>
</implementation>
</component>