From eff6d8213665c7b955fddadc1f446c76b0074924 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Mon, 8 Feb 2016 08:15:27 +0100 Subject: [PATCH] wpftimpress: use service constructor Change-Id: Ic53703b68b816eafe598f70df46aaa11b452b4f7 --- writerperfect/Library_wpftimpress.mk | 1 - .../source/impress/KeynoteImportFilter.cxx | 39 +++++------- .../source/impress/KeynoteImportFilter.hxx | 13 ---- .../impress/MWAWPresentationImportFilter.cxx | 39 +++++------- .../source/impress/wpftimpress.component | 8 ++- .../impress/wpftimpress_genericfilter.cxx | 59 ------------------- 6 files changed, 35 insertions(+), 124 deletions(-) delete mode 100644 writerperfect/source/impress/wpftimpress_genericfilter.cxx diff --git a/writerperfect/Library_wpftimpress.mk b/writerperfect/Library_wpftimpress.mk index 3d35aa778151..116b72a1235a 100644 --- a/writerperfect/Library_wpftimpress.mk +++ b/writerperfect/Library_wpftimpress.mk @@ -57,7 +57,6 @@ $(eval $(call gb_Library_use_externals,wpftimpress,\ $(eval $(call gb_Library_add_exception_objects,wpftimpress,\ writerperfect/source/impress/KeynoteImportFilter \ writerperfect/source/impress/MWAWPresentationImportFilter \ - writerperfect/source/impress/wpftimpress_genericfilter \ )) # vim: set noet sw=4 ts=4: diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx index 312f7a4d66bf..c54091cd1bfb 100644 --- a/writerperfect/source/impress/KeynoteImportFilter.cxx +++ b/writerperfect/source/impress/KeynoteImportFilter.cxx @@ -238,33 +238,11 @@ throw(css::uno::RuntimeException, std::exception) return sTypeName; } -OUString KeynoteImportFilter_getImplementationName() -throw (RuntimeException) -{ - return OUString("org.libreoffice.comp.Impress.KeynoteImportFilter"); -} - -Sequence< OUString > SAL_CALL KeynoteImportFilter_getSupportedServiceNames() -throw (RuntimeException) -{ - Sequence < OUString > aRet(2); - OUString *pArray = aRet.getArray(); - pArray[0] = "com.sun.star.document.ImportFilter"; - pArray[1] = "com.sun.star.document.ExtendedTypeDetection"; - return aRet; -} - -Reference< XInterface > SAL_CALL KeynoteImportFilter_createInstance(const Reference< XComponentContext > &rContext) -throw(Exception) -{ - return static_cast(new KeynoteImportFilter(rContext)); -} - // XServiceInfo OUString SAL_CALL KeynoteImportFilter::getImplementationName() throw (RuntimeException, std::exception) { - return KeynoteImportFilter_getImplementationName(); + return OUString("org.libreoffice.comp.Impress.KeynoteImportFilter"); } sal_Bool SAL_CALL KeynoteImportFilter::supportsService(const OUString &rServiceName) @@ -276,7 +254,20 @@ throw (RuntimeException, std::exception) Sequence< OUString > SAL_CALL KeynoteImportFilter::getSupportedServiceNames() throw (RuntimeException, std::exception) { - return KeynoteImportFilter_getSupportedServiceNames(); + Sequence < OUString > aRet(2); + OUString *pArray = aRet.getArray(); + pArray[0] = "com.sun.star.document.ImportFilter"; + pArray[1] = "com.sun.star.document.ExtendedTypeDetection"; + return aRet; +} + +extern "C" +SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL +org_libreoffice_comp_Impress_KeynoteImportFilter_get_implementation( + css::uno::XComponentContext *const context, + const css::uno::Sequence &) +{ + return cppu::acquire(new KeynoteImportFilter(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/impress/KeynoteImportFilter.hxx b/writerperfect/source/impress/KeynoteImportFilter.hxx index 69daf682d2a4..e4c88001c006 100644 --- a/writerperfect/source/impress/KeynoteImportFilter.hxx +++ b/writerperfect/source/impress/KeynoteImportFilter.hxx @@ -41,19 +41,6 @@ private: virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, OdpGenerator &rGenerator, utl::MediaDescriptor &) override; }; -OUString KeynoteImportFilter_getImplementationName() -throw (css::uno::RuntimeException); - -bool SAL_CALL KeynoteImportFilter_supportsService(const OUString &ServiceName) -throw (css::uno::RuntimeException); - -css::uno::Sequence< OUString > SAL_CALL KeynoteImportFilter_getSupportedServiceNames() -throw (css::uno::RuntimeException); - -css::uno::Reference< css::uno::XInterface > -SAL_CALL KeynoteImportFilter_createInstance(const css::uno::Reference< css::uno::XComponentContext > &rContext) -throw (css::uno::Exception); - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/impress/MWAWPresentationImportFilter.cxx b/writerperfect/source/impress/MWAWPresentationImportFilter.cxx index 68c9b3bde6bb..5027df4b7144 100644 --- a/writerperfect/source/impress/MWAWPresentationImportFilter.cxx +++ b/writerperfect/source/impress/MWAWPresentationImportFilter.cxx @@ -78,33 +78,11 @@ void MWAWPresentationImportFilter::doRegisterHandlers(OdpGenerator &rGenerator) rGenerator.registerEmbeddedObjectHandler("image/mwaw-ods", &handleEmbeddedMWAWSpreadsheetObject); } -OUString MWAWPresentationImportFilter_getImplementationName() -throw (RuntimeException) -{ - return OUString("com.sun.star.comp.Impress.MWAWPresentationImportFilter"); -} - -Sequence< OUString > SAL_CALL MWAWPresentationImportFilter_getSupportedServiceNames() -throw (RuntimeException) -{ - Sequence < OUString > aRet(2); - OUString *pArray = aRet.getArray(); - pArray[0] = "com.sun.star.document.ImportFilter"; - pArray[1] = "com.sun.star.document.ExtendedTypeDetection"; - return aRet; -} - -Reference< XInterface > SAL_CALL MWAWPresentationImportFilter_createInstance(const Reference< XComponentContext > &rContext) -throw(Exception) -{ - return static_cast(new MWAWPresentationImportFilter(rContext)); -} - // XServiceInfo OUString SAL_CALL MWAWPresentationImportFilter::getImplementationName() throw (RuntimeException, std::exception) { - return MWAWPresentationImportFilter_getImplementationName(); + return OUString("com.sun.star.comp.Impress.MWAWPresentationImportFilter"); } sal_Bool SAL_CALL MWAWPresentationImportFilter::supportsService(const OUString &rServiceName) throw (RuntimeException, std::exception) @@ -114,7 +92,20 @@ throw (RuntimeException, std::exception) Sequence< OUString > SAL_CALL MWAWPresentationImportFilter::getSupportedServiceNames() throw (RuntimeException, std::exception) { - return MWAWPresentationImportFilter_getSupportedServiceNames(); + Sequence < OUString > aRet(2); + OUString *pArray = aRet.getArray(); + pArray[0] = "com.sun.star.document.ImportFilter"; + pArray[1] = "com.sun.star.document.ExtendedTypeDetection"; + return aRet; +} + +extern "C" +SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL +com_sun_star_comp_Impress_MWAWPresentationImportFilter_get_implementation( + css::uno::XComponentContext *const context, + const css::uno::Sequence &) +{ + return cppu::acquire(new MWAWPresentationImportFilter(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/impress/wpftimpress.component b/writerperfect/source/impress/wpftimpress.component index 58d00cc279b0..5413c9a7b4bd 100644 --- a/writerperfect/source/impress/wpftimpress.component +++ b/writerperfect/source/impress/wpftimpress.component @@ -8,12 +8,14 @@ * --> - + xmlns="http://openoffice.org/2010/uno-components"> + - + diff --git a/writerperfect/source/impress/wpftimpress_genericfilter.cxx b/writerperfect/source/impress/wpftimpress_genericfilter.cxx deleted file mode 100644 index 2f50025fefed..000000000000 --- a/writerperfect/source/impress/wpftimpress_genericfilter.cxx +++ /dev/null @@ -1,59 +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 . - */ - -/* genericfilter: mostly generic code for registering the filter */ - -#include "sal/config.h" - -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "sal/types.h" - -#include "KeynoteImportFilter.hxx" -#include "MWAWPresentationImportFilter.hxx" - -namespace -{ - -static cppu::ImplementationEntry const services[] = -{ - { - &KeynoteImportFilter_createInstance, &KeynoteImportFilter_getImplementationName, - &KeynoteImportFilter_getSupportedServiceNames, - &cppu::createSingleComponentFactory, nullptr, 0 - }, - { - &MWAWPresentationImportFilter_createInstance, - &MWAWPresentationImportFilter_getImplementationName, - &MWAWPresentationImportFilter_getSupportedServiceNames, - &cppu::createSingleComponentFactory, nullptr, 0 - }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void *SAL_CALL wpftimpress_component_getFactory( - char const *pImplName, void *pServiceManager, void *pRegistryKey) -{ - return cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, services); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */