diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-08 17:31:48 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-09 09:21:25 +0200 |
commit | 5314d69b0b2fa0d04c4562559552ef6b4126d1b1 (patch) | |
tree | 5bd9d6e0f78036f97c3f5e696540f06e5415d70a /sd/source | |
parent | f6e72cf4f70ac4f7bc6ace7c0cdb5e2afa13199a (diff) |
tdf#111707 Only remove the selected hyperlink
Not all hyperlinks in current text box
Change-Id: Ia4ceeaeec776244e81b2c8fc401f7582a17d372f
Reviewed-on: https://gerrit.libreoffice.org/75229
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 0c0f17717bf8..988fae4fc746 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1151,13 +1151,48 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if (mpDrawView->IsTextEdit()) { Outliner* pOutl = mpDrawView->GetTextEditOutliner(); - if (pOutl) + OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); + if (pOutl && pOLV) { - pOutl->RemoveFields(checkSvxFieldData<SvxURLField>); + const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection(); + if (pFieldItem) + { + // Make sure the whole field is selected + ESelection aSel = pOLV->GetSelection(); + if (aSel.nStartPos == aSel.nEndPos) + { + aSel.nEndPos++; + pOLV->SetSelection(aSel); + } + } + if (!pFieldItem) + { + // Cursor probably behind the field - extend selection to select the field + ESelection aSel = pOLV->GetSelection(); + if (aSel.nStartPos == aSel.nEndPos) + { + aSel.nStartPos--; + pOLV->SetSelection(aSel); + pFieldItem = pOLV->GetFieldAtSelection(); + } + } + + if (pFieldItem) + { + ESelection aSel = pOLV->GetSelection(); + const SvxFieldData* pField = pFieldItem->GetField(); + if( auto pUrlField = dynamic_cast< const SvxURLField *>( pField ) ) + { + pOutl->QuickInsertText(pUrlField->GetRepresentation(), aSel); + } + } } } } + Cancel(); + rReq.Done (); break; + case SID_SET_DEFAULT: { std::unique_ptr<SfxItemSet> pSet; |