sw/source/uibase/uno/unotxdoc.cxx |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 6773c8929690f557d29bc282dd8f5c4381da3484
Author:     Gökay Şatır <gokaysa...@collabora.com>
AuthorDate: Thu Dec 14 15:53:17 2023 +0300
Commit:     Gökay ŞATIR <gokaysa...@collabora.com>
CommitDate: Wed Dec 20 12:31:44 2023 +0100

    Implement hyperlinkInfoAtPosition for Writer.
    
    Signed-off-by: Gökay Şatır <gokaysa...@collabora.com>
    Change-Id: Ibc71e4ee83625637f726646feb2c0192f3007687
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160773
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 1c588d2b3298..2d185a0c6504 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3779,7 +3779,22 @@ void SwXTextDocument::setTextSelection(int nType, int 
nX, int nY)
 
 OUString SwXTextDocument::hyperlinkInfoAtPosition(int x, int y)
 {
-    return OUString::createFromAscii(std::to_string(x + y));
+    SolarMutexGuard aGuard;
+    SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
+
+    if (pWrtShell)
+    {
+        const Point point(x, y);
+        SwContentAtPos aContentAtPos(IsAttrAtPos::InetAttr);
+
+        if (pWrtShell->GetContentAtPos(point, aContentAtPos))
+        {
+            OUString url = static_cast<const 
SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr)->GetValue();
+            return url;
+        }
+    }
+
+    return OUString();
 }
 
 uno::Reference<datatransfer::XTransferable> SwXTextDocument::getSelection()

Reply via email to