sc/source/core/data/queryiter.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 4794aa29587255aaff1196e0cc6e29d136df7b76
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Wed May 11 01:14:44 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed May 11 11:49:01 2022 +0200

    make BinarySearch() do proper SC_EQUAL with ScQueryEntry::ByString
    
    ScQueryEvaluator::isQueryByString() makes everything a string search
    in this case, so this one should too.
    
    Change-Id: Ic1ebd14515cfb7f253f022ca4f76699a6cb63468
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134137
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/core/data/queryiter.cxx 
b/sc/source/core/data/queryiter.cxx
index 438128ef5f47..280926bf6eb0 100644
--- a/sc/source/core/data/queryiter.cxx
+++ b/sc/source/core/data/queryiter.cxx
@@ -347,6 +347,7 @@ bool ScQueryCellIteratorBase< accessType, queryType 
>::BinarySearch( SCCOL col )
     const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
     bool bAscending = rEntry.eOp == SC_LESS || rEntry.eOp == SC_LESS_EQUAL || 
rEntry.eOp == SC_EQUAL;
     bool bByString = rItem.meType == ScQueryEntry::ByString;
+    bool bForceStr = bByString && rEntry.eOp == SC_EQUAL;
     bool bAllStringIgnore = bIgnoreMismatchOnLeadingStrings && !bByString;
     bool bFirstStringIgnore = bIgnoreMismatchOnLeadingStrings &&
         !maParam.bHasHeader && bByString;
@@ -413,7 +414,7 @@ bool ScQueryCellIteratorBase< accessType, queryType 
>::BinarySearch( SCCOL col )
 
     aCellData = aIndexer.getCell(nLastInRange);
     ScRefCellValue aCell = aCellData.first;
-    if (aCell.hasString())
+    if (bForceStr || aCell.hasString())
     {
         sal_uInt32 nFormat = pCol->GetNumberFormat(mrContext, 
aCellData.second);
         OUString aStr = ScCellFormat::GetInputString(aCell, nFormat, 
rFormatter, rDoc);
@@ -447,7 +448,7 @@ bool ScQueryCellIteratorBase< accessType, queryType 
>::BinarySearch( SCCOL col )
 
         aCellData = aIndexer.getCell(i);
         aCell = aCellData.first;
-        bool bStr = aCell.hasString();
+        bool bStr = bForceStr || aCell.hasString();
         nRes = 0;
 
         // compares are content<query:-1, content>query:1

Reply via email to