summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-07-08 17:31:48 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-07-09 09:21:25 +0200
commit5314d69b0b2fa0d04c4562559552ef6b4126d1b1 (patch)
tree5bd9d6e0f78036f97c3f5e696540f06e5415d70a
parentf6e72cf4f70ac4f7bc6ace7c0cdb5e2afa13199a (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>
-rw-r--r--include/editeng/editeng.hxx4
-rw-r--r--sd/source/ui/view/drviews2.cxx39
2 files changed, 37 insertions, 6 deletions
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;