[Libreoffice-commits] core.git: uui/Library_uui.mk uui/source uui/util

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 8 06:37:11 UTC 2020


 uui/Library_uui.mk               |    1 
 uui/source/passwordcontainer.cxx |   49 ++++--------------------------
 uui/source/passwordcontainer.hxx |   10 ------
 uui/source/services.cxx          |   63 ---------------------------------------
 uui/util/uui.component           |    5 +--
 5 files changed, 10 insertions(+), 118 deletions(-)

New commits:
commit 2da149ff33b6ef345aef8619e06654e343c4e960
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 6 16:31:00 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 8 08:36:23 2020 +0200

    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 at collabora.co.uk>

diff --git a/uui/Library_uui.mk b/uui/Library_uui.mk
index f1dc84a4761c..4daad8403dcb 100644
--- a/uui/Library_uui.mk
+++ b/uui/Library_uui.mk
@@ -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 \
diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx
index a97725ef1ca3..2e2d0b0ac3cb 100644
--- a/uui/source/passwordcontainer.cxx
+++ b/uui/source/passwordcontainer.cxx
@@ -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 );
-}
-
+} // namespace uui
 
-// static
-uno::Reference< lang::XSingleServiceFactory >
-PasswordContainerInteractionHandler::createServiceFactory(
-    const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
+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::createOneInstanceFactory(
-            rxServiceMgr,
-            PasswordContainerInteractionHandler::getImplementationName_Static(),
-            PasswordContainerInteractionHandler_CreateInstance,
-            PasswordContainerInteractionHandler::getSupportedServiceNames_Static() );
+    return cppu::acquire(new uui::PasswordContainerInteractionHandler(context));
 }
 
-} // namespace uui
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx
index 2e2545fa6098..cb4d5a533507 100644
--- a/uui/source/passwordcontainer.hxx
+++ b/uui/source/passwordcontainer.hxx
@@ -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;
 };
diff --git a/uui/source/services.cxx b/uui/source/services.cxx
deleted file mode 100644
index 7709e41760a7..000000000000
--- a/uui/source/services.cxx
+++ /dev/null
@@ -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: */
diff --git a/uui/util/uui.component b/uui/util/uui.component
index b8a8087d1c63..1c3ae749e50f 100644
--- a/uui/util/uui.component
+++ b/uui/util/uui.component
@@ -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"


More information about the Libreoffice-commits mailing list