summaryrefslogtreecommitdiff
path: root/sfx2/source/appl/sfxhelp.cxx
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-07-11 11:08:13 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-07-11 14:40:03 +0200
commit721cef392f301321a632a1d9286d57cd45335649 (patch)
treee1db93f819bd4752e12a8853ec2572ebdf0b91c2 /sfx2/source/appl/sfxhelp.cxx
parent9c1b85c56077a9efbc6d91334dcbab3d1f0c0dd2 (diff)
Deduplicate URL tooltip creation
Change-Id: I94eb40ff4d727029ad764a381df300beee90481c Reviewed-on: https://gerrit.libreoffice.org/75409 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2/source/appl/sfxhelp.cxx')
-rw-r--r--sfx2/source/appl/sfxhelp.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 8fbdad1fc794..d6fac42bd6de 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -65,8 +65,11 @@
#include <osl/file.hxx>
#include <unotools/bootstrap.hxx>
#include <unotools/tempfile.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/securityoptions.hxx>
#include <rtl/uri.hxx>
#include <vcl/commandinfoprovider.hxx>
+#include <vcl/keycod.hxx>
#include <vcl/layout.hxx>
#include <vcl/waitobj.hxx>
#include <vcl/weld.hxx>
@@ -680,6 +683,25 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* p
return sHelpText;
}
+OUString SfxHelp::GetURLHelpText(const OUString& aURL)
+{
+ SvtSecurityOptions aSecOpt;
+ bool bCtrlClickHlink = aSecOpt.IsOptionSet(SvtSecurityOptions::EOption::CtrlClickHyperlink);
+
+ // "ctrl-click to follow link:" for not MacOS
+ // "⌘-click to follow link:" 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 aHelpStr
+ = bCtrlClickHlink ? SfxResId(STR_CTRLCLICKHYPERLINK) : SfxResId(STR_CLICKHYPERLINK);
+ aHelpStr = aHelpStr.replaceFirst("%{key}", aModStr);
+ aHelpStr = aHelpStr.replaceFirst("%{link}", aURL);
+ return aHelpStr;
+}
+
void SfxHelp::SearchKeyword( const OUString& rKeyword )
{
Start_Impl(OUString(), static_cast<vcl::Window*>(nullptr), rKeyword);