diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-12-04 15:19:00 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-12-05 15:59:50 +0100 |
commit | f31c3ebb60e4678eb09e377b638b368531df47dc (patch) | |
tree | 2855d383a670d1dbc0c6c2ba5323e1e8d0357e7f /sc | |
parent | c9a6d4bee737c3c39fc61d265dba0460b09c906f (diff) |
tdf#128666 Only enable hyperlink actions when just the field is selected
Change-Id: I984df967877a47fb9f89c3626737348a87d3ffa5
Reviewed-on: https://gerrit.libreoffice.org/84418
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 15 |
2 files changed, 6 insertions, 15 deletions
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index daf58d072eea..6cc27d4368c3 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -326,8 +326,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) case SID_REMOVE_HYPERLINK: { // Ensure the field is selected first - pOutView->SelectFieldAtCursor(); - URLFieldHelper::RemoveURLField(pOutliner, pOutView); + URLFieldHelper::RemoveURLField(pOutView->GetEditView()); } break; @@ -412,8 +411,7 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) || rSet.GetItemState(SID_REMOVE_HYPERLINK) != SfxItemState::UNKNOWN) { SdrView* pView = pViewData->GetScDrawView(); - OutlinerView* pOutView = pView->GetTextEditOutlinerView(); - if( !URLFieldHelper::IsCursorAtURLField(pOutView) ) + if( !URLFieldHelper::IsCursorAtURLField(pView->GetTextEditOutlinerView()->GetEditView()) ) { rSet.DisableItem( SID_OPEN_HYPERLINK ); rSet.DisableItem( SID_EDIT_HYPERLINK ); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index ebcde629df8b..80a7bf1cdea2 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -33,6 +33,7 @@ #include <editeng/flditem.hxx> #include <editeng/flstitem.hxx> #include <editeng/fontitem.hxx> +#include <editeng/urlfieldhelper.hxx> #include <svx/hlnkitem.hxx> #include <vcl/EnumContext.hxx> #include <editeng/postitem.hxx> @@ -646,15 +647,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) break; case SID_REMOVE_HYPERLINK: { - // Ensure the field is selected first - pEditView->SelectFieldAtCursor(); - const SvxURLField* pURLField = GetURLField(); - if (pURLField) - { - ESelection aSel = pEditView->GetSelection(); - pEditView->GetEditEngine()->QuickInsertText(pURLField->GetRepresentation(), aSel); - } - + URLFieldHelper::RemoveURLField(*pEditView); } break; @@ -786,8 +779,8 @@ void ScEditShell::GetState( SfxItemSet& rSet ) case SID_COPY_HYPERLINK_LOCATION: case SID_REMOVE_HYPERLINK: { - if ( !GetURLField() ) - rSet.DisableItem( nWhich ); + if (!URLFieldHelper::IsCursorAtURLField(*pEditView)) + rSet.DisableItem (nWhich); } break; |