diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2022-06-29 08:17:40 +0200 |
---|---|---|
committer | Balazs Varga <balazs.varga.extern@allotropia.de> | 2022-07-22 08:11:35 +0200 |
commit | 2d1df9f3dccc10f13b8585ad18afce1542ebc4d1 (patch) | |
tree | d0c98601015ead00d9e5effcc73df4868e3d7381 /sc/source/core/data | |
parent | f96a1389ce2b9f09a76998db5f86586cd519f6eb (diff) |
tdf#117276 sc: Show hidden filter elements as inactive elements
Showing hidden values in the autofilter dropdown (as inactive when
it was hidden by another row) - without changing the behaviour of
autofilter. First those which belongs to non-hidden rows, then those
which belongs to hidden rows.
TODO: maybe we can add a global option where the user can switch on/off this feature.
Change-Id: Iafeb43176efe7ab422b22697d399c68c95d0319d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136595
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Diffstat (limited to 'sc/source/core/data')
-rw-r--r-- | sc/source/core/data/column3.cxx | 9 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 6 |
3 files changed, 18 insertions, 5 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 91d5c4eaef2e..ebbefb03b714 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2559,7 +2559,7 @@ class FilterEntriesHandler if (rCell.hasString()) { - mrFilterEntries.push_back(ScTypedStrData(std::move(aStr))); + mrFilterEntries.push_back(ScTypedStrData(std::move(aStr), 0.0, 0.0, ScTypedStrData::Standard, false, mrColumn.IsFilteredRow())); return; } @@ -2617,9 +2617,9 @@ class FilterEntriesHandler } // store the formatted/rounded value for filtering if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0 && !bDate) - mrFilterEntries.push_back(ScTypedStrData(std::move(aStr), fVal, rColumn.GetDoc().RoundValueAsShown(fVal, nFormat), ScTypedStrData::Value, bDate)); + mrFilterEntries.push_back(ScTypedStrData(std::move(aStr), fVal, rColumn.GetDoc().RoundValueAsShown(fVal, nFormat), ScTypedStrData::Value, bDate, mrColumn.IsFilteredRow())); else - mrFilterEntries.push_back(ScTypedStrData(std::move(aStr), fVal, fVal, ScTypedStrData::Value, bDate)); + mrFilterEntries.push_back(ScTypedStrData(std::move(aStr), fVal, fVal, ScTypedStrData::Value, bDate, mrColumn.IsFilteredRow())); } public: @@ -2670,9 +2670,10 @@ public: void ScColumn::GetFilterEntries( sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow, - ScFilterEntries& rFilterEntries, bool bFiltering ) + ScFilterEntries& rFilterEntries, bool bFiltering, bool bHiddenRow ) { mbFiltering = bFiltering; + mbFilteredRow = bHiddenRow; FilterEntriesHandler aFunc(*this, rFilterEntries); rBlockPos.miCellPos = sc::ParseAll(rBlockPos.miCellPos, maCells, nStartRow, nEndRow, aFunc, aFunc); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 77afc2ff7d94..ecc93881c0bf 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -87,6 +87,10 @@ void sortAndRemoveDuplicates(std::vector<ScTypedStrData>& rStrings, bool bCaseSe std::vector<ScTypedStrData>::iterator it = std::unique(rStrings.begin(), rStrings.end(), ScTypedStrData::EqualCaseSensitive()); rStrings.erase(it, rStrings.end()); + if (std::find_if(rStrings.begin(), rStrings.end(), + [](ScTypedStrData& rString) { return rString.IsHiddenByFilter(); }) != rStrings.end()) { + std::sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessHiddenRows()); + } } else { @@ -94,6 +98,10 @@ void sortAndRemoveDuplicates(std::vector<ScTypedStrData>& rStrings, bool bCaseSe std::vector<ScTypedStrData>::iterator it = std::unique(rStrings.begin(), rStrings.end(), ScTypedStrData::EqualCaseInsensitive()); rStrings.erase(it, rStrings.end()); + if (std::find_if(rStrings.begin(), rStrings.end(), + [](ScTypedStrData& rString) { return rString.IsHiddenByFilter(); }) != rStrings.end()) { + std::sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessHiddenRows()); + } } } diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 391d012344b7..52b4a0500a46 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -3000,7 +3000,11 @@ void ScTable::GetFilteredFilterEntries( { if (queryEvaluator.ValidQuery(j)) { - aCol[nCol].GetFilterEntries(aBlockPos, j, j, rFilterEntries, bFiltering); + aCol[nCol].GetFilterEntries(aBlockPos, j, j, rFilterEntries, bFiltering, false/*bHiddenRow*/); + } + else + { + aCol[nCol].GetFilterEntries(aBlockPos, j, j, rFilterEntries, bFiltering, true/*bHiddenRow*/); } } } |