summaryrefslogtreecommitdiff
path: root/sc/inc/queryiter.hxx
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2024-02-01 14:36:24 +0100
committerBalazs Varga <balazs.varga.extern@allotropia.de>2024-02-08 08:25:15 +0100
commit68738bd0ac262819b13ea7e11af67ee493b9b3e1 (patch)
tree6d71611c0d1d029485e82ecce722269e18811fe1 /sc/inc/queryiter.hxx
parentba3d3c308e944978a6b84b81cdcc1fd18f0c713e (diff)
Related: tdf#127293 Fix function XLOOKUP binary search corner cases
Fix some binary search (vertical) corner cases in case of XLOOKUP where we looking for the first matches. Change-Id: I6cdc778350989e0802ffc54284fdab9b8a2bece4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162877 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Diffstat (limited to 'sc/inc/queryiter.hxx')
-rw-r--r--sc/inc/queryiter.hxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/sc/inc/queryiter.hxx b/sc/inc/queryiter.hxx
index e34a7be20e13..662fe8a9cf35 100644
--- a/sc/inc/queryiter.hxx
+++ b/sc/inc/queryiter.hxx
@@ -171,8 +171,16 @@ protected:
nTestEqualConditionFulfilled = nTestEqualConditionEnabled | nTestEqualConditionMatched
};
+ enum SortedBinarySearchBits
+ {
+ nBinarySearchDisabled = 0x00,
+ nSearchbAscd = 0x01,
+ nSearchbDesc = 0x02,
+ };
+
sal_uInt8 nStopOnMismatch;
sal_uInt8 nTestEqualCondition;
+ sal_uInt8 nSortedBinarySearch;
bool bAdvanceQuery;
bool bIgnoreMismatchOnLeadingStrings;
bool bSortedBinarySearch;
@@ -263,8 +271,11 @@ public:
{ bAdvanceQuery = bVal; }
void AdvanceQueryParamEntryField();
- void SetSortedBinarySearchMode( bool bVal )
- { bSortedBinarySearch = bVal; }
+ void SetSortedBinarySearchMode( sal_Int8 nSearchMode )
+ {
+ nSortedBinarySearch = sal::static_int_cast<sal_uInt8>(nSearchMode == 2 ?
+ nSearchbAscd : (nSearchMode == -2 ? nSearchbDesc : nBinarySearchDisabled));
+ }
void SetXlookupMode( bool bVal )
{ bXLookUp = bVal; }
@@ -309,11 +320,12 @@ class ScQueryCellIterator
using Base::nStopOnMismatchEnabled;
using Base::nTestEqualCondition;
using Base::nTestEqualConditionEnabled;
+ using Base::nSortedBinarySearch;
+ using Base::nBinarySearchDisabled;
using Base::PerformQuery;
using Base::getThisResult;
using Base::nBestFitCol;
using Base::nBestFitRow;
- using Base::bSortedBinarySearch;
using Base::bXLookUp;
bool GetThis();