summaryrefslogtreecommitdiff
path: root/sc/source/ui/dialogs/searchresults.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-08-09 01:04:56 +0200
committerEike Rathke <erack@redhat.com>2021-08-09 02:24:54 +0200
commit1c5b3cb3dd4dab6b0db409b6cc75b3111103820f (patch)
tree11e63b9c6974879ad0c1206e752bc263648cc293 /sc/source/ui/dialogs/searchresults.cxx
parentd1f1f546b212ecd651146addeb328806bb270d5f (diff)
Related: tdf#143759 Display results of find empty or replace to empty
Searching for empty cells or replacing to empty cells didn't list the results because ScCellIterator iterates over cells with content only. Change-Id: If6ea65f853cae621e54ce545fe7fbed2b445fd14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120189 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/dialogs/searchresults.cxx')
-rw-r--r--sc/source/ui/dialogs/searchresults.cxx25
1 files changed, 16 insertions, 9 deletions
diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx
index c9558c5376f3..db9dae68bfc8 100644
--- a/sc/source/ui/dialogs/searchresults.cxx
+++ b/sc/source/ui/dialogs/searchresults.cxx
@@ -92,7 +92,8 @@ namespace
};
}
-void SearchResultsDlg::FillResults( ScDocument& rDoc, const ScRangeList &rMatchedRanges, bool bCellNotes )
+void SearchResultsDlg::FillResults( ScDocument& rDoc, const ScRangeList &rMatchedRanges, bool bCellNotes,
+ bool bEmptyCells )
{
ListWrapper aList(*mxList);
std::vector<OUString> aTabNames = rDoc.GetAllTableNames();
@@ -103,13 +104,10 @@ void SearchResultsDlg::FillResults( ScDocument& rDoc, const ScRangeList &rMatche
if (nMatchMax > ListWrapper::mnMaximum)
nMatchMax = ListWrapper::mnMaximum;
- if (bCellNotes)
+ if (bCellNotes || bEmptyCells)
{
for (size_t i = 0, n = nMatchMax; i < n; ++i)
{
- /* TODO: a CellNotes iterator would come handy and might speed
- * things up a little, though we only loop through the
- * search/replace result positions here. */
ScRange const & rRange( rMatchedRanges[i] );
// Bear in mind that mostly the range is one address position
// or a column or a row joined.
@@ -122,11 +120,20 @@ void SearchResultsDlg::FillResults( ScDocument& rDoc, const ScRangeList &rMatche
{
for (aPos.SetRow( rRange.aStart.Row()); aPos.Row() <= rRange.aEnd.Row(); aPos.IncRow())
{
- const ScPostIt* pNote = rDoc.GetNote( aPos);
- if (pNote)
+ if (bCellNotes)
+ {
+ const ScPostIt* pNote = rDoc.GetNote( aPos);
+ if (pNote)
+ aList.Insert(aTabNames[aPos.Tab()], aPos,
+ rDoc.GetAddressConvention(),
+ pNote->GetText());
+ }
+ else // bEmptyCells
+ {
aList.Insert(aTabNames[aPos.Tab()], aPos,
- rDoc.GetAddressConvention(),
- pNote->GetText());
+ rDoc.GetAddressConvention(),
+ rDoc.GetString(aPos));
+ }
}
}
}