summaryrefslogtreecommitdiff
path: root/sc/inc/queryiter.hxx
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2024-04-26 16:27:43 +0200
committerBalazs Varga <balazs.varga.extern@allotropia.de>2024-05-01 20:32:17 +0200
commit85f733a9242339d8e92f992ff1ad6d1b99d3f383 (patch)
tree618f865d2777476ad42e7f45e35a10da27a6b0ec /sc/inc/queryiter.hxx
parentb265b547b9e09893187aab0aa1085ba51c43563b (diff)
Related: tdf#160725 - Add horizontal binary search mode for SortedCache
and ScSortedRangeCache classes to support binary search mode in case of different columns. Which is used by the new XLOOKUP function from now on in case of binary search mode. Change-Id: Ibb2ae33670cbe9b47110de57afb6376cd829b465 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166758 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.hxx32
1 files changed, 17 insertions, 15 deletions
diff --git a/sc/inc/queryiter.hxx b/sc/inc/queryiter.hxx
index c6cd1906a4fb..9d0ab1cc6aea 100644
--- a/sc/inc/queryiter.hxx
+++ b/sc/inc/queryiter.hxx
@@ -86,9 +86,9 @@ protected:
SCROW nRow;
class NonEmptyCellIndexer;
- typedef std::pair<ScRefCellValue, SCROW> BinarySearchCellType;
- static NonEmptyCellIndexer MakeBinarySearchIndexer(const sc::CellStoreType& rCells,
- SCROW nStartRow, SCROW nEndRow);
+ typedef std::pair<ScRefCellValue, SCCOLROW> BinarySearchCellType;
+ static NonEmptyCellIndexer MakeBinarySearchIndexer(const sc::CellStoreType* pCells,
+ SCCOLROW nStartRow, SCCOLROW nEndRow);
};
// The implementation using ScSortedRangeCache, which allows sorted iteration
@@ -105,6 +105,7 @@ protected:
const ScQueryParam& rParam, bool bReverseSearch );
void InitPosStart(sal_uInt8 nSortedBinarySearch = 0x00);
void InitPosFinish( SCROW beforeRow, SCROW lastRow, bool bFirstMatch );
+ void InitPosColFinish( SCCOL beforeCol, SCCOL lastCol, bool bFirstMatch );
void IncPos() { IncPosImpl<false>(); }
bool IncPosFast() { return IncPosImpl<true>(); }
void IncBlock() { IncPos(); } // Cannot skip entire block, not linear.
@@ -130,9 +131,9 @@ protected:
size_t sortedCachePosLast;
class SortedCacheIndexer;
- typedef std::pair<ScRefCellValue, SCROW> BinarySearchCellType;
- SortedCacheIndexer MakeBinarySearchIndexer(const sc::CellStoreType& rCells,
- SCROW nStartRow, SCROW nEndRow);
+ typedef std::pair<ScRefCellValue, SCCOLROW> BinarySearchCellType;
+ SortedCacheIndexer MakeBinarySearchIndexer(const sc::CellStoreType* pCells,
+ SCCOLROW nStartRow, SCCOLROW nEndRow);
};
// Data and functionality for specific types of query.
@@ -207,16 +208,16 @@ protected:
// and return if HandleItemFound() returns true.
void PerformQuery();
- /* Only works if no regular expression is involved, only searches for rows in one column,
- and only the first query entry is considered with simple conditions SC_LESS,SC_LESS_EQUAL,
- SC_EQUAL (sorted ascending) or SC_GREATER,SC_GREATER_EQUAL (sorted descending). It
- delivers a starting point set to nRow, i.e. the last row that either matches the searched
- for value, or the last row that matches the condition. Continue with e.g. GetThis() and
- GetNext() afterwards. Returns false if the searched for value is not in the search range
- or if the range is not properly sorted, with nRow in that case set to the first row or after
- the last row. In that case use GetFirst().
+ /* Only works if no regular expression is involved, only searches for rows in one column or
+ only searches for cols in one row, and only the first query entry is considered with simple
+ conditions SC_LESS,SC_LESS_EQUAL, SC_EQUAL (sorted ascending) or SC_GREATER,SC_GREATER_EQUAL
+ (sorted descending). It delivers a starting point set to nRow/nCol, i.e. the last row/col that
+ either matches the searched for value, or the last row/col that matches the condition.
+ Continue with e.g. GetThis() and GetNext() afterwards. Returns false if the searched for value
+ is not in the search range or if the range is not properly sorted, with nRow/nCol in that case
+ set to the first row or after the last row. In that case use GetFirst().
*/
- bool BinarySearch( SCCOL col, bool forEqual = false );
+ bool BinarySearch( SCCOLROW col_row, bool forEqual = false );
/** If set, iterator stops on first non-matching cell
content. May be used in SC_LESS_EQUAL queries where a
@@ -266,6 +267,7 @@ public:
void SetAdvanceQueryParamEntryField( bool bVal )
{ bAdvanceQuery = bVal; }
void AdvanceQueryParamEntryField();
+ void AdvanceQueryParamEntryFieldForBinarySearch();
void SetSortedBinarySearchMode( sal_Int8 nSearchMode )
{