summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-12-04 15:19:00 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-12-06 08:17:10 +0100
commit64233bbaa0e91ddf14d59ae7547df6bbfa60adcc (patch)
treec17bed3b00de030ac4cf57132b21fea5144c3401 /sc
parentc45acdcdd022a17559b9f7b85790c656a1599339 (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> (cherry picked from commit f31c3ebb60e4678eb09e377b638b368531df47dc) Reviewed-on: https://gerrit.libreoffice.org/84571
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx6
-rw-r--r--sc/source/ui/view/editsh.cxx15
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;