[Libreoffice-commits] core.git: sd/inc sd/source
Vasily Melenchuk
Vasily.Melenchuk at cib.de
Wed Apr 11 07:27:59 UTC 2018
sd/inc/strings.hrc | 3 +++
sd/source/ui/func/fudraw.cxx | 26 +++++++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
New commits:
commit 0310815de2a75d4bbbd34d97e2592dccddcad812
Author: Vasily Melenchuk <Vasily.Melenchuk at cib.de>
Date: Tue Apr 10 15:18:59 2018 +0300
sd: update tooltips on hyperlink hover
Show "Ctrl-click to open..." or "Click to open..." depending on
security options.
Change-Id: I93024a894967ddd378cc436efffb22302f6034d7
Reviewed-on: https://gerrit.libreoffice.org/52672
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index 61af7e91c616..67eef104a6de 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -469,6 +469,9 @@
#define STR_SD_NONE NC_("STR_SD_NONE", "- None -")
+#define STR_CTRLCLICKHYPERLINK NC_("STR_CTRLCLICKHYPERLINK", "%s-click to follow hyperlink: ")
+#define STR_CLICKHYPERLINK NC_("STR_CLICKHYPERLINK", "Click to open hyperlink: ")
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index f25836ae459d..cfc73674c678 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -61,6 +61,7 @@
#include <vcl/weld.hxx>
#include <slideshow.hxx>
#include <svx/sdrhittesthelper.hxx>
+#include <unotools/securityoptions.hxx>
using namespace ::com::sun::star;
@@ -902,7 +903,30 @@ bool FuDraw::SetHelpText(SdrObject* pObj, const Point& rPosPixel, const SdrViewE
/**************************************************************
* URL-Field
**************************************************************/
- aHelpText = INetURLObject::decode( rVEvt.pURLField->GetURL(), INetURLObject::DecodeMechanism::WithCharset );
+ OUString aURL = INetURLObject::decode( rVEvt.pURLField->GetURL(), INetURLObject::DecodeMechanism::WithCharset );
+
+ SvtSecurityOptions aSecOpt;
+ if (aSecOpt.IsOptionSet(SvtSecurityOptions::EOption::CtrlClickHyperlink))
+ {
+ // Hint about Ctrl-click to open hyperlink
+ // But need to detect "Ctrl" key for MacOs
+ vcl::KeyCode aCode(KEY_SPACE);
+ vcl::KeyCode aModifiedCode(KEY_SPACE, KEY_MOD1);
+ OUString aModStr(aModifiedCode.GetName());
+ aModStr = aModStr.replaceFirst(aCode.GetName(), "");
+ aModStr = aModStr.replaceAll("+", "");
+
+ OUString aCtrlClickHlinkStr = SdResId(STR_CTRLCLICKHYPERLINK);
+
+ aCtrlClickHlinkStr = aCtrlClickHlinkStr.replaceAll("%s", aModStr);
+
+ aHelpText = aCtrlClickHlinkStr + aURL;
+ }
+ else
+ {
+ // Hint about just clicking hyperlink
+ aHelpText = SdResId(STR_CLICKHYPERLINK) + aURL;
+ }
}
if (!aHelpText.isEmpty())
More information about the Libreoffice-commits
mailing list