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 50 of file dpfilteredcache.hxx.

Member Typedef Documentation

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

Definition at line 52 of file dpfilteredcache.hxx.

Constructor & Destructor Documentation

ScDPFilteredCache::ScDPFilteredCache ( const ScDPCache rCache)

Definition at line 78 of file dpfilteredcache.cxx.

ScDPFilteredCache::~ScDPFilteredCache ( )

Definition at line 83 of file dpfilteredcache.cxx.

ScDPFilteredCache::ScDPFilteredCache ( const ScDPFilteredCache )
privatedelete

Member Function Documentation

void ScDPFilteredCache::clear ( )
void ScDPFilteredCache::dump ( ) const
static void ScDPFilteredCache::dumpRowFlag ( const RowFlagType rFlag)
static
bool ScDPFilteredCache::empty ( ) const
void ScDPFilteredCache::fillTable ( const ScQueryParam rQuery,
bool  bIgnoreEmptyRows,
bool  bRepeatIfEmpty 
)
void ScDPFilteredCache::fillTable ( )
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 234 of file dpfilteredcache.cxx.

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

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

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 292 of file dpfilteredcache.cxx.

References Any, any, getCell(), getColSize(), getFieldName(), getRowSize(), ScDPItemData::GetString(), ScDPItemData::GetValue(), i, isRowActive(), isRowQualified(), ScDPItemData::IsValue(), nTabSize, and pData.

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

const ScDPCache& ScDPFilteredCache::getCache ( ) const
inline
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 257 of file dpfilteredcache.cxx.

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

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

sal_Int32 ScDPFilteredCache::getColSize ( ) const
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 281 of file dpfilteredcache.cxx.

References maFieldEntries, and o3tl::make_unsigned().

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

OUString ScDPFilteredCache::getFieldName ( SCCOL  nIndex) const
sal_Int32 ScDPFilteredCache::getRowSize ( ) const
void ScDPFilteredCache::getValue ( ScDPValue rVal,
SCCOL  nCol,
SCROW  nRow 
) const
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 218 of file dpfilteredcache.cxx.

References maShowByFilter, maShowByPage, and MAXROW.

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

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 369 of file dpfilteredcache.cxx.

References getCell(), and getColSize().

Referenced by filterByPageDimension(), and filterTable().

Member Data Documentation

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

unique field entries for each field (column).

Definition at line 166 of file dpfilteredcache.hxx.

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

RowFlagType ScDPFilteredCache::maShowByFilter
private

Rows visible by standard filter query.

Definition at line 169 of file dpfilteredcache.hxx.

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

RowFlagType ScDPFilteredCache::maShowByPage
private

Rows visible by page dimension filtering.

Definition at line 171 of file dpfilteredcache.hxx.

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

const ScDPCache& ScDPFilteredCache::mrCache
private

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