diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-08-12 10:45:58 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-08-12 12:50:11 +0200 |
commit | 71b660a226176a0d5e420572e004166d0301844f (patch) | |
tree | fc091f735380bb48f1d3c095193732b23b81a5fe /editeng/source | |
parent | 22ad284969afc640006cb493a639130a7cf5d979 (diff) |
Don't select hyperlink fields arbitrarily
For some functions, like remove or edit hyperlink, it's required
that the hyperlink field is selected.
However, we should do that only when executing the function, not
when queriying its status.
This led to selection changes on mouse over/right click.
Change-Id: I22035698032d1e651aae6a74d6e445dfe044bf74
Reviewed-on: https://gerrit.libreoffice.org/77336
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 10 | ||||
-rw-r--r-- | editeng/source/misc/urlfieldhelper.cxx | 13 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 5 |
3 files changed, 17 insertions, 11 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 250f77ffc68a..654f5f34077f 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1225,7 +1225,7 @@ const SvxFieldItem* EditView::GetFieldAtSelection() const return nullptr; } -const SvxFieldData* EditView::GetFieldAtCursor() +void EditView::SelectFieldAtCursor() { const SvxFieldItem* pFieldItem = GetFieldAtSelection(); if (pFieldItem) @@ -1246,9 +1246,15 @@ const SvxFieldData* EditView::GetFieldAtCursor() { aSel.nStartPos--; SetSelection(aSel); - pFieldItem = GetFieldAtSelection(); } } +} + +const SvxFieldData* EditView::GetFieldAtCursor() +{ + const SvxFieldItem* pFieldItem = GetFieldUnderMousePointer(); + if (!pFieldItem) + pFieldItem = GetFieldAtSelection(); return pFieldItem ? pFieldItem->GetField() : nullptr; } diff --git a/editeng/source/misc/urlfieldhelper.cxx b/editeng/source/misc/urlfieldhelper.cxx index ce7217612ead..ea1a4f02336f 100644 --- a/editeng/source/misc/urlfieldhelper.cxx +++ b/editeng/source/misc/urlfieldhelper.cxx @@ -31,15 +31,10 @@ bool URLFieldHelper::IsCursorAtURLField(OutlinerView* pOLV) if (!pOLV) return false; - const SvxFieldItem* pFieldItem = pOLV->GetFieldUnderMousePointer(); - if (!pFieldItem) - pFieldItem = pOLV->GetFieldAtSelection(); - if (pFieldItem) - { - const SvxFieldData* pField = pFieldItem->GetField(); - if (dynamic_cast<const SvxURLField*>(pField)) - return true; - } + const SvxFieldData* pField = pOLV->GetFieldAtCursor(); + if (dynamic_cast<const SvxURLField*>(pField)) + return true; + return false; } diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 670807932277..19bcfe31688f 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1322,6 +1322,11 @@ const SvxFieldData* OutlinerView::GetFieldAtCursor() return pEditView->GetFieldAtCursor(); } +void OutlinerView::SelectFieldAtCursor() +{ + pEditView->SelectFieldAtCursor(); +} + void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel ) { pEditView->SetInvalidateMore( nPixel ); |