diff options
author | Gökay Şatır <gokay.satir@collabora.com> | 2024-01-17 18:11:23 +0300 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2024-01-17 19:57:29 +0100 |
commit | 876543305c78cb596720da087454a5c54e5feb06 (patch) | |
tree | 4710a5f6334c17cabfbffb54cbf7fbe9eaf2a323 | |
parent | fc20b95f3c78f49715b6bb9a322852508e8ff878 (diff) |
Implement hyperlinkInfoAtPosition for Impress.
It is used in readonly mode.
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I428d4923ab89dbcf6df237c68ae792753c1edf13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162201
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
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(); } |