summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 });
}
}
}