diff options
author | Eike Rathke <erack@redhat.com> | 2014-01-02 20:52:28 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-01-02 20:57:03 +0100 |
commit | 6046207ea2ef67de1388b30a7e8e0da5dcf5e6bf (patch) | |
tree | f8a3237fb82afda12b4d3899eab7a2ba395bed58 | |
parent | 33227dbf270bec5b7aa079b9b5e2e7e036796e20 (diff) |
resolved fdo#73113 not string cell does not mean no string at cell
Introduced with c008dc483f8c6840803983e7e351cec6fdd32070 the
ScQueryCellIterator::BinarySearch() evaluated all non-string cells as
not being string, ignoring edit cells and formula cell string results.
Change-Id: I43be46dc8db35d6d0677086c345379ed4627b355
-rw-r--r-- | sc/source/core/data/dociter.cxx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 565565f00a11..dab4a10cf94a 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1547,8 +1547,24 @@ bool ScQueryCellIterator::BinarySearch() continue; // while } + bool bHaveRefCell = false; PositionType aPos = pCol->maCells.position(i); - bool bStr = aPos.first->type == sc::element_type_string; + bool bStr; + switch (aPos.first->type) + { + case sc::element_type_formula: + aCell = sc::toRefCell(aPos.first, aPos.second); + bHaveRefCell = true; + bStr = aCell.hasString(); + break; + case sc::element_type_string: + case sc::element_type_edittext: + bStr = true; + break; + default: + bStr = false; + break; + } nRes = 0; // compares are content<query:-1, content>query:1 @@ -1556,7 +1572,8 @@ bool ScQueryCellIterator::BinarySearch() if (!bStr && !bByString) { double nCellVal; - aCell = sc::toRefCell(aPos.first, aPos.second); + if (!bHaveRefCell) + aCell = sc::toRefCell(aPos.first, aPos.second); switch (aCell.meType) { case CELLTYPE_VALUE : @@ -1611,7 +1628,8 @@ bool ScQueryCellIterator::BinarySearch() { OUString aCellStr; sal_uLong nFormat = pCol->GetNumberFormat(i); - aCell = sc::toRefCell(aPos.first, aPos.second); + if (!bHaveRefCell) + aCell = sc::toRefCell(aPos.first, aPos.second); ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc); nRes = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString.getString()); |