diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-12 15:30:12 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-15 11:32:02 +0200 |
commit | 040f348ee00a0d01653b3071be3d9886a08f87fe (patch) | |
tree | 0959fbc683b13b76445cdb67d43781fa07620610 /editeng | |
parent | f74fbba22e435852c1ee37abf4384be7db6d8607 (diff) |
tdf#62561 Add remove/edit hyperlink to calc context menu
Change-Id: Idb1b96dc4e95be40a796f9178975207099101b87
Reviewed-on: https://gerrit.libreoffice.org/75497
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 28 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 25 |
2 files changed, 29 insertions, 24 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index c0ad8484af5d..637f36a73cba 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1225,6 +1225,34 @@ const SvxFieldItem* EditView::GetFieldAtSelection() const return nullptr; } +const SvxFieldData* EditView::GetFieldAtCursor() +{ + const SvxFieldItem* pFieldItem = GetFieldAtSelection(); + if (pFieldItem) + { + // Make sure the whole field is selected + ESelection aSel = GetSelection(); + if (aSel.nStartPos == aSel.nEndPos) + { + aSel.nEndPos++; + SetSelection(aSel); + } + } + if (!pFieldItem) + { + // Cursor probably behind the field - extend selection to select the field + ESelection aSel = GetSelection(); + if (aSel.nStartPos == aSel.nEndPos) + { + aSel.nStartPos--; + SetSelection(aSel); + pFieldItem = GetFieldAtSelection(); + } + } + + return pFieldItem ? pFieldItem->GetField() : nullptr; +} + void EditView::SetInvalidateMore( sal_uInt16 nPixel ) { pImpEditView->SetInvalidateMore( nPixel ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 43efbbb1615c..670807932277 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1319,30 +1319,7 @@ const SvxFieldItem* OutlinerView::GetFieldAtSelection() const const SvxFieldData* OutlinerView::GetFieldAtCursor() { - const SvxFieldItem* pFieldItem = GetFieldAtSelection(); - if (pFieldItem) - { - // Make sure the whole field is selected - ESelection aSel = GetSelection(); - if (aSel.nStartPos == aSel.nEndPos) - { - aSel.nEndPos++; - SetSelection(aSel); - } - } - if (!pFieldItem) - { - // Cursor probably behind the field - extend selection to select the field - ESelection aSel = GetSelection(); - if (aSel.nStartPos == aSel.nEndPos) - { - aSel.nStartPos--; - SetSelection(aSel); - pFieldItem = GetFieldAtSelection(); - } - } - - return pFieldItem ? pFieldItem->GetField() : nullptr; + return pEditView->GetFieldAtCursor(); } void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel ) |