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>
This commit is contained in:
Noel Grandin
2020-07-17 09:30:41 +02:00
parent 18d9c38932
commit f0a7f6faba
5 changed files with 10 additions and 69 deletions
-1
View File
@@ -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 \
))
+3 -2
View File
@@ -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>
+7 -17
View File
@@ -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()
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
sdext_PPPOptimizerDialog_get_implementation(
css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
{
Sequence<OUString> aRet { SERVICE_NAME };
return aRet;
}
Reference< XInterface > PPPOptimizerDialog_createInstance( const Reference< XComponentContext > & rSMgr)
{
return static_cast<cppu::OWeakObject*>(new PPPOptimizerDialog( rSMgr ));
return cppu::acquire(new PPPOptimizerDialog(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -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: */
@@ -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: */