summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-14 09:43:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-10-14 15:00:06 +0200
commiteb395e21a7b1f15de664c4b207dc9e130aa635cf (patch)
tree7e87f09e341c2d7b7bf6cb45cd2c2c8fb37b6f08
parentca178d4afb26dd4404ca7bfddc3e2e2d391a91ad (diff)
Resolves: tdf#137445 use the DisableEditHyperlink state as of menu launch time
at context menu popup time set if the EditHyperlink entry should be disabled and use that state if queried about it if EditHyperlink is dispatched from the menu. So ignoring where the mouse currently happens to be when the menu was dismissed. The dispatch is done async, if at all, so also trigger an async Query with Invalidate so at least one Query is ensured to reset the stored state Change-Id: I970b15954851f39b039d844c44711bf712fcb482 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104273 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx5
-rw-r--r--sd/source/ui/view/drviews4.cxx14
-rw-r--r--sd/source/ui/view/drviews7.cxx12
3 files changed, 29 insertions, 2 deletions
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 608819c63541..0a34879f518c 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -384,6 +384,11 @@ protected:
VclPtr<TabControl> maTabControl;
EditMode meEditMode;
PageKind mePageKind;
+ // tdf#137445 at context menu popup time set if the EditHyperlink entry
+ // should be disabled and use that state if queried about it if
+ // EditHyperlink is dispatched from the menu. So ignoring where the mouse
+ // currently happens to be when the menu was dismissed.
+ std::optional<bool> moAtContextMenu_DisableEditHyperlink;
bool mbZoomOnPage;
bool mbIsRulerDrag;
sal_uLong mnLockCount;
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index ce34072644e0..c6ad21c0d74b 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -756,6 +756,10 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
{
GetActiveWindow()->ReleaseMouse();
+ // tdf#137445 at this context menu popup time get what the
+ // DisableEditHyperlink would be for this position
+ bool bShouldDisableEditHyperlink = ShouldDisableEditHyperlink();
+
if(rCEvt.IsMouseEvent())
GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId );
else
@@ -787,6 +791,16 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
//open context menu at that point
GetViewFrame()->GetDispatcher()->ExecutePopup( aPopupId, GetActiveWindow(), &aMenuPos );
}
+
+ if (!bShouldDisableEditHyperlink)
+ {
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ // tdf#137445 set what the menu popup state for this was
+ moAtContextMenu_DisableEditHyperlink = bShouldDisableEditHyperlink;
+ // ensure moAtContextMenu_DisableEditHyperlink will be cleared
+ // in the case that EditHyperlink is not dispatched by the menu
+ rBindings.Invalidate(SID_EDIT_HYPERLINK);
+ }
}
}
else
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 572d221c7f19..cdb8b78bb8bf 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1481,8 +1481,16 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
// Menuoption: Edit->Hyperlink
// Disable, if there is no hyperlink
-
- bool bDisableEditHyperlink = ShouldDisableEditHyperlink();
+ bool bDisableEditHyperlink;
+ if (!moAtContextMenu_DisableEditHyperlink)
+ bDisableEditHyperlink = ShouldDisableEditHyperlink();
+ else
+ {
+ // tdf#137445 if a popup menu was active, use the state as of when the popup was launched and then drop
+ // moAtContextMenu_DisableEditHyperlink
+ bDisableEditHyperlink = *moAtContextMenu_DisableEditHyperlink;
+ moAtContextMenu_DisableEditHyperlink.reset();
+ }
//highlight selected custom shape
{