vcl/unx/gtk4/convert3to4.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 4364dc21ee184da9f773efbf7b9177d59f5096f1
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Jun 15 15:55:03 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Jun 15 18:06:39 2021 +0200

    gtk4: double-encode ampersand if use-underline is used
    
    as seen in calc paste special dialog
    
    see https://gitlab.gnome.org/GNOME/gtk/-/issues/4041
    
    Change-Id: I5425d1f5b5474fc6cda949e8fcb76b734ab893e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117259
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx
index 2f9f9c44f22e..f5e75a49b1ce 100644
--- a/vcl/unx/gtk4/convert3to4.cxx
+++ b/vcl/unx/gtk4/convert3to4.cxx
@@ -1300,6 +1300,16 @@ ConvertResult Convert3To4(const 
css::uno::Reference<css::xml::dom::XNode>& xNode
     for (auto& xRemove : xRemoveList)
         xNode->removeChild(xRemove);
 
+    // https://gitlab.gnome.org/GNOME/gtk/-/issues/4041 double encode 
ampersands if use-underline is used
+    if (xPropertyLabel && bUseUnderline)
+    {
+        OString sText = 
xPropertyLabel->getFirstChild()->getNodeValue().toUtf8();
+        gchar* pText = g_markup_escape_text(sText.getStr(), sText.getLength());
+        xPropertyLabel->getFirstChild()->setNodeValue(
+            OUString(pText, strlen(pText), RTL_TEXTENCODING_UTF8));
+        g_free(pText);
+    }
+
     return ConvertResult(bChildCanFocus, bHasVisible, bHasIconSize, 
bAlwaysShowImage, bImageAtTop,
                          bUseUnderline, bVertOrientation, xPropertyLabel, 
xPropertyIconName);
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to