diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2023-04-27 13:58:26 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-06-02 12:36:58 +0200 |
commit | 1aa089472457f0d6b67abb4637a5803b73682028 (patch) | |
tree | 57807a14ec70ad244a67f49d27b41c55f057c898 /sc | |
parent | 445698dca110520673c89138b80e822a5d8086b5 (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>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152493
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/column3.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
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); } }; |