sw/source/uibase/docvw/edtdd.cxx  |   10 ++++++++++
 sw/source/uibase/docvw/edtwin.cxx |    2 +-
 sw/source/uibase/inc/edtwin.hxx   |    1 +
 sw/source/uibase/wrtsh/select.cxx |    1 +
 4 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 9788a565b3241d1bd62394b9e29c322361d05f80
Author:     Jim Raykowski <[email protected]>
AuthorDate: Thu Feb 9 08:57:56 2023 -0900
Commit:     Jim Raykowski <[email protected]>
CommitDate: Fri Feb 10 21:28:01 2023 +0000

    tdf#153205 related: Improve selection mode control icon update
    
    This patch makes the status bar selection mode control icon change to
    adding selection when the mouse is used to select text while the ctrl
    key is pressed and the mouse is moving, which is the behaviour when
    the mouse is not moving and selection begins. It also makes the icon
    show the correct mode when doing DnD.
    
    Change-Id: I9aeb47301ab3c8b9be2159186bcc8c8ede7bf3de
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146726
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <[email protected]>

diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx
index 8f86aa1d310a..278030c1f5ec 100644
--- a/sw/source/uibase/docvw/edtdd.cxx
+++ b/sw/source/uibase/docvw/edtdd.cxx
@@ -121,6 +121,16 @@ void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const 
Point& rPosPixel )
     if ( !bStart || m_bIsInDrag )
         return;
 
+    // If the add selection mode has been pushed in the MouseButtonDown 
handler it needs to be
+    // popped or it will remain active and noticable in the statusbar 
selection control until the
+    // next MouseButtonUp event after the DnD, since a MouseButtonUp event is 
not received by the
+    // edit window when DnD is done.
+    if (g_bModePushed)
+    {
+        rSh.PopMode();
+        g_bModePushed = false;
+    }
+
     m_bMBPressed = false;
     ReleaseMouse();
     g_bFrameDrag = false;
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 744730d9942e..1729bbfdde8a 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -173,7 +173,7 @@ static bool g_bHoldSelection      = false;
 
 bool g_bFrameDrag                   = false;
 static bool g_bValidCursorPos       = false;
-static bool g_bModePushed         = false;
+bool g_bModePushed = false;
 bool g_bDDTimerStarted            = false;
 bool g_bDDINetAttr                = false;
 static SdrHdlKind g_eSdrMoveHdl   = SdrHdlKind::User;
diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx
index e2a7ca97bcab..b5e09726a0b3 100644
--- a/sw/source/uibase/inc/edtwin.hxx
+++ b/sw/source/uibase/inc/edtwin.hxx
@@ -295,6 +295,7 @@ public:
     virtual FactoryFunction GetUITestFactory() const override;
 };
 
+extern bool g_bModePushed;
 extern bool g_bFrameDrag;
 extern bool g_bDDTimerStarted;
 extern bool g_bDDINetAttr;
diff --git a/sw/source/uibase/wrtsh/select.cxx 
b/sw/source/uibase/wrtsh/select.cxx
index 4cf35eb7d992..c955a8bdd174 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -55,6 +55,7 @@ void SwWrtShell::Invalidate()
     // to avoid making the slot volatile, invalidate it every time if 
something could have been changed
     // this is still much cheaper than asking for the state every 200 ms (and 
avoid background processing)
     GetView().GetViewFrame()->GetBindings().Invalidate( FN_STAT_SELMODE );
+    GetView().GetViewFrame()->GetBindings().Update(FN_STAT_SELMODE); // make 
selection mode control icon update immediatly
     SwWordCountWrapper *pWrdCnt = 
static_cast<SwWordCountWrapper*>(GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
     if (pWrdCnt)
         pWrdCnt->UpdateCounts();

Reply via email to