sd/source/ui/inc/DrawViewShell.hxx |    5 -----
 sd/source/ui/view/drviews4.cxx     |   14 --------------
 sd/source/ui/view/drviews7.cxx     |   14 +++-----------
 3 files changed, 3 insertions(+), 30 deletions(-)

New commits:
commit 023a2de2a8ef4bdcd9877e60f8739366de3a763c
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon Nov 6 08:57:20 2023 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Nov 15 20:04:16 2023 +0100

    tdf#158031 Revert "Resolves: tdf#137445 use the DisableEditHyperlink state
    
    ... as of menu launch time"
    
    This code is now obsolete from generic changes for bug 158031,
    so revert 7.1 commit eb395e21a7b1f15de664c4b207dc9e130aa635cf.
    
    It was a fine idea, but overly complex, dependent on invalidations,
    and hard to re-implement everywhere it would be needed.
    
    Instead, just also check before cursor for a field.
    
    Change-Id: I08354e32fefb66ff051458097d3bd07946198a4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159014
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sd/source/ui/inc/DrawViewShell.hxx 
b/sd/source/ui/inc/DrawViewShell.hxx
index d1e9b74af198..3043ba007bf2 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -456,11 +456,6 @@ private:
     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 986aec295bea..4226f0e4e8d8 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -804,10 +804,6 @@ 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
@@ -839,16 +835,6 @@ 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 3bace958df28..223493fb29e0 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -293,7 +293,8 @@ bool DrawViewShell::ShouldDisableEditHyperlink() const
     bool bDisableEditHyperlink = true;
     if( mpDrawView->IsTextEdit() )
     {
-        if 
(URLFieldHelper::IsCursorAtURLField(mpDrawView->GetTextEditOutlinerView()))
+        if 
(URLFieldHelper::IsCursorAtURLField(mpDrawView->GetTextEditOutlinerView(),
+                                               /*AlsoCheckBeforeCursor=*/true))
             bDisableEditHyperlink = false;
     }
     else
@@ -1479,16 +1480,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
 
     // Menuoption: Edit->Hyperlink
     // Disable, if there is no hyperlink
-    bool bDisableEditHyperlink;
-    if (!moAtContextMenu_DisableEditHyperlink.has_value())
-        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();
-    }
+    bool bDisableEditHyperlink = ShouldDisableEditHyperlink();
 
     //highlight selected custom shape
     {

Reply via email to