[Libreoffice-commits] core.git: sd/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 14 13:00:50 UTC 2020
sd/source/ui/inc/DrawViewShell.hxx | 5 +++++
sd/source/ui/view/drviews4.cxx | 14 ++++++++++++++
sd/source/ui/view/drviews7.cxx | 12 ++++++++++--
3 files changed, 29 insertions(+), 2 deletions(-)
New commits:
commit eb395e21a7b1f15de664c4b207dc9e130aa635cf
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 14 09:43:17 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 14 15:00:06 2020 +0200
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 at redhat.com>
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
{
More information about the Libreoffice-commits
mailing list