sw/source/uibase/dochdl/swdtflvr.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit daafc32c5625757091e7cf80711a18639bd36bf0
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri May 27 14:50:21 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon May 30 20:57:55 2022 +0200

    tdf#145875 don't open Insert section dialog when pasting image
    
    This happens when we "copy image" in Firefox of the resource which
    cannot be accessed without logging in on some website.
    
    In that case we used HTML format and that resulted in pasting
    login webpage as a section.
    
    This patch detects simple HTML containing only an image while it also
    contains BITMAP format in the clipboard which we can use directly.
    That way we paste image data from the clipboard.
    
    Change-Id: Ia2ee7e246f8c71e1d0958c6c955ec056a0a96f8c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135011
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    (cherry picked from commit 0599a73c3c2bffdbfa4e695e2d694f1947215a07)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135013
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index db217051359e..b76476b4e02a 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1501,6 +1501,11 @@ bool SwTransferable::Paste(SwWrtShell& rSh, 
TransferableDataHelper& rData, RndSt
                                     &nActionFlags );
     }
 
+    // when HTML is just an image don't generate new section
+    if (rData.HasFormat(SotClipboardFormatId::HTML_SIMPLE) && 
rData.HasFormat(SotClipboardFormatId::HTML_NO_COMMENT)
+        && rData.HasFormat(SotClipboardFormatId::BITMAP) && nFormat == 
SotClipboardFormatId::FILE_LIST)
+        nFormat = SotClipboardFormatId::BITMAP;
+
     // tdf#37223 avoid non-native insertion of Calc worksheets in the 
following cases:
     // content of 1-cell worksheets are inserted as simple text using RTF 
format,
     // bigger worksheets within native (Writer) table cells are inserted as 
native tables,

Reply via email to