summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
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/source/ui/view
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/source/ui/view')
-rw-r--r--sc/source/ui/view/editsh.cxx15
1 files changed, 4 insertions, 11 deletions
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;