summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2022-02-09 14:33:05 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-02-10 10:53:08 +0100
commitf3035cdb6a8d3ef56180640ef9d04031012250b9 (patch)
tree5f327fbd29c8c11953e8413720ae6ede6ab0c182
parenttdf#147182 sw: accept/reject all changes of a table selection (diff)
downloadcore-f3035cdb6a8d3ef56180640ef9d04031012250b9.tar.gz
core-f3035cdb6a8d3ef56180640ef9d04031012250b9.zip
tdf#113785 sc FillAutoSimple: also optimize in negative direction
By only coding the optimization for the downward autofill, it totally broke an upward autofill. So this patch simply fixes the LO 4.3ish regression from commit a995462e6855061816c6529c366f20ace2b45868. This fix means that the non-hidden cells get the auto-value instead of being erased. However, the hidden cells are still erased (which is the topic of tdf#119957). I'm not going to bother with a unit test for this portion. If I can solve bug 119957 as well, then the unit test for that can cover both situations. Change-Id: If6320ccf87fa8893ca6766c265b7760cc46ed7d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129723 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> (cherry picked from commit 618084819babc839510860b74b36631749093c4c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129753 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sc/source/core/data/table4.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 6ef2c3b439b2..d2fdde2718b8 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1782,16 +1782,28 @@ void ScTable::FillAutoSimple(
bool bIsOrdinalSuffix = false;
bool bColHidden = false, bRowHidden = false;
+ SCCOL nColHiddenFirst = rDocument.MaxCol();
SCCOL nColHiddenLast = -1;
+ SCROW nRowHiddenFirst = rDocument.MaxRow();
SCROW nRowHiddenLast = -1;
rInner = nIStart;
while (true) // #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes
{
- if (rCol > nColHiddenLast)
- bColHidden = ColHidden(rCol, nullptr, &nColHiddenLast);
- if (rRow > nRowHiddenLast)
- bRowHidden = RowHidden(rRow, nullptr, &nRowHiddenLast);
+ if (bPositive)
+ {
+ if (rCol > nColHiddenLast)
+ bColHidden = ColHidden(rCol, nullptr, &nColHiddenLast);
+ if (rRow > nRowHiddenLast)
+ bRowHidden = RowHidden(rRow, nullptr, &nRowHiddenLast);
+ }
+ else
+ {
+ if (rCol < nColHiddenFirst)
+ bColHidden = ColHidden(rCol, &nColHiddenFirst);
+ if (rRow < nRowHiddenFirst)
+ bRowHidden = RowHidden(rRow, &nRowHiddenFirst);
+ }
if (!bColHidden && !bRowHidden)
{