LibreOffice Module sc (master) 1
|
Sorted cache for one range used with interpreter functions such as VLOOKUP and MATCH. More...
#include <rangecache.hxx>
Classes | |
struct | Hash |
struct | HashKey |
Public Types | |
enum class | ValueType { Values , StringsCaseSensitive , StringsCaseInsensitive } |
Public Member Functions | |
ScSortedRangeCache (ScDocument *pDoc, const ScRange &rRange, const ScQueryParam ¶m, ScInterpreterContext *context, bool invalid=false) | |
MUST be new'd because Notify() deletes. More... | |
bool | isValid () const |
Returns if the cache is usable. More... | |
virtual void | Notify (const SfxHint &rHint) override |
Remove from document structure and delete (!) cache on modify hint. More... | |
const ScRange & | getRange () const |
HashKey | getHashKey () const |
const std::vector< SCROW > & | sortedRows () const |
size_t | size () const |
size_t | indexForRow (SCROW row) const |
SCROW | rowForIndex (size_t index) const |
Public Member Functions inherited from SvtListener | |
SvtListener ()=default | |
SvtListener (const SvtListener &r)=default | |
virtual | ~SvtListener () COVERITY_NOEXCEPT_FALSE |
bool | StartListening (SvtBroadcaster &rBroadcaster) |
void | EndListening (SvtBroadcaster &rBroadcaster) |
void | EndListeningAll () |
void | CopyAllBroadcasters (const SvtListener &r) |
bool | HasBroadcaster () const |
virtual void | Notify (const SfxHint &rHint) |
virtual void | Query (QueryBase &rQuery) const |
Static Public Member Functions | |
static HashKey | makeHashKey (const ScRange &range, const ScQueryParam ¶m) |
Private Member Functions | |
ScSortedRangeCache (const ScSortedRangeCache &)=delete | |
ScSortedRangeCache & | operator= (const ScSortedRangeCache &)=delete |
Private Attributes | |
std::vector< SCROW > | mSortedRows |
std::vector< size_t > | mRowToIndex |
ScRange | maRange |
ScDocument * | mpDoc |
bool | mValid |
ValueType | mValueType |
ScQueryOp | mQueryOp |
ScQueryEntry::QueryType | mQueryType |
Sorted cache for one range used with interpreter functions such as VLOOKUP and MATCH.
Caches sorted order for cells in the given range, which must be one column. This allows faster lookups when cells are not sorted.
The class has a vector of SCROW items, which is sorted according to values of those cells. Therefore e.g. binary search of those cells can be done by doing binary search of the vector while mapping the indexes to rows.
Definition at line 44 of file rangecache.hxx.
|
strong |
Enumerator | |
---|---|
Values | |
StringsCaseSensitive | |
StringsCaseInsensitive |
Definition at line 59 of file rangecache.hxx.
ScSortedRangeCache::ScSortedRangeCache | ( | ScDocument * | pDoc, |
const ScRange & | rRange, | ||
const ScQueryParam & | param, | ||
ScInterpreterContext * | context, | ||
bool | invalid = false |
||
) |
MUST be new'd because Notify() deletes.
Definition at line 52 of file rangecache.cxx.
References ScRange::aEnd, ScRange::aStart, ScQueryEntry::bDoQuery, ScQueryEntry::ByString, ScAddress::Col(), d, ScQueryEntry::eOp, ScDocument::FetchTable(), ScQueryEvaluator::getCellString(), ScGlobal::GetCollator(), ScQueryParamBase::GetEntry(), ScInterpreterContext::GetFormatTable(), ScQueryEntry::GetQueryItem(), ScQueryEntry::GetQueryItems(), ScDocument::GetRefCellValue(), svl::SharedString::getString(), ScRefCellValue::getString(), ScRefCellValue::getValue(), i, invalid, ScQueryEvaluator::isMatchWholeCell(), SvNumberFormatter::IsNumberFormat(), ScQueryEvaluator::isQueryByString(), ScQueryEvaluator::isQueryByValue(), maRange, maRange, ScQueryEntry::Item::mbMatchEmpty, ScQueryEntry::Item::meType, mQueryOp, mQueryType, mRowToIndex, mSortedRows, mValid, mValueType, needsDescending(), ScAddress::Row(), ScDocument::ShrinkToDataArea(), StringsCaseSensitive, ScAddress::Tab(), value, and Values.
|
privatedelete |
|
inline |
Definition at line 77 of file rangecache.hxx.
References maRange, mQueryOp, mQueryType, and mValueType.
Referenced by ScDocument::RemoveSortedRangeCache().
|
inline |
Definition at line 57 of file rangecache.hxx.
References maRange.
|
inline |
Definition at line 95 of file rangecache.hxx.
References ScRange::aEnd, ScRange::aStart, maRange, mRowToIndex, mSortedRows, and ScAddress::Row().
|
inline |
Returns if the cache is usable.
Definition at line 52 of file rangecache.hxx.
References mValid.
Referenced by CanBeUsedForSorterCache().
|
static |
Definition at line 188 of file rangecache.cxx.
References ScQueryEntry::bDoQuery, ScQueryEntry::eOp, ScQueryParamBase::GetEntry(), ScQueryEntry::GetQueryItem(), ScQueryEntry::GetQueryItems(), ScQueryEntry::Item::meType, and toValueType().
Referenced by ScDocument::GetSortedRangeCache().
|
overridevirtual |
Remove from document structure and delete (!) cache on modify hint.
Reimplemented from SvtListener.
Definition at line 176 of file rangecache.cxx.
References SfxHint::GetId(), ScDocument::IsInDtorClear(), mpDoc, and ScDocument::RemoveSortedRangeCache().
|
privatedelete |
|
inline |
Definition at line 101 of file rangecache.hxx.
References index, and mSortedRows.
|
inline |
Definition at line 94 of file rangecache.hxx.
References mSortedRows.
|
inline |
Definition at line 93 of file rangecache.hxx.
References mSortedRows.
|
private |
Definition at line 107 of file rangecache.hxx.
Referenced by getHashKey(), getRange(), indexForRow(), and ScSortedRangeCache().
|
private |
Definition at line 108 of file rangecache.hxx.
Referenced by Notify().
|
private |
Definition at line 111 of file rangecache.hxx.
Referenced by getHashKey(), and ScSortedRangeCache().
|
private |
Definition at line 112 of file rangecache.hxx.
Referenced by getHashKey(), and ScSortedRangeCache().
|
private |
Definition at line 106 of file rangecache.hxx.
Referenced by indexForRow(), and ScSortedRangeCache().
|
private |
Definition at line 105 of file rangecache.hxx.
Referenced by indexForRow(), rowForIndex(), ScSortedRangeCache(), size(), and sortedRows().
|
private |
Definition at line 109 of file rangecache.hxx.
Referenced by isValid(), and ScSortedRangeCache().
|
private |
Definition at line 110 of file rangecache.hxx.
Referenced by getHashKey(), and ScSortedRangeCache().