sw/source/uibase/uno/unotxdoc.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
New commits: commit df11ff317de859cad000a50999b48e6a25070be9 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: Thu Dec 28 16:34:13 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/+/161381 Tested-by: Jenkins diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 7dc4f1ccdeeb..3a14cb0f8f96 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3713,7 +3713,24 @@ 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; + } + else + return OUString(); + } + else + return OUString(); } uno::Reference<datatransfer::XTransferable> SwXTextDocument::getSelection()