LibreOffice Module sc (master)  1
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ScQueryCellIterator Class Reference

#include <dociter.hxx>

Collaboration diagram for ScQueryCellIterator:
[legend]

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
 
ScDocumentrDoc
 
const ScInterpreterContextmrContext
 
SCTAB nTab
 
SCCOL nCol
 
SCROW nRow
 
sal_uInt8 nStopOnMismatch
 
sal_uInt8 nTestEqualCondition
 
bool bAdvanceQuery
 
bool bIgnoreMismatchOnLeadingStrings
 

Detailed Description

Definition at line 252 of file dociter.hxx.

Member Typedef Documentation

typedef sc::CellStoreType::const_position_type ScQueryCellIterator::PositionType
private

Definition at line 270 of file dociter.hxx.

Member Enumeration Documentation

Enumerator
nStopOnMismatchDisabled 
nStopOnMismatchEnabled 
nStopOnMismatchOccurred 
nStopOnMismatchExecuted 

Definition at line 254 of file dociter.hxx.

Enumerator
nTestEqualConditionDisabled 
nTestEqualConditionEnabled 
nTestEqualConditionMatched 
nTestEqualConditionFulfilled 

Definition at line 262 of file dociter.hxx.

Constructor & Destructor Documentation

ScQueryCellIterator::ScQueryCellIterator ( ScDocument rDocument,
const ScInterpreterContext rContext,
SCTAB  nTable,
const ScQueryParam aParam,
bool  bMod 
)

Member Function Documentation

void ScQueryCellIterator::AdvanceQueryParamEntryField ( )
bool ScQueryCellIterator::BinarySearch ( )
private
bool ScQueryCellIterator::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.

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().

SCCOL ScQueryCellIterator::GetCol ( ) const
inline
bool ScQueryCellIterator::GetFirst ( )
bool ScQueryCellIterator::GetNext ( )
SCROW ScQueryCellIterator::GetRow ( ) const
inline
bool ScQueryCellIterator::GetThis ( )
private
void ScQueryCellIterator::IncBlock ( )
private

Definition at line 1099 of file dociter.cxx.

References maCurPos.

Referenced by GetThis(), and IncPos().

void ScQueryCellIterator::IncPos ( )
private

Definition at line 1086 of file dociter.cxx.

References IncBlock(), maCurPos, and nRow.

Referenced by GetNext(), and GetThis().

void ScQueryCellIterator::InitPos ( )
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().

bool ScQueryCellIterator::IsEqualConditionFulfilled ( ) const
inline

Definition at line 346 of file dociter.hxx.

References nTestEqualConditionFulfilled.

Referenced by FindEqualOrSortedLastInRange().

void ScQueryCellIterator::SetAdvanceQueryParamEntryField ( bool  bVal)
inline
void ScQueryCellIterator::SetStopOnMismatch ( bool  bVal)
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().

void ScQueryCellIterator::SetTestEqualCondition ( bool  bVal)
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().

bool ScQueryCellIterator::StoppedOnMismatch ( ) const
inline

Definition at line 332 of file dociter.hxx.

References nStopOnMismatchExecuted.

Referenced by FindEqualOrSortedLastInRange().

Member Data Documentation

bool ScQueryCellIterator::bAdvanceQuery
private

Definition at line 281 of file dociter.hxx.

Referenced by FindEqualOrSortedLastInRange(), and GetThis().

bool ScQueryCellIterator::bIgnoreMismatchOnLeadingStrings
private

Definition at line 282 of file dociter.hxx.

Referenced by BinarySearch(), FindEqualOrSortedLastInRange(), and GetThis().

PositionType ScQueryCellIterator::maCurPos
private
ScQueryParam ScQueryCellIterator::maParam
private
const ScInterpreterContext& ScQueryCellIterator::mrContext
private

Definition at line 275 of file dociter.hxx.

Referenced by BinarySearch(), GetThis(), and ScQueryCellIterator().

SCCOL ScQueryCellIterator::nCol
private

Definition at line 277 of file dociter.hxx.

Referenced by GetCol(), and GetThis().

SCROW ScQueryCellIterator::nRow
private

Definition at line 278 of file dociter.hxx.

Referenced by BinarySearch(), GetRow(), IncPos(), and InitPos().

sal_uInt8 ScQueryCellIterator::nStopOnMismatch
private

Definition at line 279 of file dociter.hxx.

Referenced by GetNext(), and GetThis().

SCTAB ScQueryCellIterator::nTab
private

Definition at line 276 of file dociter.hxx.

Referenced by BinarySearch(), GetFirst(), GetThis(), and InitPos().

sal_uInt8 ScQueryCellIterator::nTestEqualCondition
private

Definition at line 280 of file dociter.hxx.

Referenced by GetNext(), and GetThis().

ScDocument& ScQueryCellIterator::rDoc
private

The documentation for this class was generated from the following files: