filter/Library_filterconfig.mk | 1 filter/source/config/cache/configflush.cxx | 29 +++------ filter/source/config/cache/configflush.hxx | 6 - filter/source/config/cache/filterconfig1.component | 5 - filter/source/config/cache/registration.cxx | 66 --------------------- solenv/bin/native-code.py | 2 6 files changed, 15 insertions(+), 94 deletions(-)
New commits: commit 008b3845201f9cc036a19600a78a1b32bf1b3fbe Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sat Jul 25 09:50:33 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Jul 25 10:39:24 2020 +0200 filter/config: create instances with uno constructors See tdf#74608 for motivation. Change-Id: I4423d3acd0a3c77bb7e553511e296f682f87b3e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99419 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/filter/Library_filterconfig.mk b/filter/Library_filterconfig.mk index e9cd6bfabd5a..79557890786c 100644 --- a/filter/Library_filterconfig.mk +++ b/filter/Library_filterconfig.mk @@ -55,7 +55,6 @@ $(eval $(call gb_Library_add_exception_objects,filterconfig,\ filter/source/config/cache/filterfactory \ filter/source/config/cache/frameloaderfactory \ filter/source/config/cache/querytokenizer \ - filter/source/config/cache/registration \ filter/source/config/cache/typedetection \ )) diff --git a/filter/source/config/cache/configflush.cxx b/filter/source/config/cache/configflush.cxx index 97699c2c0508..e0c4ca58f641 100644 --- a/filter/source/config/cache/configflush.cxx +++ b/filter/source/config/cache/configflush.cxx @@ -19,6 +19,8 @@ #include "configflush.hxx" #include <cppuhelper/supportsservice.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <rtl/ref.hxx> namespace filter::config{ @@ -35,7 +37,7 @@ ConfigFlush::~ConfigFlush() OUString SAL_CALL ConfigFlush::getImplementationName() { - return impl_getImplementationName(); + return "com.sun.star.comp.filter.config.ConfigFlush"; // <- SAFE } @@ -46,7 +48,7 @@ sal_Bool SAL_CALL ConfigFlush::supportsService(const OUString& sServiceName) css::uno::Sequence< OUString > SAL_CALL ConfigFlush::getSupportedServiceNames() { - return impl_getSupportedServiceNames(); + return { "com.sun.star.document.FilterConfigRefresh" }; } void SAL_CALL ConfigFlush::refresh() @@ -99,24 +101,15 @@ void SAL_CALL ConfigFlush::removeRefreshListener(const css::uno::Reference< css: } -OUString ConfigFlush::impl_getImplementationName() -{ - return "com.sun.star.comp.filter.config.ConfigFlush"; -} - - -css::uno::Sequence< OUString > ConfigFlush::impl_getSupportedServiceNames() -{ - return { "com.sun.star.document.FilterConfigRefresh" }; -} - +} // namespace filter::config -css::uno::Reference< css::uno::XInterface > ConfigFlush::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +filter_ConfigFlush_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - ConfigFlush* pNew = new ConfigFlush; - return css::uno::Reference< css::uno::XInterface >(static_cast< css::util::XRefreshable* >(pNew), css::uno::UNO_QUERY); + static rtl::Reference<filter::config::ConfigFlush> g_Instance(new filter::config::ConfigFlush()); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); } -} // namespace filter::config - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/config/cache/configflush.hxx b/filter/source/config/cache/configflush.hxx index 179d59d74ff6..1546956e6a2b 100644 --- a/filter/source/config/cache/configflush.hxx +++ b/filter/source/config/cache/configflush.hxx @@ -84,12 +84,6 @@ class ConfigFlush final : public BaseLock virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener) override; virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener) override; - - - // interface to register/create this instance as a UNO service - static OUString impl_getImplementationName(); - static css::uno::Sequence< OUString > impl_getSupportedServiceNames(); - static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); }; } // namespace filter::config diff --git a/filter/source/config/cache/filterconfig1.component b/filter/source/config/cache/filterconfig1.component index da841a112962..9597348890ee 100644 --- a/filter/source/config/cache/filterconfig1.component +++ b/filter/source/config/cache/filterconfig1.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="filterconfig1" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.filter.config.ConfigFlush"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.filter.config.ConfigFlush" + constructor="filter_ConfigFlush_get_implementation"> <service name="com.sun.star.document.FilterConfigRefresh"/> </implementation> <implementation name="com.sun.star.comp.filter.config.ContentHandlerFactory" diff --git a/filter/source/config/cache/registration.cxx b/filter/source/config/cache/registration.cxx deleted file mode 100644 index 76e7775913c3..000000000000 --- a/filter/source/config/cache/registration.cxx +++ /dev/null @@ -1,66 +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/factory.hxx> - -#include <com/sun/star/lang/XSingleServiceFactory.hpp> - -#include "typedetection.hxx" -#include "filterfactory.hxx" -#include "contenthandlerfactory.hxx" -#include "frameloaderfactory.hxx" -#include "configflush.hxx" - - -namespace filter::config{ - - -extern "C" SAL_DLLPUBLIC_EXPORT void* - filterconfig1_component_getFactory( const char* pImplementationName, - void* pServiceManager, - void* /* pRegistryKey */ ) -{ - if ((!pImplementationName) || (!pServiceManager )) - return nullptr; - - css::uno::Reference< css::lang::XMultiServiceFactory > - xSMGR = static_cast< css::lang::XMultiServiceFactory* >(pServiceManager); - css::uno::Reference< css::lang::XSingleServiceFactory > xFactory; - OUString sImplName = OUString::createFromAscii(pImplementationName); - - if (ConfigFlush::impl_getImplementationName() == sImplName) - xFactory = cppu::createOneInstanceFactory( xSMGR, - ConfigFlush::impl_getImplementationName(), - ConfigFlush::impl_createInstance, - ConfigFlush::impl_getSupportedServiceNames() ); - - /* And if one of these checks was successful => xFactory was set! */ - if (xFactory.is()) - { - xFactory->acquire(); - return xFactory.get(); - } - - return nullptr; -} - -} // namespace filter::config - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index b7c95f6885ba..f6e50d096366 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -20,7 +20,6 @@ import xml.etree.ElementTree as ET # referenced in lo_get_constructor_map(). core_factory_list = [ - ("libfilterconfiglo.a", "filterconfig1_component_getFactory"), ("libi18npoollo.a", "i18npool_component_getFactory"), ("libsmlo.a", "sm_component_getFactory"), ("libucb1.a", "ucb_component_getFactory"), @@ -142,6 +141,7 @@ core_constructor_list = [ # extensions/source/bibliography/bib.component "extensions_BibliographyLoader_get_implementation", # filter/source/config/cache/filterconfig1.component + "filter_ConfigFlush_get_implementation", "filter_TypeDetection_get_implementation", "filter_FrameLoaderFactory_get_implementation", "filter_FilterFactory_get_implementation", _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits