From d11933d905d1a610f4b4f0a97354b06cdbd6ee6d Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 10 Feb 2021 11:58:52 +0200 Subject: Don't shrink row height when deleting cell contents interactively either Follow-up to e763e13873adfe3c6abfa4c2dfd3ac3847e2d494. Such shrinking of row height, typically by a few silly pixels, just causes unnecessary invalidation thrash in a collaborative editing context. Change-Id: I5651ce994ba4bf82c83d7d4ef1bb8ed5bab0a66d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110697 Tested-by: Jenkins CollaboraOffice Reviewed-by: Dennis Francis Reviewed-by: Tor Lillqvist --- sc/qa/unit/ucalc_sharedformula.cxx | 2 +- sc/source/ui/docshell/docfunc.cxx | 4 ++-- sc/source/ui/inc/docfunc.hxx | 2 +- sc/source/ui/view/viewfunc.cxx | 10 +++++++--- 4 files changed, 11 insertions(+), 7 deletions(-) (limited to 'sc') diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 7cb85e8c9bbf..3aeffd2f3fef 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -2406,7 +2406,7 @@ void Test::testSharedFormulaDeleteTopCell() // Delete cell A1. ScMarkData aMark(MAXROW, MAXCOL); aMark.SelectOneTable(0); - getDocShell().GetDocFunc().DeleteCell( ScAddress(0,0,0), aMark, InsertDeleteFlags::CONTENTS, false); + getDocShell().GetDocFunc().DeleteCell( ScAddress(0,0,0), aMark, InsertDeleteFlags::CONTENTS, false, /*bApi=*/ true); // Check it's gone. CPPUNIT_ASSERT(!m_pDoc->GetFormulaCell( ScAddress(0,0,0))); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index c016d3083b63..3a135d9d0042 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -658,7 +658,7 @@ bool ScDocFunc::DeleteContents( } bool ScDocFunc::DeleteCell( - const ScAddress& rPos, const ScMarkData& rMark, InsertDeleteFlags nFlags, bool bRecord ) + const ScAddress& rPos, const ScMarkData& rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi ) { ScDocShellModificator aModificator(rDocShell); @@ -714,7 +714,7 @@ bool ScDocFunc::DeleteCell( nFlags, pDataSpans, false, bDrawUndo); } - if (!AdjustRowHeight(rPos, true, true)) + if (!AdjustRowHeight(rPos, true, bApi)) rDocShell.PostPaint( rPos.Col(), rPos.Row(), rPos.Tab(), rPos.Col(), rPos.Row(), rPos.Tab(), PaintPartFlags::Grid, nExtFlags); diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index af8e23fc3124..8ca4c445cca7 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -91,7 +91,7 @@ public: const ScMarkData& rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi ); bool DeleteCell( - const ScAddress& rPos, const ScMarkData& rMark, InsertDeleteFlags nFlags, bool bRecord ); + const ScAddress& rPos, const ScMarkData& rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi ); bool TransliterateText( const ScMarkData& rMark, TransliterationFlags nType, bool bApi ); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 06241ecb4cf7..e5b1da40162c 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -1987,10 +1987,14 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags ) HideAllCursors(); // for if summary is cancelled ScDocFunc& rDocFunc = pDocSh->GetDocFunc(); + + // Can we really be sure that we can pass the bApi parameter as false to DeleteCell() and + // DeleteContents() here? (Meaning that this is interactive use.) Is this never invoked from + // scripting and whatnot? if (bSimple) - rDocFunc.DeleteCell(aMarkRange.aStart, aFuncMark, nFlags, bRecord); + rDocFunc.DeleteCell(aMarkRange.aStart, aFuncMark, nFlags, bRecord, /*bApi=*/ false); else - rDocFunc.DeleteContents(aFuncMark, nFlags, bRecord, false); + rDocFunc.DeleteContents(aFuncMark, nFlags, bRecord, /*bApi=*/ false); pDocSh->UpdateOle(&GetViewData()); -- cgit