summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-01-02 20:52:28 +0100
committerEike Rathke <erack@redhat.com>2014-01-02 20:59:25 +0100
commit1d1301de3248b1e08a66a259457f59b5406a5034 (patch)
treecf1d85b64deb390ea851b9c215d5b2a72ad99c75
parentac2067d2df089b8fbf1a7f887680f856caeeee1f (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 (cherry picked from commit 6046207ea2ef67de1388b30a7e8e0da5dcf5e6bf)
-rw-r--r--sc/source/core/data/dociter.cxx24
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());