tdf#113785 sc: IsDataFiltered must be normalized
I can't believe this hasn't caused major issues
and has survived as a bug for so long.
Due to the way IsDataFiltered is coded,
it is required that the range is normalized
in order to get any kind of meaningful result,
so lets ensure that.
Change-Id: I2ede77f738fbaeb05a0f1425a2e88e59fca08e9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129735
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
(cherry picked from commit bda200a5e9c4592bd61b7924fa171ec3265bfd24)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129761
Reviewed-by: Eike Rathke <erack@redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130049
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 95bef41..7ed0318 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3665,6 +3665,8 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const
{
assert(nColStart <= nColEnd && nRowStart <= nRowEnd
&& "range must be normalized to obtain a valid result");
for (SCROW i = nRowStart; i <= nRowEnd; ++i)
{
if (RowHidden(i))
@@ -3680,8 +3682,9 @@ bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SC
bool ScTable::IsDataFiltered(const ScRange& rRange) const
{
return IsDataFiltered(rRange.aStart.Col(), rRange.aStart.Row(),
rRange.aEnd.Col(), rRange.aEnd.Row());
ScRange aNormalized(rRange.aStart, rRange.aEnd);
return IsDataFiltered(aNormalized.aStart.Col(), aNormalized.aStart.Row(),
aNormalized.aEnd.Col(), aNormalized.aEnd.Row());
}
void ScTable::SetRowFlags( SCROW nRow, CRFlags nNewFlags )