From 69ac605191860aceee09f1147a5234222d1b3300 Mon Sep 17 00:00:00 2001 From: Mohammed Abdul Azeem Date: Mon, 29 Feb 2016 16:48:03 +0530 Subject: tdf#57523 - Regex search "^$" finds all empty cells in given range. Just added a condition to trigger ScTable::SearchAndReplaceEmptyCells which already finds and replaces all empty cells. Corrected range detection to find empty cells in data area only. Odd behavior when selection was left or above actual data area has been fixed. Change-Id: I4b0cedd9d28ebdcaf580ca1bc8da780cf6342c54 Reviewed-on: https://gerrit.libreoffice.org/22766 Tested-by: Jenkins Reviewed-by: Eike Rathke Tested-by: Eike Rathke --- sc/source/core/data/table6.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sc') diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index d094a7e513d3..1cef84940c3b 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -728,7 +728,7 @@ bool ScTable::SearchAndReplace( css::util::SearchOptions2 aSearchOptions = rSearchItem.GetSearchOptions(); aSearchOptions.Locale = *ScGlobal::GetLocale(); - if (aSearchOptions.searchString.isEmpty()) + if (aSearchOptions.searchString.isEmpty() || ( rSearchItem.GetRegExp() && aSearchOptions.searchString.equals("^$") ) ) { // Search for empty cells. return SearchAndReplaceEmptyCells(rSearchItem, rCol, rRow, rMark, rMatchedRanges, rUndoStr, pUndoDoc); @@ -784,15 +784,15 @@ bool ScTable::SearchAndReplaceEmptyCells( for ( size_t i = 0, n = aMarkedRanges.size(); i < n; ++i ) { ScRange* p = aMarkedRanges[ i ]; - if (p->aStart.Col() > nColEnd || p->aStart.Row() > nRowEnd) + if (p->aStart.Col() > nColEnd || p->aStart.Row() > nRowEnd || p->aEnd.Col() < nColStart || p->aEnd.Row() < nRowStart) // This range is outside the data area. Skip it. continue; // Shrink the range into data area only. if (p->aStart.Col() < nColStart) - p->aStart.SetCol(rCol); + p->aStart.SetCol(nColStart); if (p->aStart.Row() < nRowStart) - p->aStart.SetRow(rRow); + p->aStart.SetRow(nRowStart); if (p->aEnd.Col() > nColEnd) p->aEnd.SetCol(nColEnd); -- cgit