wpftimpress: use service constructor

Change-Id: Ic53703b68b816eafe598f70df46aaa11b452b4f7
This commit is contained in:
David Tardon 2016-02-08 08:15:27 +01:00
parent 3af1b7f593
commit eff6d82136
6 changed files with 35 additions and 124 deletions

View file

@ -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:

View file

@ -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<cppu::OWeakObject *>(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<css::uno::Any> &)
{
return cppu::acquire(new KeynoteImportFilter(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -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: */

View file

@ -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<cppu::OWeakObject *>(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<css::uno::Any> &)
{
return cppu::acquire(new MWAWPresentationImportFilter(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -8,12 +8,14 @@
*
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="wpftimpress" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="org.libreoffice.comp.Impress.KeynoteImportFilter">
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="org.libreoffice.comp.Impress.KeynoteImportFilter"
constructor="org_libreoffice_comp_Impress_KeynoteImportFilter_get_implementation">
<service name="com.sun.star.document.ImportFilter"/>
<service name="com.sun.star.document.ExtendedTypeDetection"/>
</implementation>
<implementation name="com.sun.star.comp.Impress.MWAWPresentationImportFilter">
<implementation name="com.sun.star.comp.Impress.MWAWPresentationImportFilter"
constructor="com_sun_star_comp_Impress_MWAWPresentationImportFilter_get_implementation">
<service name="com.sun.star.document.ImportFilter"/>
<service name="com.sun.star.document.ExtendedTypeDetection"/>
</implementation>

View file

@ -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: */