[Libreoffice-commits] core.git: include/vcl vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue May 11 09:24:40 UTC 2021


 include/vcl/pdfwriter.hxx         |    2 ++
 vcl/source/gdi/pdfwriter_impl.cxx |    2 +-
 vcl/unx/gtk3/gtksalmenu.cxx       |    9 +++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 351875e5662ee2c2bd45750cb2dd8fbac65bf728
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 10 20:40:53 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 11 11:23:53 2021 +0200

    gtk4: menu item text seems to be parsed as xml now, so escape the basics
    
    "Zoom & Pan" in impress causing trouble
    
    Change-Id: If738eebaa3d9fd9abdd09a4fba4abce600c28743
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115363
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index fc28a009dd54..89776c815e87 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -1200,6 +1200,8 @@ The following structure describes the permissions used in PDF security
     static OString GetDateTime();
 };
 
+VCL_DLLPUBLIC void escapeStringXML( const OUString& rStr, OUString &rValue);
+
 }
 
 #endif // INCLUDED_VCL_PDFWRITER_HXX
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 6efb3ac3e81a..564e35dee051 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -5191,7 +5191,7 @@ sal_Int32 PDFWriterImpl::emitOutputIntent()
 }
 
 // formats the string for the XML stream
-static void escapeStringXML( const OUString& rStr, OUString &rValue)
+void escapeStringXML(const OUString& rStr, OUString &rValue)
 {
     const sal_Unicode* pUni = rStr.getStr();
     int nLen = rStr.getLength();
diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx
index a5e7376a79c0..ef1c665c533a 100644
--- a/vcl/unx/gtk3/gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtksalmenu.cxx
@@ -15,6 +15,7 @@
 #include <vcl/toolkit/floatwin.hxx>
 #include <vcl/menu.hxx>
 #include <vcl/pngwrite.hxx>
+#include <vcl/pdfwriter.hxx> // for escapeStringXML
 
 #include <sal/log.hxx>
 #include <tools/stream.hxx>
@@ -1248,6 +1249,14 @@ void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, const
     OUString aText = rText.replaceAll( "_", "__" );
     // Replace the LibreOffice hotkey identifier with an underscore
     aText = aText.replace( '~', '_' );
+    // quick and easy replacement of & to & etc, for e.g. "Zoom & Pa_n" in impress
+#if GTK_CHECK_VERSION(4, 0, 0)
+    {
+        OUString aTempString;
+        vcl::escapeStringXML(aText, aTempString);
+        aText = aTempString;
+    }
+#endif
     OString aConvertedText = OUStringToOString( aText, RTL_TEXTENCODING_UTF8 );
 
     // Update item text only when necessary.


More information about the Libreoffice-commits mailing list