summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2022-02-09 14:33:05 +0200
committerJustin Luth <jluth@mail.com>2022-02-09 19:10:15 +0100
commit618084819babc839510860b74b36631749093c4c (patch)
tree382aac4e9f6da0d9055bdc187d6b8052a69e1061
parent30146dd8052c8c7f701417eecc2ca1e529aa23cc (diff)
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>
-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 88d4395eaced..5c7c00dc1ff0 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)
{