sd/source/ui/unoidl/unomodel.cxx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
New commits: commit 876543305c78cb596720da087454a5c54e5feb06 Author: Gökay Şatır <gokay.sa...@collabora.com> AuthorDate: Wed Jan 17 18:11:23 2024 +0300 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Jan 17 19:57:29 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> diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index cfc6ec8266b5..c9b69575ff49 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> @@ -2701,9 +2702,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(); }