summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-08-06 15:14:00 +0200
committerPranam Lashkari <lpranam@collabora.com>2021-02-05 09:11:55 +0100
commit40b9beb175c896c6eb29644f92e07f59353b9eb7 (patch)
tree04b33547db416aab5cdb18a53f6a69d6ee4b6c60
parentavoid automatical text selection in impress text box (diff)
downloadcore-40b9beb175c896c6eb29644f92e07f59353b9eb7.tar.gz
core-40b9beb175c896c6eb29644f92e07f59353b9eb7.zip
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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110315 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--sd/source/ui/view/drviews2.cxx49
1 files changed, 25 insertions, 24 deletions
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index c293d0369266..688400950c9d 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2163,6 +2163,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();
@@ -2192,35 +2197,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 });
}
}
}