summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-07-27 19:04:07 +0200
committerEike Rathke <erack@redhat.com>2016-07-27 19:04:34 +0200
commitd93284f65cf14fdf5e2520b474eb7383ca1d99e4 (patch)
tree527680e9883b85eece7b68084a99d321d8c32ddb
parente8e5853b88d7873a23050f44c74a7e86b1bca3d0 (diff)
use HasCellNotes() when looping and searching for notes, tdf#65334 follow-up
... so we actually find all if on empty cells. Change-Id: Ie504ce7df2a17877eddf21cf309990a2a8b692ba
-rw-r--r--sc/source/core/data/table6.cxx47
1 files changed, 39 insertions, 8 deletions
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 15135f956115..e7e7caf244c7 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -327,6 +327,7 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
SCROW nRow = rRow;
bool bSkipFiltered = !rSearchItem.IsSearchFiltered();
+ bool bSearchNotes = (rSearchItem.GetCellType() == SvxSearchCellType::NOTE);
if (!bAll && rSearchItem.GetBackward())
{
SCROW nLastNonFilteredRow = MAXROW + 1;
@@ -350,7 +351,12 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
{
nCol--;
if ((SCsCOL)nCol >= 0)
- bIsEmpty = aCol[nCol].IsEmptyData();
+ {
+ if (bSearchNotes)
+ bIsEmpty = !aCol[nCol].HasCellNotes();
+ else
+ bIsEmpty = aCol[nCol].IsEmptyData();
+ }
else
bIsEmpty = true;
}
@@ -377,8 +383,16 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
bFound = SearchCell(rSearchItem, nCol, nRow, rMark, rUndoStr, pUndoDoc);
if (!bFound)
{
- if (!aCol[nCol].GetPrevDataPos(nRow))
- nRow = -1;
+ if (bSearchNotes)
+ {
+ /* TODO: can we look for the previous cell note instead? */
+ --nRow;
+ }
+ else
+ {
+ if (!aCol[nCol].GetPrevDataPos(nRow))
+ nRow = -1;
+ }
}
}
if (!bFound)
@@ -391,7 +405,12 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
{
nCol--;
if ((SCsCOL)nCol >= 0)
- bIsEmpty = aCol[nCol].IsEmptyData();
+ {
+ if (bSearchNotes)
+ bIsEmpty = !aCol[nCol].HasCellNotes();
+ else
+ bIsEmpty = aCol[nCol].IsEmptyData();
+ }
else
bIsEmpty = true;
}
@@ -417,7 +436,9 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
if (!bFound)
{
nCol++;
- while ((nCol <= nLastCol) && aCol[nCol].IsEmptyData()) nCol++;
+ while ((nCol <= nLastCol) &&
+ (bSearchNotes ? !aCol[nCol].HasCellNotes() : aCol[nCol].IsEmptyData()))
+ nCol++;
}
}
if (!bFound)
@@ -440,8 +461,16 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
bFound = SearchCell(rSearchItem, nCol, nRow, rMark, rUndoStr, pUndoDoc);
if (!bFound)
{
- if (!aCol[nCol].GetNextDataPos(nRow))
- nRow = MAXROW + 1;
+ if (bSearchNotes)
+ {
+ /* TODO: can we look for the next cell note instead? */
+ ++nRow;
+ }
+ else
+ {
+ if (!aCol[nCol].GetNextDataPos(nRow))
+ nRow = MAXROW + 1;
+ }
}
}
if (!bFound)
@@ -450,7 +479,9 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
nRow = 0;
nLastNonFilteredRow = -1;
nCol++;
- while ((nCol <= nLastCol) && aCol[nCol].IsEmptyData()) nCol++;
+ while ((nCol <= nLastCol) &&
+ (bSearchNotes ? !aCol[nCol].HasCellNotes() : aCol[nCol].IsEmptyData()))
+ nCol++;
}
}
}