diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-08-06 15:14:00 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-08-06 16:43:15 +0200 |
commit | fe44699a244a91f28e8fc43278fff67bf1db7c9c (patch) | |
tree | 6d82c44350a40fb06dc3e33a04cc0d118a24ab8d /sd | |
parent | 10ad2985c1a68cb5ef7f64707ed69441c0c013c4 (diff) |
Select hyperlink before editing in sd
Otherwise you can't edit a hyperlink when the cursor is behind the field.
Change-Id: Iea937e16d5be1187f78cbaa565698232cb10dc64
Reviewed-on: https://gerrit.libreoffice.org/77028
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 036862ed0229..ed6ca12113e3 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -2116,6 +2116,11 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_EDIT_HYPERLINK : { + // Ensure the field is selected first + OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView(); + if (pOutView) + pOutView->GetFieldAtCursor(); + GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG ); Cancel(); @@ -2128,35 +2133,31 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView(); if ( pOutView ) { - const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection(); - if ( pFieldItem ) + const SvxFieldData* pField = pOutView->GetFieldAtCursor(); + if( auto pURLField = dynamic_cast< const SvxURLField *>( pField ) ) { - const SvxFieldData* pField = pFieldItem->GetField(); - if( auto pURLField = dynamic_cast< const SvxURLField *>( pField ) ) - { - SfxStringItem aUrl( SID_FILE_NAME, pURLField->GetURL() ); - SfxStringItem aTarget( SID_TARGETNAME, pURLField->GetTargetFrame() ); + SfxStringItem aUrl( SID_FILE_NAME, pURLField->GetURL() ); + SfxStringItem aTarget( SID_TARGETNAME, pURLField->GetTargetFrame() ); - OUString aReferName; - SfxViewFrame* pFrame = GetViewFrame(); - SfxMedium* pMed = pFrame->GetObjectShell()->GetMedium(); - if (pMed) - aReferName = pMed->GetName(); + OUString aReferName; + SfxViewFrame* pFrame = GetViewFrame(); + SfxMedium* pMed = pFrame->GetObjectShell()->GetMedium(); + if (pMed) + aReferName = pMed->GetName(); - SfxFrameItem aFrm( SID_DOCFRAME, pFrame ); - SfxStringItem aReferer( SID_REFERER, aReferName ); + SfxFrameItem aFrm( SID_DOCFRAME, pFrame ); + SfxStringItem aReferer( SID_REFERER, aReferName ); - SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false ); - SfxBoolItem aBrowsing( SID_BROWSE, true ); + SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, false ); + SfxBoolItem aBrowsing( SID_BROWSE, true ); - SfxViewFrame* pViewFrm = SfxViewFrame::Current(); - if (pViewFrm) - { - pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC, - SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, - { &aUrl, &aTarget, &aFrm, &aReferer, - &aNewView, &aBrowsing }); - } + SfxViewFrame* pViewFrm = SfxViewFrame::Current(); + if (pViewFrm) + { + pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC, + SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, + { &aUrl, &aTarget, &aFrm, &aReferer, + &aNewView, &aBrowsing }); } } } |