summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2024-10-09 11:41:40 +0300
committerSzymon Kłos <szymon.klos@collabora.com>2024-10-24 09:34:16 +0200
commitdaf2e27b96276dd51685f6510910c7f3fee0d496 (patch)
treefbe4f4179c241b9509c25fc7ed57f52244177bcb
parentac3b954ad37d679ead4420bc4826af766b72a841 (diff)
Reapply "Prevent cursor invalidation if the cursor position doesn't change."
This reverts commit 8da753752898984425c98a7f3db02b1aa69b74c8. Merge cells case were failing. Fixed now. Change-Id: I1dfd7e939c5590d64d096707edff40cb414ef3cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174813 (cherry picked from commit a260cc52b2fae1382805b4389c95f29ed8671f42) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175302 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/inc/crsrsh.hxx1
-rw-r--r--sw/source/core/crsr/crsrsh.cxx7
-rw-r--r--sw/source/core/crsr/viscrs.cxx2
3 files changed, 9 insertions, 1 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 8b9f138506aa..02a08289a889 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -237,6 +237,7 @@ private:
bool m_bBasicHideCursor : 1; // true -> HideCursor from Basic
bool m_bSetCursorInReadOnly : 1;// true -> Cursor is allowed in ReadOnly-Areas
bool m_bOverwriteCursor : 1; // true -> show Overwrite Cursor
+ bool m_bIsCursorPosChanged : 1; // true -> if the cursor position is changed last cursor update
// true -> send accessible events when cursor changes
// (set to false when using internal-only helper cursor)
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index cb3ff93babd0..4df37884956a 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1922,6 +1922,7 @@ class SwNotifyAccAboutInvalidTextSelections
void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
{
+ Point nOldPos = m_pCurrentCursor->GetPtPos();
CurrShell aCurr( this );
ClearUpCursors();
@@ -2421,6 +2422,10 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
GetOut()->SetSettings( aSettings );
}
+ // Do not notify the cursor if the position didn't change
+ Point nNewPos = m_pCurrentCursor->GetPtPos();
+ m_bIsCursorPosChanged = nOldPos != nNewPos;
+
if( m_bSVCursorVis )
m_pVisibleCursor->Show(); // show again
@@ -2428,6 +2433,7 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
sendLOKCursorUpdates();
getIDocumentMarkAccess()->NotifyCursorUpdate(*this);
+ m_bIsCursorPosChanged = false; // reset to default
}
void SwCursorShell::sendLOKCursorUpdates()
@@ -3346,6 +3352,7 @@ SwCursorShell::SwCursorShell( SwCursorShell& rShell, vcl::Window *pInitWin )
m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd =
m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor =
m_bOverwriteCursor = false;
+ m_bIsCursorPosChanged = false;
m_bSendAccessibleCursorEvents = true;
m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = true;
m_bSVCursorVis = true;
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index c3f534d31b4b..25de24892a8d 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -247,7 +247,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell)
LOK_CALLBACK_INVALIDATE_VIEW_CURSOR);
}
}
- else
+ else if (m_pCursorShell->m_bIsCursorPosChanged || m_pCursorShell->IsTableMode())
{
SfxLokHelper::notifyUpdatePerViewId(m_pCursorShell->GetSfxViewShell(), SfxViewShell::Current(),
m_pCursorShell->GetSfxViewShell(), LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);