mirror of
https://github.com/LibreOffice/core.git
synced 2025-07-29 21:00:46 +00:00

DropTarget_createInstance, which would have been called when trying to create a drop target via service name, calls SalInstance::CreateDropTarget with the default null `pSysEnv` param. For all cases except headless mode or when running unit tests, that calls the platform/VCL-specific SalInstance::ImplCreateDropTarget overrides, which would unconditionally dereference the null `pSysEnv`. Since this logic to create a drop target by service name is unused, presumably since commit031576105c
Author: Jan-Marek Glogowski <glogow@fbihome.de> Date: Thu Jan 6 14:16:53 2022 +0100 VCL move platform code from mouse.cxx into plugins ... by moving it into ImplCreate(DragSource|DropTarget). The existing Create* variant now checks for headless mode and the IsRunningUnitTest flag, before creating the platform variants. There are two small helpers to initialize either X11 or Ole based UNO DnD interace implementations. Unfortunatly Windows requires to move two dtrans header files, but at least any other changes are minimal. , drop it altogether. com::sun:⭐:datatransfer::dnd.X11DropTarget is a published UNO service (see offapi/com/sun/star/datatransfer/dnd/X11DropTarget.idl), so leave the specification in the IDL file around, even if there is no way to create an instance via external code (macros, extensions). That's not new with this commit, since the service was only meant to be supported by the gen VCL plugin on Linux previously, but then, trying to create an instance would crash in X11SalInstance::ImplCreateDropTarget due to dereferencing the null `pSysEnv`. The XInitialization interface as mentioned in the IDL file: /** The service expects an instance of com::sun:⭐:awt::XDisplayConnection as the first parameter. The second parameter must be a long that contains an XWindow window which shall be registered as drop target. */ interface com::sun:⭐:lang::XInitialization; hasn't been implemented any more since commit30b4c1d787
Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Jul 4 10:01:23 2025 +0200 gen: Simplify DropTarget init, don't use XInitialization , but also before then, an XDisplayConnection to pass as a param to the XInitilization::initialize implementation couldn't be retrieved via external code, see the commit message of commit7a9108a48e
Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Jul 4 11:16:24 2025 +0200 vcl: Stop implementing XDisplayConnection for more details. The published service com::sun:⭐:datatransfer::dnd::OleDropTarget is Windows-specific in its description. Quoting from offapi/com/sun/star/datatransfer/dnd/OleDropTarget.idl: /** The service expects a windows window handle. It is passed as unsigned long. */ interface com::sun:⭐:lang::XInitialization; , while it was also used on macOS internally before the above-mentioned031576105c
. The actual Windows implementation has a separate UNO constructor (see vcl/vclplug_win.component) and should therefore be unaffected by this change. If the X11-specific X11DropTarget service were actually relevant, it should probably be implemented similarly (specifically for the gen VCL plugin only, without reintroducing the rest of the logic dropped in this commit.) Searches for "com.sun.star.datatransfer.dnd.X11DropTarget" and "com.sun.star.datatransfer.dnd.OleDropTarget" in Google and on Ask [1] didn't give any results that would suggest that these services would actually be used by existing third party code. Change-Id: I93c099b82e209efe11f30bbc4f5fa0a6e1fff992 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187726 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
47 lines
1.5 KiB
C++
47 lines
1.5 KiB
C++
/* -*- 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: */
|