diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-11 21:03:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-12 14:21:29 +0200 |
commit | 6a9652b05c2d5df69a09927cb2d28215aa9e795c (patch) | |
tree | 1c6f799ead4b55fd824262acbdc9bdeca2f6f7bf /filter/source/storagefilterdetect | |
parent | filter/t602: create instances with uno constructors (diff) | |
download | core-6a9652b05c2d5df69a09927cb2d28215aa9e795c.tar.gz core-6a9652b05c2d5df69a09927cb2d28215aa9e795c.zip |
filter/storagefd: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: I7329893b62a9fb511535f6caadcdb6e007aadfd7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98580
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter/source/storagefilterdetect')
4 files changed, 13 insertions, 62 deletions
diff --git a/filter/source/storagefilterdetect/fdcomp.cxx b/filter/source/storagefilterdetect/fdcomp.cxx deleted file mode 100644 index 6649603f1823..000000000000 --- a/filter/source/storagefilterdetect/fdcomp.cxx +++ /dev/null @@ -1,36 +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/. - */ - -#include <sal/config.h> - -#include <cppuhelper/factory.hxx> -#include <cppuhelper/implementationentry.hxx> -#include <sal/types.h> - -#include "filterdetect.hxx" - -namespace { - -cppu::ImplementationEntry const services[] = { - { &StorageFilterDetect_createInstance, &StorageFilterDetect_getImplementationName, - &StorageFilterDetect_getSupportedServiceNames, - &cppu::createSingleComponentFactory, nullptr, 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * storagefd_component_getFactory( - char const * pImplName, void * pServiceManager, void * pRegistryKey) -{ - return cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, services); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/storagefilterdetect/filterdetect.cxx b/filter/source/storagefilterdetect/filterdetect.cxx index 4937349dbd6b..f2eba546a4d3 100644 --- a/filter/source/storagefilterdetect/filterdetect.cxx +++ b/filter/source/storagefilterdetect/filterdetect.cxx @@ -164,26 +164,10 @@ OUString SAL_CALL StorageFilterDetect::detect(uno::Sequence<beans::PropertyValue // XInitialization void SAL_CALL StorageFilterDetect::initialize(const uno::Sequence<uno::Any>& /*aArguments*/) {} -OUString StorageFilterDetect_getImplementationName() -{ - return "com.sun.star.comp.filters.StorageFilterDetect"; -} - -uno::Sequence<OUString> StorageFilterDetect_getSupportedServiceNames() -{ - return { "com.sun.star.document.ExtendedTypeDetection", "com.sun.star.comp.filters.StorageFilterDetect" }; -} - -uno::Reference<uno::XInterface> StorageFilterDetect_createInstance( - const uno::Reference<uno::XComponentContext> & rCxt) -{ - return static_cast<cppu::OWeakObject*>(new StorageFilterDetect(rCxt)); -} - // XServiceInfo OUString SAL_CALL StorageFilterDetect::getImplementationName() { - return StorageFilterDetect_getImplementationName(); + return "com.sun.star.comp.filters.StorageFilterDetect"; } sal_Bool SAL_CALL StorageFilterDetect::supportsService(const OUString& rServiceName) @@ -193,7 +177,15 @@ sal_Bool SAL_CALL StorageFilterDetect::supportsService(const OUString& rServiceN uno::Sequence<OUString> SAL_CALL StorageFilterDetect::getSupportedServiceNames() { - return StorageFilterDetect_getSupportedServiceNames(); + return { "com.sun.star.document.ExtendedTypeDetection", "com.sun.star.comp.filters.StorageFilterDetect" }; +} + + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +filter_StorageFilterDetect_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new StorageFilterDetect(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/storagefilterdetect/filterdetect.hxx b/filter/source/storagefilterdetect/filterdetect.hxx index 8c13868ff817..27556f376297 100644 --- a/filter/source/storagefilterdetect/filterdetect.hxx +++ b/filter/source/storagefilterdetect/filterdetect.hxx @@ -53,12 +53,6 @@ public: virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; -OUString StorageFilterDetect_getImplementationName(); - -css::uno::Sequence<OUString> StorageFilterDetect_getSupportedServiceNames(); - -css::uno::Reference<css::uno::XInterface> -StorageFilterDetect_createInstance(const css::uno::Reference<css::uno::XComponentContext>& rCxt); #endif diff --git a/filter/source/storagefilterdetect/storagefd.component b/filter/source/storagefilterdetect/storagefd.component index 9f85bfa1efa2..4a2ea0bf4c5b 100644 --- a/filter/source/storagefilterdetect/storagefd.component +++ b/filter/source/storagefilterdetect/storagefd.component @@ -8,8 +8,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="storagefd" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.filters.StorageFilterDetect"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.filters.StorageFilterDetect" + constructor="filter_StorageFilterDetect_get_implementation"> <service name="com.sun.star.document.ExtendedTypeDetection"/> </implementation> </component> |