LibreOffice Module sc (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ScExternalRefCache::Table Class Reference

Represents a single cached table in an external document. More...

#include <externalrefmgr.hxx>

Collaboration diagram for ScExternalRefCache::Table:
[legend]

Public Member Functions

 Table ()
 
 ~Table ()
 
void clear ()
 
SC_DLLPUBLIC void setCell (SCCOL nCol, SCROW nRow, TokenRef const &pToken, sal_uLong nFmtIndex=0, bool bSetCacheRange=true)
 Add cell value to the cache. More...
 
SC_DLLPUBLIC TokenRef getCell (SCCOL nCol, SCROW nRow, sal_uInt32 *pnFmtIndex=nullptr) const
 
bool hasRow (SCROW nRow) const
 
void setReferenced (bool bReferenced)
 Set/clear referenced status flag only if current status is not REFERENCED_PERMANENT. More...
 
bool isReferenced () const
 
void getAllRows (::std::vector< SCROW > &rRows, SCROW nLow, SCROW nHigh) const
 Obtain a sorted vector of rows. More...
 
void getAllRows (::std::vector< SCROW > &rRows) const
 
SC_DLLPUBLIC ::std::pair< SCROW, SCROWgetRowRange () const
 Returns the half-open range of used rows in this table. Returns [0,0) if table is empty. More...
 
void getAllCols (SCROW nRow, ::std::vector< SCCOL > &rCols, SCCOL nLow, SCCOL nHigh) const
 Obtain a sorted vector of columns. More...
 
void getAllCols (SCROW nRow, ::std::vector< SCCOL > &rCols) const
 
SC_DLLPUBLIC ::std::pair< SCCOL, SCCOLgetColRange (SCROW nRow) const
 Returns the half-open range of used columns in the specified row. Returns [0,0) if row is empty. More...
 
void getAllNumberFormats (::std::vector< sal_uInt32 > &rNumFmts) const
 
bool isRangeCached (SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
 
void setCachedCell (SCCOL nCol, SCROW nRow)
 
void setCachedCellRange (SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
 
SC_DLLPUBLIC void setWholeTableCached ()
 Call this to mark the entire table "cached". More...
 
template<typename P >
void getAllRows (vector< SCROW > &rRows, P predicate) const
 
template<typename P >
void getAllCols (SCROW nRow, vector< SCCOL > &rCols, P predicate) const
 

Private Member Functions

bool isInCachedRanges (SCCOL nCol, SCROW nRow) const
 
TokenRef getEmptyOrNullToken (SCCOL nCol, SCROW nRow) const
 
template<typename P >
void getAllRows (::std::vector< SCROW > &rRows, P predicate) const
 
template<typename P >
void getAllCols (SCROW nRow, ::std::vector< SCCOL > &rCols, P predicate) const
 

Private Attributes

RowsDataType maRows
 Data cache. More...
 
ScRangeList maCachedRanges
 Collection of individual cached ranges. More...
 
bool mbReferenced
 

Detailed Description

Represents a single cached table in an external document.

It only stores non-empty cells; empty cells should never be stored in the data cache. Instead, cached ranges should be used to determine whether or not a cell is empty or needs fetching from the source document. If a cell's value is not stored but its address is within the cached ranges, that cell is already queried in the source document and we know it's empty.

Definition at line 124 of file externalrefmgr.hxx.

Constructor & Destructor Documentation

◆ Table()

ScExternalRefCache::Table::Table ( )

Definition at line 250 of file externalrefmgr.cxx.

◆ ~Table()

ScExternalRefCache::Table::~Table ( )

Definition at line 256 of file externalrefmgr.cxx.

Member Function Documentation

◆ clear()

void ScExternalRefCache::Table::clear ( )

Definition at line 260 of file externalrefmgr.cxx.

◆ getAllCols() [1/4]

void ScExternalRefCache::Table::getAllCols ( SCROW  nRow,
::std::vector< SCCOL > &  rCols 
) const

◆ getAllCols() [2/4]

template<typename P >
void ScExternalRefCache::Table::getAllCols ( SCROW  nRow,
::std::vector< SCCOL > &  rCols,
predicate 
) const
private

◆ getAllCols() [3/4]

void ScExternalRefCache::Table::getAllCols ( SCROW  nRow,
::std::vector< SCCOL > &  rCols,
SCCOL  nLow,
SCCOL  nHigh 
) const

Obtain a sorted vector of columns.

◆ getAllCols() [4/4]

template<typename P >
void ScExternalRefCache::Table::getAllCols ( SCROW  nRow,
vector< SCCOL > &  rCols,
predicate 
) const

Definition at line 374 of file externalrefmgr.cxx.

◆ getAllNumberFormats()

void ScExternalRefCache::Table::getAllNumberFormats ( ::std::vector< sal_uInt32 > &  rNumFmts) const

Definition at line 425 of file externalrefmgr.cxx.

References ScExternalRefCache::Cell::mnFmtIndex.

◆ getAllRows() [1/4]

void ScExternalRefCache::Table::getAllRows ( ::std::vector< SCROW > &  rRows) const

◆ getAllRows() [2/4]

template<typename P >
void ScExternalRefCache::Table::getAllRows ( ::std::vector< SCROW > &  rRows,
predicate 
) const
private

◆ getAllRows() [3/4]

void ScExternalRefCache::Table::getAllRows ( ::std::vector< SCROW > &  rRows,
SCROW  nLow,
SCROW  nHigh 
) const

Obtain a sorted vector of rows.

◆ getAllRows() [4/4]

template<typename P >
void ScExternalRefCache::Table::getAllRows ( vector< SCROW > &  rRows,
predicate 
) const

Definition at line 335 of file externalrefmgr.cxx.

◆ getCell()

ScExternalRefCache::TokenRef ScExternalRefCache::Table::getCell ( SCCOL  nCol,
SCROW  nRow,
sal_uInt32 *  pnFmtIndex = nullptr 
) const

◆ getColRange()

std::pair< SCCOL, SCCOL > ScExternalRefCache::Table::getColRange ( SCROW  nRow) const

Returns the half-open range of used columns in the specified row. Returns [0,0) if row is empty.

Definition at line 404 of file externalrefmgr.cxx.

References a.

◆ getEmptyOrNullToken()

ScExternalRefCache::TokenRef ScExternalRefCache::Table::getEmptyOrNullToken ( SCCOL  nCol,
SCROW  nRow 
) const
private

Definition at line 464 of file externalrefmgr.cxx.

References p.

◆ getRowRange()

std::pair< SCROW, SCROW > ScExternalRefCache::Table::getRowRange ( ) const

Returns the half-open range of used rows in this table. Returns [0,0) if table is empty.

Definition at line 359 of file externalrefmgr.cxx.

References a.

◆ hasRow()

bool ScExternalRefCache::Table::hasRow ( SCROW  nRow) const

Definition at line 328 of file externalrefmgr.cxx.

◆ isInCachedRanges()

bool ScExternalRefCache::Table::isInCachedRanges ( SCCOL  nCol,
SCROW  nRow 
) const
private

Definition at line 459 of file externalrefmgr.cxx.

◆ isRangeCached()

bool ScExternalRefCache::Table::isRangeCached ( SCCOL  nCol1,
SCROW  nRow1,
SCCOL  nCol2,
SCROW  nRow2 
) const

Definition at line 438 of file externalrefmgr.cxx.

◆ isReferenced()

bool ScExternalRefCache::Table::isReferenced ( ) const

Definition at line 272 of file externalrefmgr.cxx.

◆ setCachedCell()

void ScExternalRefCache::Table::setCachedCell ( SCCOL  nCol,
SCROW  nRow 
)

Definition at line 443 of file externalrefmgr.cxx.

◆ setCachedCellRange()

void ScExternalRefCache::Table::setCachedCellRange ( SCCOL  nCol1,
SCROW  nRow1,
SCCOL  nCol2,
SCROW  nRow2 
)

Definition at line 448 of file externalrefmgr.cxx.

◆ setCell()

void ScExternalRefCache::Table::setCell ( SCCOL  nCol,
SCROW  nRow,
TokenRef const &  pToken,
sal_uLong  nFmtIndex = 0,
bool  bSetCacheRange = true 
)

Add cell value to the cache.

Parameters
bSetCacheRangeif true, mark this cell 'cached'. This is false only when adding a range of cell values, for performance reasons.

Definition at line 277 of file externalrefmgr.cxx.

References ScExternalRefCache::Cell::mnFmtIndex, and ScExternalRefCache::Cell::mxToken.

◆ setReferenced()

void ScExternalRefCache::Table::setReferenced ( bool  bReferenced)

Set/clear referenced status flag only if current status is not REFERENCED_PERMANENT.

Definition at line 267 of file externalrefmgr.cxx.

◆ setWholeTableCached()

void ScExternalRefCache::Table::setWholeTableCached ( )

Call this to mark the entire table "cached".

This will prevent all future attempts to access the source document even when non-cached cells are queried. In such case, non-cached cells are treated as empty cells. Useful when loading a document with own external data cache.

Definition at line 454 of file externalrefmgr.cxx.

References MAXCOL, and MAXROW.

Member Data Documentation

◆ maCachedRanges

ScRangeList ScExternalRefCache::Table::maCachedRanges
private

Collection of individual cached ranges.

The table ranges are not used & always zero.

Definition at line 184 of file externalrefmgr.hxx.

◆ maRows

RowsDataType ScExternalRefCache::Table::maRows
private

Data cache.

Definition at line 181 of file externalrefmgr.hxx.

◆ mbReferenced

bool ScExternalRefCache::Table::mbReferenced
private

Definition at line 185 of file externalrefmgr.hxx.


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