[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Thu Jan 2 11:58:56 PST 2014
sc/source/core/data/dociter.cxx | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
New commits:
commit 6046207ea2ef67de1388b30a7e8e0da5dcf5e6bf
Author: Eike Rathke <erack at redhat.com>
Date: Thu Jan 2 20:52:28 2014 +0100
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
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 565565f..dab4a10 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());
More information about the Libreoffice-commits
mailing list