summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2022-02-09 14:33:05 +0200
committerEike Rathke <erack@redhat.com>2022-02-16 12:03:02 +0100
commit99191703b528d8d7b0b9c5d84d76a6fdebbf5191 (patch)
tree4f290ed6d225fab4e995b35f8d2a434ba118d388 /sc
parentcbaf6eda9237986e64d062784cc8c97842cd2c76 (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> (cherry picked from commit 618084819babc839510860b74b36631749093c4c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129753 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit f3035cdb6a8d3ef56180640ef9d04031012250b9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129760 Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-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 0f1f7193fe59..73ad750d35c1 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)
{