LibreOffice Module sc (master)
1
|
#include <dociter.hxx>
Public Member Functions | |
ScQueryCellIterator (ScDocument &rDocument, const ScInterpreterContext &rContext, SCTAB nTable, const ScQueryParam &aParam, bool bMod) | |
bool | GetFirst () |
bool | GetNext () |
SCCOL | GetCol () const |
SCROW | GetRow () const |
void | SetAdvanceQueryParamEntryField (bool bVal) |
void | AdvanceQueryParamEntryField () |
void | SetStopOnMismatch (bool bVal) |
If set, iterator stops on first non-matching cell content. More... | |
bool | StoppedOnMismatch () const |
void | SetTestEqualCondition (bool bVal) |
If set, an additional test for SC_EQUAL condition is executed in ScTable::ValidQuery() if SC_LESS_EQUAL or SC_GREATER_EQUAL conditions are to be tested. More... | |
bool | IsEqualConditionFulfilled () const |
bool | FindEqualOrSortedLastInRange (SCCOL &nFoundCol, SCROW &nFoundRow) |
In a range assumed to be sorted find either the last of a sequence of equal entries or the last being less than (or greater than) the queried value. More... | |
Private Types | |
enum | StopOnMismatchBits { nStopOnMismatchDisabled = 0x00, nStopOnMismatchEnabled = 0x01, nStopOnMismatchOccurred = 0x02, nStopOnMismatchExecuted = nStopOnMismatchEnabled | nStopOnMismatchOccurred } |
enum | TestEqualConditionBits { nTestEqualConditionDisabled = 0x00, nTestEqualConditionEnabled = 0x01, nTestEqualConditionMatched = 0x02, nTestEqualConditionFulfilled = nTestEqualConditionEnabled | nTestEqualConditionMatched } |
typedef sc::CellStoreType::const_position_type | PositionType |
Private Member Functions | |
void | InitPos () |
Initialize position for new column. More... | |
void | IncPos () |
void | IncBlock () |
bool | GetThis () |
bool | BinarySearch () |
Private Attributes | |
PositionType | maCurPos |
ScQueryParam | maParam |
ScDocument & | rDoc |
const ScInterpreterContext & | mrContext |
SCTAB | nTab |
SCCOL | nCol |
SCROW | nRow |
sal_uInt8 | nStopOnMismatch |
sal_uInt8 | nTestEqualCondition |
bool | bAdvanceQuery |
bool | bIgnoreMismatchOnLeadingStrings |
Definition at line 252 of file dociter.hxx.
|
private |
Definition at line 270 of file dociter.hxx.
|
private |
Enumerator | |
---|---|
nStopOnMismatchDisabled | |
nStopOnMismatchEnabled | |
nStopOnMismatchOccurred | |
nStopOnMismatchExecuted |
Definition at line 254 of file dociter.hxx.
|
private |
Enumerator | |
---|---|
nTestEqualConditionDisabled | |
nTestEqualConditionEnabled | |
nTestEqualConditionMatched | |
nTestEqualConditionFulfilled |
Definition at line 262 of file dociter.hxx.
ScQueryCellIterator::ScQueryCellIterator | ( | ScDocument & | rDocument, |
const ScInterpreterContext & | rContext, | ||
SCTAB | nTable, | ||
const ScQueryParam & | aParam, | ||
bool | bMod | ||
) |
Definition at line 1048 of file dociter.cxx.
References ScQueryEntry::bDoQuery, ScQueryEntry::ByString, ScQueryEntry::ByValue, ScQueryParamBase::GetEntry(), ScQueryParamBase::GetEntryCount(), ScInterpreterContext::GetFormatTable(), ScQueryEntry::GetQueryItem(), svl::SharedString::getString(), i, SvNumberFormatter::IsNumberFormat(), maParam, ScQueryEntry::Item::maString, ScQueryEntry::Item::meType, ScQueryEntry::Item::mfVal, mrContext, mrContext, ScQueryParamTable::nCol1, nCount, nIndex, and ScQueryParamTable::nRow1.
void ScQueryCellIterator::AdvanceQueryParamEntryField | ( | ) |
Definition at line 1247 of file dociter.cxx.
References assert(), ScQueryEntry::bDoQuery, ScQueryParamBase::GetEntry(), ScQueryParamBase::GetEntryCount(), maParam, ScDocument::MaxCol(), ScQueryEntry::nField, and rDoc.
Referenced by GetThis().
|
private |
Definition at line 1797 of file dociter.cxx.
References assert(), aStr, ScQueryParamBase::bCaseSens, ScQueryParamBase::bHasHeader, bIgnoreMismatchOnLeadingStrings, ScQueryEntry::ByString, CELLTYPE_FORMULA, CELLTYPE_VALUE, CollatorWrapper::compareString(), sc::element_type_edittext, sc::element_type_string, ScQueryEntry::eOp, ScGlobal::GetCaseCollator(), ScGlobal::GetCollator(), ScQueryParamBase::GetEntry(), ScInterpreterContext::GetFormatTable(), ScCellFormat::GetInputString(), ScColumn::GetNumberFormat(), ScQueryEntry::GetQueryItem(), svl::SharedString::getString(), ScDocument::GetTableCount(), ScRefCellValue::getValue(), ScFormulaCell::GetValue(), ScRefCellValue::hasString(), i, ScColumn::IsEmptyData(), ScColumn::maCells, maCurPos, maParam, ScQueryEntry::Item::maString, ScDocument::maTabs, ScQueryEntry::Item::meType, ScRefCellValue::meType, ScQueryEntry::Item::mfVal, ScRefCellValue::mfValue, ScRefCellValue::mpFormula, mrContext, ScQueryParamTable::nCol1, nRow, ScQueryParamTable::nRow1, ScQueryParamTable::nRow2, nTab, rDoc, SC_EQUAL, SC_GREATER_EQUAL, SC_LESS_EQUAL, sc::toRefCell(), and u.
Referenced by FindEqualOrSortedLastInRange().
In a range assumed to be sorted find either the last of a sequence of equal entries or the last being less than (or greater than) the queried value.
Used by the interpreter for [HV]?LOOKUP() and MATCH(). Column and row position of the found entry are returned, otherwise invalid.
The search does not stop when encountering a string and does not assume that no values follow anymore. If querying for a string a mismatch on the first entry, e.g. column header, is ignored.
! StopOnMismatch, TestEqualCondition and the internal IgnoreMismatchOnLeadingStrings and query params are in an undefined state upon return! The iterator is not usable anymore except for obtaining the number format!
Definition at line 1267 of file dociter.cxx.
References assert(), bAdvanceQuery, ScQueryParamBase::bByRow, ScQueryEntry::bDoQuery, bIgnoreMismatchOnLeadingStrings, BinarySearch(), ScQueryEntry::ByString, ScQueryEntry::ByValue, ScQueryEntry::eOp, ScQueryParamBase::eSearchType, GetCol(), ScQueryParamBase::GetEntry(), ScQueryParamBase::GetEntryCount(), GetFirst(), GetNext(), ScQueryEntry::GetQueryItem(), GetRow(), GetThis(), IsEqualConditionFulfilled(), maCurPos, maParam, ScDocument::MaxCol(), ScDocument::MaxRow(), ScQueryParamBase::mbRangeLookup, ScQueryEntry::Item::meType, ScQueryEntry::nField, utl::SearchParam::Normal, rDoc, SC_EQUAL, SC_GREATER_EQUAL, SC_LESS_EQUAL, SetStopOnMismatch(), SetTestEqualCondition(), and StoppedOnMismatch().
Referenced by ScInterpreter::CalculateLookup(), lcl_LookupQuery(), and ScInterpreter::ScMatch().
|
inline |
Definition at line 308 of file dociter.hxx.
References nCol.
Referenced by ScInterpreter::CalculateLookup(), FindEqualOrSortedLastInRange(), ScInterpreter::IterateParametersIf(), ScInterpreter::IterateParametersIfs(), lcl_LookupQuery(), and ScInterpreter::ScMatch().
bool ScQueryCellIterator::GetFirst | ( | ) |
Definition at line 1229 of file dociter.cxx.
References assert(), ScDocument::GetTableCount(), GetThis(), InitPos(), maParam, ScQueryParamTable::nCol1, nTab, and rDoc.
Referenced by ScInterpreter::CalculateLookup(), FindEqualOrSortedLastInRange(), ScInterpreter::IterateParametersIf(), ScInterpreter::IterateParametersIfs(), lcl_LookupQuery(), ScInterpreter::ScDBCount(), and ScInterpreter::ScMatch().
bool ScQueryCellIterator::GetNext | ( | ) |
Definition at line 1237 of file dociter.cxx.
References GetThis(), IncPos(), nStopOnMismatch, nStopOnMismatchEnabled, nTestEqualCondition, and nTestEqualConditionEnabled.
Referenced by FindEqualOrSortedLastInRange(), ScInterpreter::IterateParametersIf(), ScInterpreter::IterateParametersIfs(), and ScInterpreter::ScDBCount().
|
inline |
Definition at line 309 of file dociter.hxx.
References nRow.
Referenced by FindEqualOrSortedLastInRange(), ScInterpreter::IterateParametersIf(), ScInterpreter::IterateParametersIfs(), and lcl_LookupQuery().
|
private |
Definition at line 1107 of file dociter.cxx.
References AdvanceQueryParamEntryField(), assert(), bAdvanceQuery, ScQueryParamBase::bByRow, ScQueryParamBase::bHasHeader, bIgnoreMismatchOnLeadingStrings, ScQueryEntry::ByString, sc::element_type_empty, ScQueryParamBase::GetEntry(), ScDocument::GetTableCount(), ScRefCellValue::hasString(), IncBlock(), IncPos(), InitPos(), maCurPos, maParam, ScDocument::maTabs, ScQueryEntry::Item::mbMatchEmpty, ScQueryEntry::Item::meType, mrContext, nCol, ScQueryParamTable::nCol1, ScQueryParamTable::nCol2, ScQueryParamTable::nRow1, ScQueryParamTable::nRow2, nStopOnMismatch, nStopOnMismatchOccurred, nTab, nTestEqualCondition, nTestEqualConditionMatched, rDoc, and sc::toRefCell().
Referenced by FindEqualOrSortedLastInRange(), GetFirst(), and GetNext().
|
private |
Definition at line 1099 of file dociter.cxx.
References maCurPos.
|
private |
Definition at line 1086 of file dociter.cxx.
References IncBlock(), maCurPos, and nRow.
|
private |
Initialize position for new column.
Definition at line 1077 of file dociter.cxx.
References ScQueryParamBase::bByRow, ScQueryParamBase::bHasHeader, ScColumn::maCells, maCurPos, maParam, ScDocument::maTabs, nRow, ScQueryParamTable::nRow1, nTab, and rDoc.
Referenced by GetFirst(), and GetThis().
|
inline |
Definition at line 346 of file dociter.hxx.
References nTestEqualConditionFulfilled.
Referenced by FindEqualOrSortedLastInRange().
|
inline |
Definition at line 313 of file dociter.hxx.
Referenced by ScInterpreter::CalculateLookup(), ScInterpreter::IterateParametersIf(), ScInterpreter::IterateParametersIfs(), and ScInterpreter::ScMatch().
|
inline |
If set, iterator stops on first non-matching cell content.
May be used in SC_LESS_EQUAL queries where a cell range is assumed to be sorted; stops on first value being greater than the queried value and GetFirst()/GetNext() return NULL. StoppedOnMismatch() returns true then. However, the iterator's conditions are not set to end all queries, GetCol() and GetRow() return values for the non-matching cell, further GetNext() calls may be executed.
Definition at line 327 of file dociter.hxx.
References nStopOnMismatchDisabled, and nStopOnMismatchEnabled.
Referenced by FindEqualOrSortedLastInRange().
|
inline |
If set, an additional test for SC_EQUAL condition is executed in ScTable::ValidQuery() if SC_LESS_EQUAL or SC_GREATER_EQUAL conditions are to be tested.
May be used where a cell range is assumed to be sorted to stop if an equal match is found.
Definition at line 340 of file dociter.hxx.
References nTestEqualConditionDisabled, and nTestEqualConditionEnabled.
Referenced by FindEqualOrSortedLastInRange().
|
inline |
Definition at line 332 of file dociter.hxx.
References nStopOnMismatchExecuted.
Referenced by FindEqualOrSortedLastInRange().
|
private |
Definition at line 281 of file dociter.hxx.
Referenced by FindEqualOrSortedLastInRange(), and GetThis().
|
private |
Definition at line 282 of file dociter.hxx.
Referenced by BinarySearch(), FindEqualOrSortedLastInRange(), and GetThis().
|
private |
Definition at line 271 of file dociter.hxx.
Referenced by BinarySearch(), FindEqualOrSortedLastInRange(), GetThis(), IncBlock(), IncPos(), and InitPos().
|
private |
Definition at line 273 of file dociter.hxx.
Referenced by AdvanceQueryParamEntryField(), BinarySearch(), FindEqualOrSortedLastInRange(), GetFirst(), GetThis(), InitPos(), and ScQueryCellIterator().
|
private |
Definition at line 275 of file dociter.hxx.
Referenced by BinarySearch(), GetThis(), and ScQueryCellIterator().
|
private |
Definition at line 277 of file dociter.hxx.
|
private |
Definition at line 278 of file dociter.hxx.
Referenced by BinarySearch(), GetRow(), IncPos(), and InitPos().
|
private |
Definition at line 279 of file dociter.hxx.
|
private |
Definition at line 276 of file dociter.hxx.
Referenced by BinarySearch(), GetFirst(), GetThis(), and InitPos().
|
private |
Definition at line 280 of file dociter.hxx.
|
private |
Definition at line 274 of file dociter.hxx.
Referenced by AdvanceQueryParamEntryField(), BinarySearch(), FindEqualOrSortedLastInRange(), GetFirst(), GetThis(), and InitPos().