sd/inc/glob.hrc              |    3 +++
 sd/source/core/glob.src      |   10 ++++++++++
 sd/source/ui/func/fudraw.cxx |   26 +++++++++++++++++++++++++-
 3 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit 2a34a745d776bc762de365342f13271ede29a65d
Author: Vasily Melenchuk <vasily.melenc...@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.
    
    Reviewed-on: https://gerrit.libreoffice.org/52672
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
    
     Conflicts:
            sd/inc/strings.hrc
            sd/source/ui/func/fudraw.cxx
    
    Change-Id: I93024a894967ddd378cc436efffb22302f6034d7
    Reviewed-on: https://gerrit.libreoffice.org/52723
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Tested-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc
index 0ec289c7ab0e..ec27eba3b4ec 100644
--- a/sd/inc/glob.hrc
+++ b/sd/inc/glob.hrc
@@ -140,6 +140,9 @@
 #define STR_SHRINK_FONT_SIZE                    RID_GLOB_START+232
 #define STR_GROW_FONT_SIZE                      RID_GLOB_START+233
 
+#define STR_CTRLCLICKHYPERLINK                  RID_GLOB_START+234
+#define STR_CLICKHYPERLINK                      RID_GLOB_START+235
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/core/glob.src b/sd/source/core/glob.src
index d158cccf0414..1f45382f0ec6 100644
--- a/sd/source/core/glob.src
+++ b/sd/source/core/glob.src
@@ -400,4 +400,14 @@ String STR_GROW_FONT_SIZE
     Text [ en-US ] = "Grow font size";
 };
 
+
+String STR_CTRLCLICKHYPERLINK
+{
+    Text [ en-US ] = "%s-click to follow hyperlink: ";
+};
+String STR_CLICKHYPERLINK
+{
+    Text [ en-US ] = "Click to open hyperlink: ";
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index 4e684288558e..c51d78edd5e9 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -62,6 +62,7 @@
 #include <vcl/msgbox.hxx>
 #include "slideshow.hxx"
 #include <svx/sdrhittesthelper.hxx>
+#include <unotools/securityoptions.hxx>
 
 using namespace ::com::sun::star;
 
@@ -914,7 +915,30 @@ bool FuDraw::SetHelpText(SdrObject* pObj, const Point& 
rPosPixel, const SdrViewE
         /**************************************************************
         * URL-Field
         **************************************************************/
-        aHelpText = INetURLObject::decode( rVEvt.pURLField->GetURL(), 
INetURLObject::DECODE_WITH_CHARSET );
+        OUString aURL = INetURLObject::decode( rVEvt.pURLField->GetURL(), 
INetURLObject::DECODE_WITH_CHARSET );
+
+        SvtSecurityOptions aSecOpt;
+        if (aSecOpt.IsOptionSet(SvtSecurityOptions::E_CTRLCLICK_HYPERLINK))
+        {
+            // 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 = SD_RESSTR(STR_CTRLCLICKHYPERLINK);
+
+            aCtrlClickHlinkStr = aCtrlClickHlinkStr.replaceAll("%s", aModStr);
+
+            aHelpText = aCtrlClickHlinkStr + aURL;
+        }
+        else
+        {
+            // Hint about just clicking hyperlink
+            aHelpText = SD_RESSTR(STR_CLICKHYPERLINK) + aURL;
+        }
     }
 
     if (!aHelpText.isEmpty())
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to