vcl: Drop logic to create drag source by service name

This is basically the drag source equivalent of previous
commit

    Change-Id: I93c099b82e209efe11f30bbc4f5fa0a6e1fff992
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Fri Jul 11 13:47:54 2025 +0200

        vcl: Drop logic to create drop target by service name

, see the commit message of that one for more details/background.

Change-Id: If870b340f39bd7fcf6674af3184e2a4c3017310d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187727
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2025-07-11 14:14:06 +02:00
parent 44da22e03b
commit a4954e5575
7 changed files with 2 additions and 121 deletions

View File

@ -351,13 +351,6 @@ void Test::createInstance(
// SystemClipboard is a wrapper returning either a platform-specific or
// the generic VCLGenericClipboard:
expImpl = "com.sun.star.datatransfer.VCLGenericClipboard";
#if !defined(_WIN32)
} else if (name == "com.sun.star.comp.datatransfer.dnd.OleDragSource_V1"
|| name == "com.sun.star.datatransfer.dnd.XdndSupport")
{
expImpl = "com.sun.star.datatransfer.dnd.VclGenericDragSource";
expServs = {u"com.sun.star.datatransfer.dnd.GenericDragSource"_ustr};
#endif
} else if (name == "com.sun.star.ui.dialogs.FolderPicker") {
// FolderPicker is a wrapper returning either a platform-specific or the
// generic OfficeFolderPicker. In headless mode it is always the

View File

@ -1,46 +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 .
*/
#pragma once
#include <sal/config.h>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <rtl/ustring.hxx>
namespace com::sun::star {
namespace lang {
class XMultiServiceFactory;
}
namespace uno { class XInterface; }
}
namespace vcl {
css::uno::Sequence<OUString> DragSource_getSupportedServiceNames();
OUString DragSource_getImplementationName();
css::uno::Reference<css::uno::XInterface> DragSource_createInstance(
css::uno::Reference<css::lang::XMultiServiceFactory > const &);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -26,7 +26,6 @@
#include <tools/debug.hxx>
#include <vcl/svapp.hxx>
#include <factory.hxx>
#include <svdata.hxx>
#include <salinst.hxx>
@ -274,35 +273,6 @@ void GenericDragSource::initialize( const Sequence< Any >& )
{
}
Sequence< OUString > DragSource_getSupportedServiceNames()
{
#if defined MACOSX
return { "com.sun.star.datatransfer.dnd.OleDragSource" };
#elif defined UNX
return { u"com.sun.star.datatransfer.dnd.X11DragSource"_ustr };
#else
return { "com.sun.star.datatransfer.dnd.VclGenericDragSource" };
#endif
}
OUString DragSource_getImplementationName()
{
#if defined MACOSX
return "com.sun.star.comp.datatransfer.dnd.OleDragSource_V1";
#elif defined UNX
return u"com.sun.star.datatransfer.dnd.XdndSupport"_ustr;
#else
return "com.sun.star.datatransfer.dnd.VclGenericDragSource";
#endif
}
Reference< XInterface > DragSource_createInstance( const Reference< XMultiServiceFactory >& )
{
SolarMutexGuard aGuard;
Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateDragSource();
return xResult;
}
/*
* generic DragSource dummy
*/

View File

@ -17,41 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <cppuhelper/factory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <vcl/dllapi.h>
#include <factory.hxx>
extern "C" {
VCL_DLLPUBLIC void* vcl_component_getFactory(
const char* pImplementationName,
void* pXUnoSMgr,
const char* /*pImplementationName*/,
void* /*pXUnoSMgr*/,
void* /*pXUnoKey*/)
{
if (!pXUnoSMgr)
return nullptr;
css::uno::Reference<css::lang::XMultiServiceFactory> xMgr(
static_cast<css::lang::XMultiServiceFactory*>(pXUnoSMgr));
css::uno::Reference<css::lang::XSingleServiceFactory> xFactory;
if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
{
xFactory = ::cppu::createSingleFactory(
xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance,
vcl::DragSource_getSupportedServiceNames() );
}
if( xFactory.is() )
{
xFactory->acquire();
return xFactory.get();
}
return nullptr;
}

View File

@ -19,10 +19,6 @@
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="vcl" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.datatransfer.dnd.OleDragSource_V1">
<service name="com.sun.star.datatransfer.dnd.OleDragSource"/>
<optional/>
</implementation>
<implementation name="com.sun.star.comp.graphic.GraphicMapper"
constructor="com_sun_star_comp_graphic_GraphicMapper_get_implementation">
<service name="com.sun.star.graphic.GraphicMapper"/>
@ -41,10 +37,6 @@
<service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/>
<optional/>
</implementation>
<implementation name="com.sun.star.datatransfer.dnd.XdndSupport">
<service name="com.sun.star.datatransfer.dnd.X11DragSource"/>
<optional/>
</implementation>
<implementation name="com.sun.star.datatransfer.MimeCntTypeFactory"
constructor="dtrans_CMimeContentTypeFactory_get_implementation">
<service name="com.sun.star.datatransfer.MimeContentTypeFactory"/>

View File

@ -4,7 +4,6 @@
# 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/.
com.sun.star.comp.datatransfer.dnd.OleDragSource_V1
com.sun.star.datatransfer.clipboard.AquaClipboard
com.sun.star.frame.VCLSessionManagerClient
org.libreoffice.uitest.UITest

View File

@ -4,7 +4,6 @@
# 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/.
com.sun.star.datatransfer.dnd.XdndSupport
com.sun.star.datatransfer.X11ClipboardSupport
com.sun.star.frame.VCLSessionManagerClient
org.libreoffice.uitest.UITest