LibreOffice Module sc (master)
1
|
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>
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 ScDPCache & | getCache () 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 ScDPItemData * | getCell (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 ScDPCache & | mrCache |
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.
|
private |
Definition at line 52 of file dpfilteredcache.hxx.
ScDPFilteredCache::ScDPFilteredCache | ( | const ScDPCache & | rCache | ) |
Definition at line 78 of file dpfilteredcache.cxx.
ScDPFilteredCache::~ScDPFilteredCache | ( | ) |
Definition at line 83 of file dpfilteredcache.cxx.
|
privatedelete |
void ScDPFilteredCache::clear | ( | ) |
Definition at line 357 of file dpfilteredcache.cxx.
References maFieldEntries, maShowByFilter, and maShowByPage.
Referenced by ScDatabaseDPData::DisposeData(), ScSheetDPData::DisposeData(), ScDatabaseDPData::ReloadCacheTable(), and ScSheetDPData::ReloadCacheTable().
void ScDPFilteredCache::dump | ( | ) | const |
|
static |
bool ScDPFilteredCache::empty | ( | ) | const |
Definition at line 364 of file dpfilteredcache.cxx.
References maFieldEntries.
Referenced by ScDatabaseDPData::CreateCacheTable(), and ScSheetDPData::CreateCacheTable().
void ScDPFilteredCache::fillTable | ( | const ScQueryParam & | rQuery, |
bool | bIgnoreEmptyRows, | ||
bool | bRepeatIfEmpty | ||
) |
Definition at line 97 of file dpfilteredcache.cxx.
References getCache(), getColSize(), ScDPCache::GetDataSize(), ScDPCache::GetDimMemberCount(), ScDPCache::GetItemDataId(), getRowSize(), maFieldEntries, maShowByFilter, maShowByPage, mrCache, and nIndex.
Referenced by ScDatabaseDPData::CreateCacheTable(), and ScSheetDPData::CreateCacheTable().
void ScDPFilteredCache::fillTable | ( | ) |
Definition at line 177 of file dpfilteredcache.cxx.
References getCache(), getColSize(), ScDPCache::GetDimMemberCount(), ScDPCache::GetItemDataId(), getRowSize(), maFieldEntries, maShowByFilter, maShowByPage, and nIndex.
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().
|
inline |
Definition at line 109 of file dpfilteredcache.hxx.
References mrCache.
Referenced by ScDPGroupTableData::FillGroupValues(), ScDPTableData::FillRowDataFromCacheTable(), fillTable(), ScDPGroupDimension::GetColumnEntries(), ScDPTableData::GetFormattedString(), ScDPTableData::GetItemData(), ScDPTableData::GetMemberById(), ScDPTableData::GetMemberByIndex(), ScSheetDPData::GetNumberFormat(), ScSheetDPData::IsDateDimension(), and ScDPGroupTableData::ModifyFilterCriteria().
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 |
Definition at line 92 of file dpfilteredcache.cxx.
References ScDPCache::GetColumnCount(), and mrCache.
Referenced by fillTable(), filterTable(), ScDatabaseDPData::GetColumnCount(), ScSheetDPData::GetColumnCount(), ScSheetDPData::getDimensionName(), ScSheetDPData::getIsDataLayoutDimension(), ScSheetDPData::IsDateDimension(), and isRowQualified().
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 |
Definition at line 276 of file dpfilteredcache.cxx.
References ScDPCache::GetDimensionName(), and mrCache.
Referenced by filterTable(), ScDatabaseDPData::getDimensionName(), and ScSheetDPData::getDimensionName().
sal_Int32 ScDPFilteredCache::getRowSize | ( | ) | const |
Definition at line 87 of file dpfilteredcache.cxx.
References ScDPCache::GetRowCount(), and mrCache.
Referenced by ScDPGroupTableData::CalcResults(), ScDPTableData::CalcResultsFromCacheTable(), fillTable(), filterByPageDimension(), filterTable(), ScDatabaseDPData::GetDrillDownData(), and ScSheetDPData::GetDrillDownData().
Definition at line 263 of file dpfilteredcache.cxx.
References ScDPValue::Empty, getCell(), ScDPItemData::GetCellType(), ScDPItemData::GetValue(), ScDPItemData::IsValue(), ScDPValue::meType, ScDPValue::mfValue, pData, and ScDPValue::Set().
Referenced by ScDPTableData::FillRowDataFromCacheTable().
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().
|
private |
Check if a given row meets all specified criteria.
nRow | index of row to be tested. |
rCriteria | a list of criteria |
Definition at line 369 of file dpfilteredcache.cxx.
References getCell(), and getColSize().
Referenced by filterByPageDimension(), and filterTable().
|
private |
unique field entries for each field (column).
Definition at line 166 of file dpfilteredcache.hxx.
Referenced by clear(), empty(), fillTable(), and getFieldEntries().
|
private |
Rows visible by standard filter query.
Definition at line 169 of file dpfilteredcache.hxx.
Referenced by clear(), fillTable(), and isRowActive().
|
private |
Rows visible by page dimension filtering.
Definition at line 171 of file dpfilteredcache.hxx.
Referenced by clear(), fillTable(), filterByPageDimension(), and isRowActive().
|
private |
Definition at line 173 of file dpfilteredcache.hxx.
Referenced by fillTable(), filterByPageDimension(), getCache(), getCell(), getColSize(), getFieldName(), and getRowSize().