Kaydet (Commit) 6046207e authored tarafından Eike Rathke's avatar Eike Rathke

resolved fdo#73113 not string cell does not mean no string at cell

Introduced with c008dc48 the
ScQueryCellIterator::BinarySearch() evaluated all non-string cells as
not being string, ignoring edit cells and formula cell string results.

Change-Id: I43be46dc8db35d6d0677086c345379ed4627b355
üst 33227dbf
...@@ -1547,8 +1547,24 @@ bool ScQueryCellIterator::BinarySearch() ...@@ -1547,8 +1547,24 @@ bool ScQueryCellIterator::BinarySearch()
continue; // while continue; // while
} }
bool bHaveRefCell = false;
PositionType aPos = pCol->maCells.position(i); 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; nRes = 0;
// compares are content<query:-1, content>query:1 // compares are content<query:-1, content>query:1
...@@ -1556,6 +1572,7 @@ bool ScQueryCellIterator::BinarySearch() ...@@ -1556,6 +1572,7 @@ bool ScQueryCellIterator::BinarySearch()
if (!bStr && !bByString) if (!bStr && !bByString)
{ {
double nCellVal; double nCellVal;
if (!bHaveRefCell)
aCell = sc::toRefCell(aPos.first, aPos.second); aCell = sc::toRefCell(aPos.first, aPos.second);
switch (aCell.meType) switch (aCell.meType)
{ {
...@@ -1611,6 +1628,7 @@ bool ScQueryCellIterator::BinarySearch() ...@@ -1611,6 +1628,7 @@ bool ScQueryCellIterator::BinarySearch()
{ {
OUString aCellStr; OUString aCellStr;
sal_uLong nFormat = pCol->GetNumberFormat(i); sal_uLong nFormat = pCol->GetNumberFormat(i);
if (!bHaveRefCell)
aCell = sc::toRefCell(aPos.first, aPos.second); aCell = sc::toRefCell(aPos.first, aPos.second);
ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc); ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment