From 8c3af6240d5765fb8954025226477670e1d2a7c7 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Sun, 1 Mar 2020 14:08:20 -0500 Subject: editeng: lok: send cursor visibility event when restoring update mode When the default text is removed from a TextBox within a slide, the cursor visibility is inadvertendly set to false and never restored (because the LOK notification is disabled due to treating the ShowCursor during SetUpdateMode as an activation of the TextBox, and that is supressed to avoid messing up the cursor when creating a new view). We add a new flag to SetUpdateMode to flag whether this is an activation or we are restoring a previously active window (TextBox) due to a temporary disabling (to clear the default text). Four unit-tests added not just to check and validate the fix, but to also simulate two different ways of entering edit mode, first by single-clicking on the text and then double-clicking outside the text, but within the TextBox. Change-Id: Icaaabc2a897f614f5ce162b71fadccff22ecda02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90301 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 6b84dfabbb5f6930f9ac582f8c1dd9f467fd068c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90298 Tested-by: Jenkins Reviewed-by: Ashod Nakashian --- editeng/source/outliner/outliner.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'editeng/source/outliner') diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 072851d2702f..f7f8cc316ad1 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -399,7 +399,7 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara ) { DBG_ASSERT(pPara,"SetText:No Para"); - sal_Int32 nPara = pParaList->GetAbsPos( pPara ); + const sal_Int32 nPara = pParaList->GetAbsPos( pPara ); if (pEditEngine->GetText( nPara ) == rText) { @@ -408,7 +408,7 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara ) return; } - bool bUpdate = pEditEngine->GetUpdateMode(); + const bool bUpdate = pEditEngine->GetUpdateMode(); pEditEngine->SetUpdateMode( false ); ImplBlockInsertionCallbacks( true ); @@ -482,7 +482,8 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara ) DBG_ASSERT(pParaList->GetParagraphCount()==pEditEngine->GetParagraphCount(),"SetText failed!"); bFirstParaIsEmpty = false; ImplBlockInsertionCallbacks( false ); - pEditEngine->SetUpdateMode( bUpdate ); + // Restore the update mode. + pEditEngine->SetUpdateMode(bUpdate, /*bRestoring=*/true); } // pView == 0 -> Ignore tabs -- cgit