summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorMohammed Abdul Azeem <azeemmysore@gmail.com>2016-02-29 16:48:03 +0530
committerEike Rathke <erack@redhat.com>2016-03-10 14:05:23 +0000
commit69ac605191860aceee09f1147a5234222d1b3300 (patch)
tree59dd76799769656840794d1f633fda3d7c6327ca /sc/source/core
parent0827a83a776e8be6329d1aa3caa72bf19431ad08 (diff)
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 <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/table6.cxx8
1 files changed, 4 insertions, 4 deletions
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);