diff options
author | Chris Sherlock <chris.sherlock@collabora.com> | 2015-02-18 23:18:59 +1100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-02-19 18:15:31 +0000 |
commit | b8a5e0cd17d53b787762f9827939c02ff25b92a5 (patch) | |
tree | f339967ecc215865640424ab6f316114c47440fd | |
parent | d74f5f8633d6fe39011d5a613e1dc62402e7a4e7 (diff) |
writerfilter: use constructor for writerfilter module
Change-Id: Iada80d2c6989de2811cf35cb288a430e2eeba8e9
Reviewed-on: https://gerrit.libreoffice.org/14536
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | writerfilter/Library_writerfilter.mk | 1 | ||||
-rw-r--r-- | writerfilter/source/filter/ImportFilter.cxx | 15 | ||||
-rw-r--r-- | writerfilter/source/filter/RtfFilter.cxx | 7 | ||||
-rw-r--r-- | writerfilter/source/filter/RtfFilter.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/filter/WriterFilter.cxx | 56 | ||||
-rw-r--r-- | writerfilter/source/filter/WriterFilter.hxx | 8 | ||||
-rw-r--r-- | writerfilter/source/filter/WriterFilterDetection.cxx | 15 | ||||
-rw-r--r-- | writerfilter/source/filter/WriterFilterDetection.hxx | 5 | ||||
-rw-r--r-- | writerfilter/util/writerfilter.component | 9 |
9 files changed, 26 insertions, 91 deletions
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk index 1bdfa8ee6a1f..f3af37a00252 100644 --- a/writerfilter/Library_writerfilter.mk +++ b/writerfilter/Library_writerfilter.mk @@ -114,7 +114,6 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\ writerfilter/source/dmapper/util \ writerfilter/source/filter/ImportFilter \ writerfilter/source/filter/RtfFilter \ - writerfilter/source/filter/WriterFilter \ writerfilter/source/filter/WriterFilterDetection \ writerfilter/source/ooxml/Handler \ writerfilter/source/ooxml/OOXMLBinaryObjectReference \ diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index 35f6402f81cc..5d43ff5e2ef0 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -298,14 +298,6 @@ uno::Sequence< OUString > WriterFilter_getSupportedServiceNames( ) throw (uno:: return aRet; } -uno::Reference< uno::XInterface > WriterFilter_createInstance( const uno::Reference< uno::XComponentContext >& xContext) - throw( uno::Exception ) -{ - return (cppu::OWeakObject*) new WriterFilter( xContext ); -} - - - OUString WriterFilter::getImplementationName( ) throw (uno::RuntimeException, std::exception) { return WriterFilter_getImplementationName(); @@ -352,4 +344,11 @@ void WriterFilter::putPropertiesToDocumentGrabBag( const comphelper::SequenceAsH } } +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_comp_Writer_WriterFilter_get_implementation(::com::sun::star::uno::XComponentContext* component, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new WriterFilter(component)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx index 421e4856397b..de5b5053133a 100644 --- a/writerfilter/source/filter/RtfFilter.cxx +++ b/writerfilter/source/filter/RtfFilter.cxx @@ -177,9 +177,10 @@ uno::Sequence<OUString> RtfFilter_getSupportedServiceNames() throw(uno::RuntimeE return aRet; } -uno::Reference< uno::XInterface > RtfFilter_createInstance(const uno::Reference< uno::XComponentContext >& xContext) throw(uno::Exception) +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_comp_Writer_RtfFilter_get_implementation(::com::sun::star::uno::XComponentContext* component, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) { - return (cppu::OWeakObject*) new RtfFilter(xContext); + return cppu::acquire(new RtfFilter(component)); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/filter/RtfFilter.hxx b/writerfilter/source/filter/RtfFilter.hxx index bfe30c071f97..dcd3a2e4c17e 100644 --- a/writerfilter/source/filter/RtfFilter.hxx +++ b/writerfilter/source/filter/RtfFilter.hxx @@ -76,7 +76,6 @@ public: OUString RtfFilter_getImplementationName() throw (css::uno::RuntimeException); css::uno::Sequence<OUString> SAL_CALL RtfFilter_getSupportedServiceNames() throw (css::uno::RuntimeException); -css::uno::Reference<css::uno::XInterface> SAL_CALL RtfFilter_createInstance(const css::uno::Reference<css::uno::XComponentContext>& xContext) throw(css::uno::Exception); #endif diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx deleted file mode 100644 index 9c55f2d3c0f5..000000000000 --- a/writerfilter/source/filter/WriterFilter.cxx +++ /dev/null @@ -1,56 +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 <cppuhelper/implementationentry.hxx> -#include <WriterFilter.hxx> -#include <WriterFilterDetection.hxx> -#include <RtfFilter.hxx> - -using namespace ::com::sun::star; - -WriterFilter::WriterFilter( const uno::Reference< uno::XComponentContext >& rxContext) : - m_xContext( rxContext ) -{ -} - - -WriterFilter::~WriterFilter() -{ -} - -extern "C" -{ -/* shared lib exports implemented with helpers */ -static const struct ::cppu::ImplementationEntry s_component_entries [] = -{ - { WriterFilter_createInstance, WriterFilter_getImplementationName, WriterFilter_getSupportedServiceNames, ::cppu::createSingleComponentFactory, nullptr, 0 }, - { WriterFilterDetection_createInstance, WriterFilterDetection_getImplementationName, WriterFilterDetection_getSupportedServiceNames, ::cppu::createSingleComponentFactory, nullptr, 0} , - { RtfFilter_createInstance, RtfFilter_getImplementationName, RtfFilter_getSupportedServiceNames, ::cppu::createSingleComponentFactory, nullptr, 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } // terminate with NULL -}; - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL writerfilter_component_getFactory(sal_Char const * implName, void * xMgr, void * xRegistry ) -{ - return ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry, s_component_entries ); -} - -} //extern "C" - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/filter/WriterFilter.hxx b/writerfilter/source/filter/WriterFilter.hxx index 8933f18826f1..8d82b0c92c18 100644 --- a/writerfilter/source/filter/WriterFilter.hxx +++ b/writerfilter/source/filter/WriterFilter.hxx @@ -47,8 +47,8 @@ protected: public: - WriterFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext); - virtual ~WriterFilter(); + WriterFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext) {} + virtual ~WriterFilter() {} // XFilter virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) @@ -91,10 +91,6 @@ bool SAL_CALL WriterFilter_supportsService( const OUString& ServiceName ) ::com::sun::star::uno::Sequence< OUString > SAL_CALL WriterFilter_getSupportedServiceNames( ) throw ( ::com::sun::star::uno::RuntimeException ); -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL WriterFilter_createInstance( - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > &xContext) - throw( ::com::sun::star::uno::Exception ); #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/filter/WriterFilterDetection.cxx b/writerfilter/source/filter/WriterFilterDetection.cxx index da8bd4aa2cdf..f7db967d0a94 100644 --- a/writerfilter/source/filter/WriterFilterDetection.cxx +++ b/writerfilter/source/filter/WriterFilterDetection.cxx @@ -109,14 +109,6 @@ uno::Sequence< OUString > WriterFilterDetection_getSupportedServiceNames( ) thr return aRet; } - -uno::Reference< uno::XInterface > WriterFilterDetection_createInstance( const uno::Reference< uno::XComponentContext >& xContext) - throw( uno::Exception ) -{ - return (cppu::OWeakObject*) new WriterFilterDetection( xContext ); -} - - OUString WriterFilterDetection::getImplementationName( ) throw (uno::RuntimeException, std::exception) { return WriterFilterDetection_getImplementationName(); @@ -134,4 +126,11 @@ uno::Sequence< OUString > WriterFilterDetection::getSupportedServiceNames( ) th return WriterFilterDetection_getSupportedServiceNames(); } +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_comp_Writer_WriterFilterDetector_get_implementation( ::com::sun::star::uno::XComponentContext* component, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new WriterFilterDetection(component)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/filter/WriterFilterDetection.hxx b/writerfilter/source/filter/WriterFilterDetection.hxx index 9c7de921d1cd..9b2ebac3ffc9 100644 --- a/writerfilter/source/filter/WriterFilterDetection.hxx +++ b/writerfilter/source/filter/WriterFilterDetection.hxx @@ -59,11 +59,6 @@ bool SAL_CALL WriterFilterDetection_supportsService( const OUString& ServiceName ::com::sun::star::uno::Sequence< OUString > SAL_CALL WriterFilterDetection_getSupportedServiceNames( ) throw ( ::com::sun::star::uno::RuntimeException ); -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL WriterFilterDetection_createInstance( - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > &xContext) - throw( ::com::sun::star::uno::Exception ); - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/util/writerfilter.component b/writerfilter/util/writerfilter.component index 1f0bdd810031..28693e69e240 100644 --- a/writerfilter/util/writerfilter.component +++ b/writerfilter/util/writerfilter.component @@ -19,14 +19,17 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" prefix="writerfilter" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.Writer.WriterFilter"> + <implementation name="com.sun.star.comp.Writer.WriterFilter" + constructor="com_sun_star_comp_Writer_WriterFilter_get_implementation"> <service name="com.sun.star.document.ExportFilter"/> <service name="com.sun.star.document.ImportFilter"/> </implementation> - <implementation name="com.sun.star.comp.Writer.WriterFilterDetector"> + <implementation name="com.sun.star.comp.Writer.WriterFilterDetector" + constructor="com_sun_star_comp_Writer_WriterFilterDetector_get_implementation"> <service name="com.sun.star.document.ExtendedTypeDetection"/> </implementation> - <implementation name="com.sun.star.comp.Writer.RtfFilter"> + <implementation name="com.sun.star.comp.Writer.RtfFilter" + constructor="com_sun_star_comp_Writer_RtfFilter_get_implementation"> <service name="com.sun.star.document.ImportFilter"/> <service name="com.sun.star.document.ExportFilter"/> </implementation> |