summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2023-11-06 14:23:16 -0500
committerJustin Luth <jluth@mail.com>2023-11-15 20:04:52 +0100
commit0fc96d9b54e5a64c528bbf7fcdf9b71d74be8920 (patch)
tree7ff4b39462c51b1a4dc47d0d5c50692e68f6b08e /sw/source
parentaaca48eb12357fa5cf23054fe77554bcfff74e95 (diff)
tdf#158031 editeng SID_OPEN_HYPERLINK: use AlsoCheckBeforeCursor
This patch depends on prior patches for this bug report. This fixes nothing being opened if the mouse was right-clicked over that second half of the hyperlink (since a "smart" positioning set the cursor after the field instead of before it). Note that for some reason, OPEN always seemed to work with the mouse, even though other hyperlink menu options using the same code failed to find the field! So this code change is mainly for consistency. However, I WAS able to make it always fail, by moving the mouse away once the popup menu arrived, and then using the KEYBOARD to "Open Hyperlink". In that case, it always failed (because the field was not selected, and not under the mouse). Change-Id: I8fcd0386de6cea8c6a937afb6f63061ed62d4cb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159016 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index dc10ba46f143..9c4218567e22 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -494,7 +494,9 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
case SID_OPEN_HYPERLINK:
{
- const SvxFieldData* pField = pOLV->GetFieldAtCursor();
+ const SvxFieldItem* pFieldItem
+ = pOLV->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true);
+ const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr;
if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
{
SfxStringItem aUrl(SID_FILE_NAME, pURLField->GetURL());