summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-04-27 13:58:26 +0200
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-06-01 13:05:13 +0200
commit6e2993e1a7a61d69717b3fcf93ffa52fa0f26ba9 (patch)
treee809a39825bbe38a63040fd91c67f3e0b4e4d1ca
parent677ec236e7409681e04578c8501833792c5f8099 (diff)
tdf#153972 Fix color filter when cells have no content
Change-Id: I9742fc0627c2311bfe4c067961e0feea476f1899 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151096 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
-rw-r--r--sc/source/core/data/column3.cxx23
1 files changed, 12 insertions, 11 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 5e1e66be1eca..eb478fd2a462 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2566,7 +2566,7 @@ class FilterEntriesHandler
bool mbFiltering;
bool mbFilteredRow;
- void processCell(const ScColumn& rColumn, SCROW nRow, ScRefCellValue& rCell)
+ void processCell(const ScColumn& rColumn, SCROW nRow, ScRefCellValue& rCell, bool bIsEmptyCell=false)
{
SvNumberFormatter* pFormatter = mrColumn.GetDoc().GetFormatTable();
sal_uLong nFormat = mrColumn.GetNumberFormat(mrColumn.GetDoc().GetNonThreadedContext(), nRow);
@@ -2580,6 +2580,16 @@ class FilterEntriesHandler
mrFilterEntries.addBackgroundColor(pTable->GetCellBackgroundColor(aPos));
}
+ if (bIsEmptyCell)
+ {
+ if (!mrFilterEntries.mbHasEmpties)
+ {
+ mrFilterEntries.push_back(ScTypedStrData(OUString()));
+ mrFilterEntries.mbHasEmpties = true;
+ }
+ return;
+ }
+
if (rCell.hasString())
{
mrFilterEntries.push_back(ScTypedStrData(std::move(aStr), 0.0, 0.0, ScTypedStrData::Standard, false, mbFilteredRow));
@@ -2675,17 +2685,8 @@ public:
void operator() (const int nElemType, size_t nRow, size_t /* nDataSize */)
{
- if ( nElemType == sc::element_type_empty )
- {
- if (!mrFilterEntries.mbHasEmpties)
- {
- mrFilterEntries.push_back(ScTypedStrData(OUString()));
- mrFilterEntries.mbHasEmpties = true;
- }
- return;
- }
ScRefCellValue aCell = mrColumn.GetCellValue(nRow);
- processCell(mrColumn, nRow, aCell);
+ processCell(mrColumn, nRow, aCell, nElemType == sc::element_type_empty);
}
};