uui: create instances with uno constructors

See tdf#74608 for motivation

Change-Id: I8b7eec5e2cbe61a8dc3bb65f391245c1825fedc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98235
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2020-07-06 16:31:00 +02:00
parent f1e2e69b9b
commit 2da149ff33
5 changed files with 12 additions and 120 deletions

View file

@ -64,7 +64,6 @@ $(eval $(call gb_Library_add_exception_objects,uui,\
uui/source/passworddlg \
uui/source/requeststringresolver \
uui/source/secmacrowarnings \
uui/source/services \
uui/source/sslwarndlg \
uui/source/trylater \
uui/source/unknownauthdlg \

View file

@ -292,7 +292,7 @@ PasswordContainerInteractionHandler::~PasswordContainerInteractionHandler()
OUString SAL_CALL
PasswordContainerInteractionHandler::getImplementationName()
{
return getImplementationName_Static();
return "com.sun.star.comp.uui.PasswordContainerInteractionHandler";
}
@ -309,24 +309,7 @@ PasswordContainerInteractionHandler::supportsService(
uno::Sequence< OUString > SAL_CALL
PasswordContainerInteractionHandler::getSupportedServiceNames()
{
return getSupportedServiceNames_Static();
}
// static
OUString
PasswordContainerInteractionHandler::getImplementationName_Static()
{
return "com.sun.star.comp.uui.PasswordContainerInteractionHandler";
}
// static
uno::Sequence< OUString >
PasswordContainerInteractionHandler::getSupportedServiceNames_Static()
{
uno::Sequence< OUString > aSNS { "com.sun.star.task.PasswordContainerInteractionHandler" };
return aSNS;
return { "com.sun.star.task.PasswordContainerInteractionHandler" };
}
@ -395,31 +378,13 @@ PasswordContainerInteractionHandler::handleInteractionRequest(
}
// Service factory implementation.
/// @throws uno::Exception
static uno::Reference< uno::XInterface >
PasswordContainerInteractionHandler_CreateInstance(
const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
{
lang::XServiceInfo* pX
= new PasswordContainerInteractionHandler(comphelper::getComponentContext(rSMgr));
return uno::Reference< uno::XInterface >::query( pX );
}
// static
uno::Reference< lang::XSingleServiceFactory >
PasswordContainerInteractionHandler::createServiceFactory(
const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
{
return cppu::createOneInstanceFactory(
rxServiceMgr,
PasswordContainerInteractionHandler::getImplementationName_Static(),
PasswordContainerInteractionHandler_CreateInstance,
PasswordContainerInteractionHandler::getSupportedServiceNames_Static() );
}
} // namespace uui
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_uui_PasswordContainerInteractionHandler_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
return cppu::acquire(new uui::PasswordContainerInteractionHandler(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -150,16 +150,6 @@ public:
virtual sal_Bool SAL_CALL
handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& Request ) override;
// Non-UNO interfaces
static OUString
getImplementationName_Static();
static css::uno::Sequence< OUString >
getSupportedServiceNames_Static();
static css::uno::Reference< css::lang::XSingleServiceFactory >
createServiceFactory( const css::uno::Reference< css::lang::XMultiServiceFactory > & rxServiceMgr );
private:
PasswordContainerHelper m_aPwContainerHelper;
};

View file

@ -1,63 +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 <rtl/ustring.hxx>
#include <sal/types.h>
#include "passwordcontainer.hxx"
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::registry;
extern "C" SAL_DLLPUBLIC_EXPORT void * uui_component_getFactory(char const * pImplName,
void * pServiceManager,
void *)
{
if (!pImplName)
return nullptr;
void * pRet = nullptr;
Reference< XMultiServiceFactory > xSMgr(
static_cast< XMultiServiceFactory * >( pServiceManager ) );
Reference< XSingleServiceFactory > xFactory;
// UUI Password Container Interaction Handler.
if ( uui::PasswordContainerInteractionHandler::getImplementationName_Static().
equalsAscii( pImplName ) )
{
xFactory =
uui::PasswordContainerInteractionHandler::createServiceFactory( xSMgr );
}
if ( xFactory.is() )
{
xFactory->acquire();
pRet = xFactory.get();
}
return pRet;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -18,9 +18,10 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="uui" xmlns="http://openoffice.org/2010/uno-components">
xmlns="http://openoffice.org/2010/uno-components">
<implementation
name="com.sun.star.comp.uui.PasswordContainerInteractionHandler">
name="com.sun.star.comp.uui.PasswordContainerInteractionHandler"
constructor="com_sun_star_comp_uui_PasswordContainerInteractionHandler_get_implementation">
<service name="com.sun.star.task.PasswordContainerInteractionHandler"/>
</implementation>
<implementation name="com.sun.star.comp.uui.UUIInteractionHandler"