include/editeng/editeng.hxx | 4 ---- sd/source/ui/view/drviews2.cxx | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 6 deletions(-)
New commits: commit 5314d69b0b2fa0d04c4562559552ef6b4126d1b1 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> AuthorDate: Mon Jul 8 17:31:48 2019 +0200 Commit: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> CommitDate: Tue Jul 9 09:21:25 2019 +0200 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.mehrbr...@cib.de> diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index f585ce8b5796..e531b6c8d9f5 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -129,10 +129,6 @@ namespace o3tl { template<> struct typed_flags<GetAttribsFlags> : is_typed_flags<GetAttribsFlags, 0x07> {}; } -template<class T> bool checkSvxFieldData(const SvxFieldData* pData) -{ - return dynamic_cast<const T*>(pData) != nullptr; -} enum class SetAttribsMode { NONE, WholeWord, Edge 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits