sc/source/ui/view/gridwin.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 7c188ba859b3186bb4598b91e23c39459bf03756
Author:     Mike Kaganski <[email protected]>
AuthorDate: Tue Jan 20 18:49:44 2026 +0500
Commit:     Ilmari Lauhakangas <[email protected]>
CommitDate: Thu Jan 22 18:49:54 2026 +0100

    tdf#169485: properly detect weblinks in FILEGRPDESCRIPTOR
    
    Commit 84c1c49d8699f4106168a524ce774f42ef843b1f (Fix Unicode-dependent
    format names, 2025-11-09) fixed FileGroupDescriptorW (the Windows name
    for SotClipboardFormatId::FILEGRPDESCRIPTOR). It turned out that after
    it was broken by commit 558956dc811a1f0f07411e348f7081a467bbc3b5 (Drop
    UNICODE/_UNICODE defines, 2019-04-04), and therefore never detected at
    runtime, the code changed so that now, after its detection was fixed,
    it was confused for weblinks (while it can actually contain any kind
    of file references).
    
    This change makes the check in lcl_GetDropFormatId more specific, only
    returning FILEGRPDESCRIPTOR when the respective file format contains
    the wanted weblink.
    
    Change-Id: I869f8b759329b7341c60d5e3da6d77ae8ee96c3e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197670
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    (cherry picked from commit 6bd794a3ab167551d447b10b19e820a65727479e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197693
    Reviewed-by: Ilmari Lauhakangas <[email protected]>

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 29db3f4f1ba2..401a26b185d9 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -33,6 +33,7 @@
 #include <editeng/justifyitem.hxx>
 #include <editeng/outliner.hxx>
 #include <editeng/misspellrange.hxx>
+#include <o3tl/temporary.hxx>
 #include <o3tl/unit_conversion.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/viewfrm.hxx>
@@ -4432,7 +4433,10 @@ static SotClipboardFormatId lcl_GetDropFormatId( const 
uno::Reference<datatransf
             return SotClipboardFormatId::UNIFORMRESOURCELOCATOR;
         else if ( aDataHelper.HasFormat( 
SotClipboardFormatId::NETSCAPE_BOOKMARK ) )
             return SotClipboardFormatId::NETSCAPE_BOOKMARK;
-        else if ( aDataHelper.HasFormat( 
SotClipboardFormatId::FILEGRPDESCRIPTOR ) )
+        // In FILEGRPDESCRIPTOR, we only need web links (see 
ScViewFunc::PasteDataFormat).
+        // Check if the descriptor really contains them.
+        else if 
(aDataHelper.GetINetBookmark(SotClipboardFormatId::FILEGRPDESCRIPTOR,
+                                             o3tl::temporary(INetBookmark())))
             return SotClipboardFormatId::FILEGRPDESCRIPTOR;
     }
 

Reply via email to