[Libreoffice-commits] core.git: sc/qa sc/source

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 10 13:30:54 UTC 2021


 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(-)

New commits:
commit 75d8a5450dfbc3bd509341126554cd1e9ecf5638
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Feb 10 11:58:52 2021 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Feb 10 14:30:04 2021 +0100

    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/+/110696
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index 40e1b3b6bf35..20d111b3e2cd 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -2451,7 +2451,7 @@ void Test::testSharedFormulaDeleteTopCell()
     // Delete cell A1.
     ScMarkData aMark(m_pDoc->GetSheetLimits());
     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 2949e92390f1..951048e43869 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -660,7 +660,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);
 
@@ -716,7 +716,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 51dcf25ccd1c..96475d4b30d3 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -92,7 +92,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 a8c5a1add0c9..29ed15854e04 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.
  *
@@ -1981,10 +1981,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());
 


More information about the Libreoffice-commits mailing list