diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-16 12:05:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-17 09:30:41 +0200 |
commit | f0a7f6faba77afb4183c8ba3bbbf0d84ac13553d (patch) | |
tree | 40d12d3c3e73093a2c4a88ac4dd919e8908b2e8e | |
parent | 18d9c38932d4c245ad4c8d2eb6bd16b83f770db3 (diff) |
sdext/minimizer: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: I1273af0fa07a4f9d7284110247fce18c51901524
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98920
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sdext/Library_PresentationMinimizer.mk | 1 | ||||
-rw-r--r-- | sdext/source/minimizer/minimizer.component | 5 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizerdialog.cxx | 24 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizerdialog.hxx | 6 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizeruno.cxx | 43 |
5 files changed, 10 insertions, 69 deletions
diff --git a/sdext/Library_PresentationMinimizer.mk b/sdext/Library_PresentationMinimizer.mk index 8e95a7526a12..891b46a5514f 100644 --- a/sdext/Library_PresentationMinimizer.mk +++ b/sdext/Library_PresentationMinimizer.mk @@ -53,7 +53,6 @@ $(eval $(call gb_Library_add_exception_objects,PresentationMinimizer,\ sdext/source/minimizer/pppoptimizer \ sdext/source/minimizer/pppoptimizerdialog \ sdext/source/minimizer/pppoptimizertoken \ - sdext/source/minimizer/pppoptimizeruno \ sdext/source/minimizer/unodialog \ )) diff --git a/sdext/source/minimizer/minimizer.component b/sdext/source/minimizer/minimizer.component index d438c31a3acb..63f92cbbd565 100644 --- a/sdext/source/minimizer/minimizer.component +++ b/sdext/source/minimizer/minimizer.component @@ -8,8 +8,9 @@ * --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="pptminimizer" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.PresentationMinimizerImp"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.PresentationMinimizerImp" + constructor="sdext_PPPOptimizerDialog_get_implementation"> <service name="com.sun.star.comp.PresentationMinimizer"/> </implementation> </component> diff --git a/sdext/source/minimizer/pppoptimizerdialog.cxx b/sdext/source/minimizer/pppoptimizerdialog.cxx index 168a4bbc26eb..30e1b621f2b0 100644 --- a/sdext/source/minimizer/pppoptimizerdialog.cxx +++ b/sdext/source/minimizer/pppoptimizerdialog.cxx @@ -21,6 +21,7 @@ #include "pppoptimizerdialog.hxx" #include "optimizerdialog.hxx" #include <sal/log.hxx> +#include <cppuhelper/supportsservice.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; @@ -28,9 +29,6 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; -#define SERVICE_NAME "com.sun.star.comp.PresentationMinimizer" -#include <cppuhelper/supportsservice.hxx> - PPPOptimizerDialog::PPPOptimizerDialog( const Reference< XComponentContext > &xContext ) : mxContext( xContext ), mpOptimizerDialog( nullptr ) @@ -53,7 +51,7 @@ void SAL_CALL PPPOptimizerDialog::initialize( const Sequence< Any >& aArguments OUString SAL_CALL PPPOptimizerDialog::getImplementationName() { - return PPPOptimizerDialog_getImplementationName(); + return "com.sun.star.comp.PresentationMinimizerImp"; } sal_Bool SAL_CALL PPPOptimizerDialog::supportsService( const OUString& ServiceName ) @@ -63,7 +61,7 @@ sal_Bool SAL_CALL PPPOptimizerDialog::supportsService( const OUString& ServiceNa Sequence< OUString > SAL_CALL PPPOptimizerDialog::getSupportedServiceNames() { - return PPPOptimizerDialog_getSupportedServiceNames(); + return { "com.sun.star.comp.PresentationMinimizer" }; } Reference< css::frame::XDispatch > SAL_CALL PPPOptimizerDialog::queryDispatch( @@ -144,20 +142,12 @@ void SAL_CALL PPPOptimizerDialog::removeStatusListener( const Reference< XStatus // OSL_FAIL( "PPPOptimizerDialog::removeStatusListener()\nNot implemented yet!" ); } -OUString PPPOptimizerDialog_getImplementationName() -{ - return "com.sun.star.comp.PresentationMinimizerImp"; -} - -Sequence< OUString > PPPOptimizerDialog_getSupportedServiceNames() -{ - Sequence<OUString> aRet { SERVICE_NAME }; - return aRet; -} -Reference< XInterface > PPPOptimizerDialog_createInstance( const Reference< XComponentContext > & rSMgr) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +sdext_PPPOptimizerDialog_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) { - return static_cast<cppu::OWeakObject*>(new PPPOptimizerDialog( rSMgr )); + return cppu::acquire(new PPPOptimizerDialog(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sdext/source/minimizer/pppoptimizerdialog.hxx b/sdext/source/minimizer/pppoptimizerdialog.hxx index 5c51c5ad0448..1d1042f64e42 100644 --- a/sdext/source/minimizer/pppoptimizerdialog.hxx +++ b/sdext/source/minimizer/pppoptimizerdialog.hxx @@ -76,12 +76,6 @@ public: const css::util::URL& aURL ) override; }; -OUString PPPOptimizerDialog_getImplementationName(); -css::uno::Sequence< OUString > PPPOptimizerDialog_getSupportedServiceNames(); -/// @throws css::uno::Exception -css::uno::Reference< css::uno::XInterface > PPPOptimizerDialog_createInstance( const css::uno::Reference< css::uno::XComponentContext > & rSMgr ); - - #endif // INCLUDED_SDEXT_SOURCE_MINIMIZER_PPPOPTIMIZERDIALOG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sdext/source/minimizer/pppoptimizeruno.cxx b/sdext/source/minimizer/pppoptimizeruno.cxx deleted file mode 100644 index da8745ef2c71..000000000000 --- a/sdext/source/minimizer/pppoptimizeruno.cxx +++ /dev/null @@ -1,43 +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 <cppuhelper/implementationentry.hxx> -#include "pppoptimizerdialog.hxx" - -namespace -{ - -cppu::ImplementationEntry const services[] = { - { &PPPOptimizerDialog_createInstance, - &PPPOptimizerDialog_getImplementationName, - &PPPOptimizerDialog_getSupportedServiceNames, - &cppu::createSingleComponentFactory, nullptr, 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * pptminimizer_component_getFactory( - char const * pImplName, void * pServiceManager, void * pRegistryKey) -{ - return cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, services); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |