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

This class is only a wrapper to the actual cache, to provide filtering on the raw data based on the query filter and/or page field filters. More...

#include <dpfilteredcache.hxx>

Collaboration diagram for ScDPFilteredCache:
[legend]

Classes

struct  Criterion
 single filtering criterion. More...
 
class  FilterBase
 interface class used for filtering of rows. More...
 
class  GroupFilter
 multi-item (group) filter. More...
 
class  SingleFilter
 ordinary single-item filter. More...
 

Public Member Functions

 ScDPFilteredCache (const ScDPCache &rCache)
 
 ~ScDPFilteredCache ()
 
sal_Int32 getRowSize () const
 
sal_Int32 getColSize () const
 
const ScDPCachegetCache () const
 
void fillTable (const ScQueryParam &rQuery, bool bIgnoreEmptyRows, bool bRepeatIfEmpty)
 
void fillTable ()
 
bool isRowActive (sal_Int32 nRow, sal_Int32 *pLastRow=nullptr) const
 Check whether a specified row is active or not. More...
 
void filterByPageDimension (const std::vector< Criterion > &rCriteria, const std::unordered_set< sal_Int32 > &rRepeatIfEmptyDims)
 Set filter on/off flag to each row to control visibility. More...
 
const ScDPItemDatagetCell (SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const
 Get the cell instance at specified location within the data grid. More...
 
void getValue (ScDPValue &rVal, SCCOL nCol, SCROW nRow) const
 
OUString getFieldName (SCCOL nIndex) const
 
const ::std::vector< SCROW > & getFieldEntries (sal_Int32 nColumn) const
 Get the unique entries for a field specified by index. More...
 
void filterTable (const std::vector< Criterion > &rCriteria, css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &rTabData, const std::unordered_set< sal_Int32 > &rRepeatIfEmptyDims)
 Filter the table based on the specified criteria, and copy the result to rTabData. More...
 
void clear ()
 
bool empty () const
 
void dump () const
 

Static Public Member Functions

static void dumpRowFlag (const RowFlagType &rFlag)
 

Private Types

typedef mdds::flat_segment_tree< SCROW, bool > RowFlagType
 

Private Member Functions

 ScDPFilteredCache (const ScDPFilteredCache &)=delete
 
bool isRowQualified (sal_Int32 nRow, const ::std::vector< Criterion > &rCriteria, const std::unordered_set< sal_Int32 > &rRepeatIfEmptyDims) const
 Check if a given row meets all specified criteria. More...
 

Private Attributes

::std::vector<::std::vector< SCROW > > maFieldEntries
 unique field entries for each field (column). More...
 
RowFlagType maShowByFilter
 Rows visible by standard filter query. More...
 
RowFlagType maShowByPage
 Rows visible by page dimension filtering. More...
 
const ScDPCachemrCache
 

Detailed Description

This class is only a wrapper to the actual cache, to provide filtering on the raw data based on the query filter and/or page field filters.

Definition at line 49 of file dpfilteredcache.hxx.

Member Typedef Documentation

◆ RowFlagType

typedef mdds::flat_segment_tree<SCROW, bool> ScDPFilteredCache::RowFlagType
private

Definition at line 51 of file dpfilteredcache.hxx.

Constructor & Destructor Documentation

◆ ScDPFilteredCache() [1/2]

ScDPFilteredCache::ScDPFilteredCache ( const ScDPCache rCache)

Definition at line 76 of file dpfilteredcache.cxx.

◆ ~ScDPFilteredCache()

ScDPFilteredCache::~ScDPFilteredCache ( )

Definition at line 81 of file dpfilteredcache.cxx.

◆ ScDPFilteredCache() [2/2]

ScDPFilteredCache::ScDPFilteredCache ( const ScDPFilteredCache )
privatedelete

Member Function Documentation

◆ clear()

void ScDPFilteredCache::clear ( )

◆ dump()

void ScDPFilteredCache::dump ( ) const

◆ dumpRowFlag()

static void ScDPFilteredCache::dumpRowFlag ( const RowFlagType rFlag)
static

◆ empty()

bool ScDPFilteredCache::empty ( ) const

◆ fillTable() [1/2]

void ScDPFilteredCache::fillTable ( )

◆ fillTable() [2/2]

void ScDPFilteredCache::fillTable ( const ScQueryParam rQuery,
bool  bIgnoreEmptyRows,
bool  bRepeatIfEmpty 
)

◆ filterByPageDimension()

void ScDPFilteredCache::filterByPageDimension ( const std::vector< Criterion > &  rCriteria,
const std::unordered_set< sal_Int32 > &  rRepeatIfEmptyDims 
)

Set filter on/off flag to each row to control visibility.

The caller must ensure that the table is filled before calling this function.

Definition at line 232 of file dpfilteredcache.cxx.

References ScDPCache::GetDataSize(), getRowSize(), isRowQualified(), maShowByPage, and mrCache.

Referenced by ScSheetDPData::FilterCacheTable(), and ScDatabaseDPData::FilterCacheTable().

◆ filterTable()

void ScDPFilteredCache::filterTable ( const std::vector< Criterion > &  rCriteria,
css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &  rTabData,
const std::unordered_set< sal_Int32 > &  rRepeatIfEmptyDims 
)

Filter the table based on the specified criteria, and copy the result to rTabData.

This method is used, for example, to generate a drill-down data table.

Definition at line 290 of file dpfilteredcache.cxx.

References any, Any, getCell(), getColSize(), getFieldName(), getRowSize(), i, isRowActive(), isRowQualified(), nTabSize, and pData.

Referenced by ScDatabaseDPData::GetDrillDownData(), and ScSheetDPData::GetDrillDownData().

◆ getCache()

const ScDPCache & ScDPFilteredCache::getCache ( ) const
inline

◆ getCell()

const ScDPItemData * ScDPFilteredCache::getCell ( SCCOL  nCol,
SCROW  nRow,
bool  bRepeatIfEmpty 
) const

Get the cell instance at specified location within the data grid.

Note that the data grid doesn't include the header row. Don't delete the returned object!

Definition at line 255 of file dpfilteredcache.cxx.

References ScDPCache::GetItemDataById(), ScDPCache::GetItemDataId(), mrCache, and nId.

Referenced by filterTable(), getValue(), and isRowQualified().

◆ getColSize()

sal_Int32 ScDPFilteredCache::getColSize ( ) const

◆ getFieldEntries()

const ::std::vector< SCROW > & ScDPFilteredCache::getFieldEntries ( sal_Int32  nColumn) const

Get the unique entries for a field specified by index.

The caller must make sure that the table is filled before calling function, or it will get an empty collection.

Definition at line 279 of file dpfilteredcache.cxx.

References maFieldEntries, and o3tl::make_unsigned().

Referenced by ScDPTableData::GetColumnEntries(), ScDPTableData::GetMemberByIndex(), and ScDPTableData::GetMembersCount().

◆ getFieldName()

OUString ScDPFilteredCache::getFieldName ( SCCOL  nIndex) const

◆ getRowSize()

sal_Int32 ScDPFilteredCache::getRowSize ( ) const

◆ getValue()

void ScDPFilteredCache::getValue ( ScDPValue rVal,
SCCOL  nCol,
SCROW  nRow 
) const

◆ isRowActive()

bool ScDPFilteredCache::isRowActive ( sal_Int32  nRow,
sal_Int32 *  pLastRow = nullptr 
) const

Check whether a specified row is active or not.

When a row is active, it is used in calculation of the results data. A row becomes inactive when it is filtered out by page field.

Definition at line 216 of file dpfilteredcache.cxx.

References maShowByFilter, maShowByPage, and MAXROW.

Referenced by ScDPGroupTableData::CalcResults(), ScDPTableData::CalcResultsFromCacheTable(), and filterTable().

◆ isRowQualified()

bool ScDPFilteredCache::isRowQualified ( sal_Int32  nRow,
const ::std::vector< Criterion > &  rCriteria,
const std::unordered_set< sal_Int32 > &  rRepeatIfEmptyDims 
) const
private

Check if a given row meets all specified criteria.

Parameters
nRowindex of row to be tested.
rCriteriaa list of criteria

Definition at line 370 of file dpfilteredcache.cxx.

References getCell(), and getColSize().

Referenced by filterByPageDimension(), and filterTable().

Member Data Documentation

◆ maFieldEntries

::std::vector<::std::vector<SCROW> > ScDPFilteredCache::maFieldEntries
private

unique field entries for each field (column).

Definition at line 165 of file dpfilteredcache.hxx.

Referenced by clear(), empty(), fillTable(), and getFieldEntries().

◆ maShowByFilter

RowFlagType ScDPFilteredCache::maShowByFilter
private

Rows visible by standard filter query.

Definition at line 168 of file dpfilteredcache.hxx.

Referenced by clear(), fillTable(), and isRowActive().

◆ maShowByPage

RowFlagType ScDPFilteredCache::maShowByPage
private

Rows visible by page dimension filtering.

Definition at line 170 of file dpfilteredcache.hxx.

Referenced by clear(), fillTable(), filterByPageDimension(), and isRowActive().

◆ mrCache

const ScDPCache& ScDPFilteredCache::mrCache
private

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