sc/source/core/data/column3.cxx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
New commits: commit 1aa089472457f0d6b67abb4637a5803b73682028 Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Thu Apr 27 13:58:26 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Jun 2 12:36:58 2023 +0200 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.mehrbr...@allotropia.de> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152493 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 900ed04fa795..ca16c49d8de8 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2564,7 +2564,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); @@ -2632,6 +2632,16 @@ class FilterEntriesHandler } mrFilterEntries.addBackgroundColor(backgroundColor); + 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)); @@ -2727,17 +2737,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); } };