tdf#124701 sc status bar: hide bad filtered row count
After loading the document, positioning the cell cursor
on filtered data, the status bar showed always the maximum
amount of the filtered data, e.g. "9 of 9 records found",
regardless of the real result, e.g. "6 of 9 records found",
because the ScTable::Query() function will not run until
we refresh the filters. As a workaround, we hide the
(often false) data in the meantime.
Change-Id: I904ca0c55e3afb276b11491c05430f985557f914
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110032
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 9f8b682..f5ffea0 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -82,7 +82,7 @@ ScDBData::ScDBData( const OUString& rName,
bAutoFilter (false),
bModified (false),
mbTableColumnNamesDirty(true),
nFilteredRowCount(0)
nFilteredRowCount(SCSIZE_MAX)
{
aUpper = ScGlobal::getCharClassPtr()->uppercase(aUpper);
}
@@ -936,7 +936,10 @@ void ScDBData::GetFilterSelCount( SCSIZE& nSelected, SCSIZE& nTotal )
nTotal = nEndRow - nStartRow + 1;
if ( bHasHeader )
nTotal -= 1;
nSelected = nTotal - nFilteredRowCount;
if( nFilteredRowCount != SCSIZE_MAX )
nSelected = nTotal - nFilteredRowCount;
else
nSelected = nFilteredRowCount;
}
namespace {
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index f4194d3..65640e0 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -781,7 +781,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
{
SCSIZE nSelected, nTotal;
rDoc.GetFilterSelCount( nPosX, nPosY, nTab, nSelected, nTotal );
if( nTotal )
if( nTotal && nSelected != SCSIZE_MAX )
{
OUString aStr = ScResId( STR_FILTER_SELCOUNT );
aStr = aStr.replaceAll( "$1", OUString::number( nSelected ) );