sd/source/ui/unoidl/unomodel.cxx |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 98f73277667d9fb440c47ff6f9c5c7bd74343dc5
Author:     Gökay Şatır <gokay.sa...@collabora.com>
AuthorDate: Wed Jan 17 18:11:23 2024 +0300
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Jan 18 11:13:27 2024 +0100

    Implement hyperlinkInfoAtPosition for Impress.
    
    It is used in readonly mode.
    
    Signed-off-by: Gökay Şatır <gokay.sa...@collabora.com>
    Change-Id: I428d4923ab89dbcf6df237c68ae792753c1edf13
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162201
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    (cherry picked from commit 876543305c78cb596720da087454a5c54e5feb06)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162222
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 89efc76df232..c97cd9ff0ab8 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -127,6 +127,7 @@
 #include <sfx2/LokControlHandler.hxx>
 #include <tools/gen.hxx>
 #include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
 #include <comphelper/diagnose_ex.hxx>
 #include <tools/json_writer.hxx>
 #include <tools/UnitConversion.hxx>
@@ -2708,9 +2709,28 @@ void SdXImpressDocument::setTextSelection(int nType, int 
nX, int nY)
     }
 }
 
-OUString SdXImpressDocument::hyperlinkInfoAtPosition(int /*x*/, int /*y*/)
+OUString SdXImpressDocument::hyperlinkInfoAtPosition(int x, int y)
 {
-    // To be implemented..
+    ::sd::ViewShell* viewSh = GetViewShell();
+
+    if (viewSh)
+    {
+        Point point(x, y);
+        point = o3tl::convert(point, o3tl::Length::twip, o3tl::Length::mm100);
+        SdrView* pSdrView = SfxViewShell::Current()->GetDrawView();
+
+        if (pSdrView)
+        {
+            SdrViewEvent aVEvt;
+            pSdrView->PickAnything(point, aVEvt);
+            if (aVEvt.mpURLField)
+            {
+                OUString aURL = 
INetURLObject::decode(aVEvt.mpURLField->GetURL(), 
INetURLObject::DecodeMechanism::WithCharset);
+                return aURL;
+            }
+        }
+    }
+
     return OUString();
 }
 

Reply via email to