summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMoritz Duge <moritz.duge@allotropia.de>2024-08-06 16:47:30 +0200
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-07 09:28:33 +0200
commitee749f4b43fea3b666c9c3613b232bc8fecf73fa (patch)
tree505c014fc461667360192a9f1b058a8375502a1a /vcl
parent3bd2e9db408ebe31e6044ff9e4345692c7496c2d (diff)
add polymorph function for VCL/ui specific string escaping
Change-Id: Ie896a1050158acc85f66b8705812e5f6b9717070 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171509 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/qt5/QtInstanceWidget.hxx2
-rw-r--r--vcl/inc/salvtables.hxx1
-rw-r--r--vcl/qt5/QtInstanceWidget.cxx2
-rw-r--r--vcl/source/app/salvtables.cxx5
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx5
5 files changed, 15 insertions, 0 deletions
diff --git a/vcl/inc/qt5/QtInstanceWidget.hxx b/vcl/inc/qt5/QtInstanceWidget.hxx
index ebe816fa8c42..e7f51c97a969 100644
--- a/vcl/inc/qt5/QtInstanceWidget.hxx
+++ b/vcl/inc/qt5/QtInstanceWidget.hxx
@@ -150,6 +150,8 @@ public:
virtual OUString strip_mnemonic(const OUString&) const override;
+ virtual OUString escape_ui_str(const OUString&) const override;
+
virtual VclPtr<VirtualDevice> create_virtual_device() const override;
virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 3c6112c4299e..200e0ef36bf5 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -380,6 +380,7 @@ public:
virtual void help_hierarchy_foreach(const std::function<bool(const OUString&)>& func) override;
virtual OUString strip_mnemonic(const OUString& rLabel) const override;
+ virtual OUString escape_ui_str(const OUString& rLabel) const override;
virtual VclPtr<VirtualDevice> create_virtual_device() const override;
diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx
index c3a5009659b3..35bfb4c2cca1 100644
--- a/vcl/qt5/QtInstanceWidget.cxx
+++ b/vcl/qt5/QtInstanceWidget.cxx
@@ -229,6 +229,8 @@ void QtInstanceWidget::help_hierarchy_foreach(const std::function<bool(const OUS
OUString QtInstanceWidget::strip_mnemonic(const OUString&) const { return OUString(); }
+OUString QtInstanceWidget::escape_ui_str(const OUString&) const { return OUString(); }
+
VclPtr<VirtualDevice> QtInstanceWidget::create_virtual_device() const { return nullptr; }
css::uno::Reference<css::datatransfer::dnd::XDropTarget> QtInstanceWidget::get_drop_target()
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index c609a8ae582e..7e2a81f2cef4 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -674,6 +674,11 @@ OUString SalInstanceWidget::strip_mnemonic(const OUString& rLabel) const
return rLabel.replaceFirst("~", "");
}
+OUString SalInstanceWidget::escape_ui_str(const OUString& rLabel) const
+{
+ return rLabel.replaceAll("~", "~~");
+}
+
VclPtr<VirtualDevice> SalInstanceWidget::create_virtual_device() const
{
// create with (annoying) separate alpha layer that LibreOffice itself uses
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 804703b505b2..3b126c094035 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -4461,6 +4461,11 @@ public:
return rLabel.replaceFirst("_", "");
}
+ virtual OUString escape_ui_str(const OUString &rLabel) const override
+ {
+ return rLabel.replaceAll("_", "__");
+ }
+
virtual VclPtr<VirtualDevice> create_virtual_device() const override
{
// create with no separate alpha layer like everything sane does