diff options
author | Justin Luth <jluth@mail.com> | 2023-11-06 13:41:05 -0500 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2023-11-15 20:04:37 +0100 |
commit | aaca48eb12357fa5cf23054fe77554bcfff74e95 (patch) | |
tree | 154941e21bee456ccc8a23f6a5f5d5cf9bc18755 | |
parent | 023a2de2a8ef4bdcd9877e60f8739366de3a763c (diff) |
tdf#158031 editeng SID_COPY_HYPERLINK: use AlsoCheckBeforeCursor
This patch depends on prior patches for this bug report.
This fixes nothing being copied 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).
Change-Id: I6c933224cd8d36f48f4e1f0aafaa1f45555e46d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159015
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 4 | ||||
-rw-r--r-- | include/editeng/outliner.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 4 |
6 files changed, 15 insertions, 7 deletions
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index adf75cc54afa..2649e865d6d7 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1340,9 +1340,9 @@ const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer() const return pEditView->GetFieldUnderMousePointer(); } -const SvxFieldItem* OutlinerView::GetFieldAtSelection() const +const SvxFieldItem* OutlinerView::GetFieldAtSelection(bool bAlsoCheckBeforeCursor) const { - return pEditView->GetFieldAtSelection(); + return pEditView->GetFieldAtSelection(bAlsoCheckBeforeCursor); } const SvxFieldData* OutlinerView::GetFieldAtCursor() const diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index cc921f4cd0af..4f8d41e21b9b 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -306,7 +306,7 @@ public: void InsertField( const SvxFieldItem& rFld ); const SvxFieldItem* GetFieldUnderMousePointer() const; - const SvxFieldItem* GetFieldAtSelection() const; + const SvxFieldItem* GetFieldAtSelection(bool bAlsoCheckBeforeCursor = false) const; /// Return the field at the current cursor position or nullptr if no field found const SvxFieldData* GetFieldAtCursor() const; /// Select the field at the current cursor position diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index ec527db045ac..65da5aac262c 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -311,7 +311,9 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) case SID_COPY_HYPERLINK_LOCATION: { - const SvxFieldData* pField = pOutView->GetFieldAtCursor(); + const SvxFieldItem* pFieldItem + = pOutView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true); + const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr; if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField)) { uno::Reference<datatransfer::clipboard::XClipboard> xClipboard diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 3393ca3ad090..ba76f89c4651 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -655,7 +655,9 @@ void ScEditShell::Execute( SfxRequest& rReq ) break; case SID_COPY_HYPERLINK_LOCATION: { - const SvxFieldData* pField = pEditView->GetFieldAtCursor(); + const SvxFieldItem* pFieldItem + = pEditView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true); + const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr; if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField)) { uno::Reference<datatransfer::clipboard::XClipboard> xClipboard diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index b49e7bfc497a..fab59b59f00a 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -2280,7 +2280,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView(); if ( pOutView ) { - const SvxFieldData* pField = pOutView->GetFieldAtCursor(); + const SvxFieldItem* pFieldItem + = pOutView->GetFieldAtSelection(/*AlsoCheckBeforeCursor=*/true); + const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : nullptr; if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField)) { uno::Reference<datatransfer::clipboard::XClipboard> xClipboard diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index db76755474e4..dc10ba46f143 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -509,7 +509,9 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_COPY_HYPERLINK_LOCATION: { - 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)) { uno::Reference<datatransfer::clipboard::XClipboard> xClipboard |