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

Cache table for external reference data. More...

#include <externalrefmgr.hxx>

Collaboration diagram for ScExternalRefCache:
[legend]

Classes

struct  Cell
 individual cell within cached external ref table. More...
 
struct  CellFormat
 
struct  DocItem
 Represents data cached for a single external document. More...
 
struct  RangeHash
 
struct  ReferencedStatus
 
struct  SingleRangeData
 
class  Table
 Represents a single cached table in an external document. More...
 
struct  TableName
 

Public Types

typedef ::formula::FormulaTokenRef TokenRef
 
typedef std::shared_ptr< ScTokenArrayTokenArrayRef
 
typedef std::shared_ptr< TableTableTypeRef
 
typedef std::unordered_map< OUString, size_t > TableNameIndexMap
 

Public Member Functions

 ScExternalRefCache ()
 
 ~ScExternalRefCache ()
 
const OUString * getRealTableName (sal_uInt16 nFileId, const OUString &rTabName) const
 
const OUString * getRealRangeName (sal_uInt16 nFileId, const OUString &rRangeName) const
 
ScExternalRefCache::TokenRef getCellData (sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol, SCROW nRow, sal_uInt32 *pnFmtIndex)
 Get a cached cell data at specified cell location. More...
 
ScExternalRefCache::TokenArrayRef getCellRangeData (sal_uInt16 nFileId, const OUString &rTabName, const ScRange &rRange)
 Get a cached cell range data. More...
 
ScExternalRefCache::TokenArrayRef getRangeNameTokens (sal_uInt16 nFileId, const OUString &rName)
 
void setRangeNameTokens (sal_uInt16 nFileId, const OUString &rName, TokenArrayRef pArray)
 
bool isValidRangeName (sal_uInt16 nFileId, const OUString &rName) const
 
void setRangeName (sal_uInt16 nFileId, const OUString &rName)
 
void setCellData (sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol, SCROW nRow, TokenRef const &pToken, sal_uLong nFmtIndex)
 
void setCellRangeData (sal_uInt16 nFileId, const ScRange &rRange, const ::std::vector< SingleRangeData > &rData, const TokenArrayRef &pArray)
 
bool isDocInitialized (sal_uInt16 nFileId)
 
void initializeDoc (sal_uInt16 nFileId, const ::std::vector< OUString > &rTabNames, const OUString &rBaseName)
 
OUString getTableName (sal_uInt16 nFileId, size_t nCacheId) const
 
void getAllTableNames (sal_uInt16 nFileId,::std::vector< OUString > &rTabNames) const
 
SCTAB getTabSpan (sal_uInt16 nFileId, const OUString &rStartTabName, const OUString &rEndTabName) const
 
void getAllNumberFormats (::std::vector< sal_uInt32 > &rNumFmts) const
 
bool setCacheDocReferenced (sal_uInt16 nFileId)
 Set all tables of a document as referenced, used only during store-to-file. More...
 
bool setCacheTableReferenced (sal_uInt16 nFileId, const OUString &rTabName, size_t nSheets)
 Set a table as referenced, used only during store-to-file. More...
 
void setAllCacheTableReferencedStati (bool bReferenced)
 
bool areAllCacheTablesReferenced () const
 
void getAllCachedDataSpans (const ScDocument &rSrcDoc, sal_uInt16 nFileId, sc::ColumnSpanSet &rSet) const
 Collect all cached non-empty cell positions, inferred directly from the cached data, not the cached range metadata stored separately in the Table. More...
 
bool getSrcDocTable (const ScDocument &rSrcDoc, const OUString &rTabName, SCTAB &rTab, sal_uInt16 nFileId) const
 
ScExternalRefCache::TableTypeRef getCacheTable (sal_uInt16 nFileId, size_t nTabIndex) const
 
ScExternalRefCache::TableTypeRef getCacheTable (sal_uInt16 nFileId, const OUString &rTabName, bool bCreateNew, size_t *pnIndex, const OUString *pExtUrl)
 
void clearCache (sal_uInt16 nFileId)
 Clear all caches including the cache tables. More...
 
void clearCacheTables (sal_uInt16 nFileId)
 Clear all caches but keep the tables. More...
 
const ScDocumentgetFakeDoc () const
 

Private Types

typedef std::unordered_map< SCCOL, CellRowDataType
 
typedef std::unordered_map< SCROW, RowDataTypeRowsDataType
 
typedef std::unordered_map< OUString, TokenArrayRefRangeNameMap
 
typedef std::unordered_map< ScRange, TokenArrayRef, RangeHashRangeArrayMap
 
typedef std::unordered_map< OUString, OUString > NamePairMap
 
typedef std::unordered_map< sal_uInt16, DocItemDocDataType
 

Private Member Functions

void addCacheTableToReferenced (sal_uInt16 nFileId, size_t nIndex)
 
void addCacheDocToReferenced (sal_uInt16 nFileId)
 
DocItemgetDocItem (sal_uInt16 nFileId) const
 

Private Attributes

struct ScExternalRefCache::ReferencedStatus maReferenced
 
osl::Mutex maMtxDocs
 
DocDataType maDocs
 
ScDocumentUniquePtr mxFakeDoc
 

Detailed Description

Cache table for external reference data.

Definition at line 81 of file externalrefmgr.hxx.

Member Typedef Documentation

typedef std::unordered_map<sal_uInt16, DocItem> ScExternalRefCache::DocDataType
private

Definition at line 356 of file externalrefmgr.hxx.

typedef std::unordered_map<OUString, OUString> ScExternalRefCache::NamePairMap
private

Definition at line 325 of file externalrefmgr.hxx.

typedef std::unordered_map<ScRange, TokenArrayRef, RangeHash> ScExternalRefCache::RangeArrayMap
private

Definition at line 324 of file externalrefmgr.hxx.

typedef std::unordered_map<OUString, TokenArrayRef> ScExternalRefCache::RangeNameMap
private

Definition at line 323 of file externalrefmgr.hxx.

typedef std::unordered_map<SCCOL, Cell> ScExternalRefCache::RowDataType
private

Definition at line 111 of file externalrefmgr.hxx.

typedef std::unordered_map<SCROW, RowDataType> ScExternalRefCache::RowsDataType
private

Definition at line 112 of file externalrefmgr.hxx.

typedef std::unordered_map< OUString, size_t> ScExternalRefCache::TableNameIndexMap

Definition at line 184 of file externalrefmgr.hxx.

typedef std::shared_ptr<Table> ScExternalRefCache::TableTypeRef

Definition at line 182 of file externalrefmgr.hxx.

Definition at line 85 of file externalrefmgr.hxx.

Definition at line 84 of file externalrefmgr.hxx.

Constructor & Destructor Documentation

ScExternalRefCache::ScExternalRefCache ( )

Definition at line 459 of file externalrefmgr.cxx.

ScExternalRefCache::~ScExternalRefCache ( )

Definition at line 463 of file externalrefmgr.cxx.

Member Function Documentation

void ScExternalRefCache::addCacheDocToReferenced ( sal_uInt16  nFileId)
private
void ScExternalRefCache::addCacheTableToReferenced ( sal_uInt16  nFileId,
size_t  nIndex 
)
private
bool ScExternalRefCache::areAllCacheTablesReferenced ( ) const
inline
void ScExternalRefCache::clearCache ( sal_uInt16  nFileId)

Clear all caches including the cache tables.

Definition at line 1362 of file externalrefmgr.cxx.

References maDocs, and maMtxDocs.

Referenced by ScExternalRefManager::clearCache().

void ScExternalRefCache::clearCacheTables ( sal_uInt16  nFileId)

Clear all caches but keep the tables.

All cache tables will be empty after the call, but the tables will not be removed.

Definition at line 1368 of file externalrefmgr.cxx.

References getDocItem(), maMtxDocs, ScExternalRefCache::DocItem::maRangeArrays, ScExternalRefCache::DocItem::maRangeNames, ScExternalRefCache::DocItem::maRealRangeNameMap, and ScExternalRefCache::DocItem::maTables.

Referenced by ScExternalRefManager::refreshSrcDocument().

void ScExternalRefCache::getAllCachedDataSpans ( const ScDocument rSrcDoc,
sal_uInt16  nFileId,
sc::ColumnSpanSet rSet 
) const

Collect all cached non-empty cell positions, inferred directly from the cached data, not the cached range metadata stored separately in the Table.

Definition at line 1232 of file externalrefmgr.cxx.

References getDocItem(), ScExternalRefCache::DocItem::maTables, and sc::ColumnSpanSet::set().

Referenced by ScExternalRefManager::refreshSrcDocument().

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

Definition at line 1076 of file externalrefmgr.cxx.

References maDocs, and maMtxDocs.

Referenced by ScExternalRefManager::getAllCachedNumberFormats().

void ScExternalRefCache::getAllTableNames ( sal_uInt16  nFileId,
::std::vector< OUString > &  rTabNames 
) const
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable ( sal_uInt16  nFileId,
size_t  nTabIndex 
) const
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable ( sal_uInt16  nFileId,
const OUString &  rTabName,
bool  bCreateNew,
size_t *  pnIndex,
const OUString *  pExtUrl 
)
ScExternalRefCache::TokenRef ScExternalRefCache::getCellData ( sal_uInt16  nFileId,
const OUString &  rTabName,
SCCOL  nCol,
SCROW  nRow,
sal_uInt32 *  pnFmtIndex 
)

Get a cached cell data at specified cell location.

Parameters
nFileIdfile ID of an external document
rTabNamesheet name
nCol
nRow
Returns
pointer to the token instance in the cache.

Definition at line 508 of file externalrefmgr.cxx.

References ScExternalRefCache::DocItem::findTableNameIndex(), maDocs, maMtxDocs, ScExternalRefCache::DocItem::maTableNameIndex, and ScExternalRefCache::DocItem::maTables.

Referenced by ScExternalRefManager::getSingleRefToken().

ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData ( sal_uInt16  nFileId,
const OUString &  rTabName,
const ScRange rRange 
)

Get a cached cell range data.

Returns
a new token array instance. Note that the caller must manage the life cycle of the returned instance, which is guaranteed if the TokenArrayRef is properly used...

Definition at line 538 of file externalrefmgr.cxx.

References ScRange::aEnd, ScRange::aStart, ScAddress::Col(), ScExternalRefCache::DocItem::findTableNameIndex(), for(), maDocs, o3tl::make_unsigned(), maMtxDocs, ScExternalRefCache::DocItem::maRangeArrays, ScExternalRefCache::DocItem::maTableNameIndex, ScExternalRefCache::DocItem::maTables, MAXCOL, MAXROW, mxFakeDoc, ocSep, ScAddress::Row(), svDouble, svString, and ScAddress::Tab().

Referenced by ScExternalRefManager::getDoubleRefTokens().

ScExternalRefCache::DocItem * ScExternalRefCache::getDocItem ( sal_uInt16  nFileId) const
private
const ScDocument* ScExternalRefCache::getFakeDoc ( ) const
inline

Definition at line 303 of file externalrefmgr.hxx.

References mxFakeDoc.

Referenced by ScExternalRefManager::getDoubleRefTokens().

ScExternalRefCache::TokenArrayRef ScExternalRefCache::getRangeNameTokens ( sal_uInt16  nFileId,
const OUString &  rName 
)
const OUString * ScExternalRefCache::getRealRangeName ( sal_uInt16  nFileId,
const OUString &  rRangeName 
) const
const OUString * ScExternalRefCache::getRealTableName ( sal_uInt16  nFileId,
const OUString &  rTabName 
) const
bool ScExternalRefCache::getSrcDocTable ( const ScDocument rSrcDoc,
const OUString &  rTabName,
SCTAB rTab,
sal_uInt16  nFileId 
) const
OUString ScExternalRefCache::getTableName ( sal_uInt16  nFileId,
size_t  nCacheId 
) const

Definition at line 1031 of file externalrefmgr.cxx.

References EMPTY_OUSTRING, and getDocItem().

Referenced by ScExternalRefManager::getCacheTableName().

SCTAB ScExternalRefCache::getTabSpan ( sal_uInt16  nFileId,
const OUString &  rStartTabName,
const OUString &  rEndTabName 
) const
void ScExternalRefCache::initializeDoc ( sal_uInt16  nFileId,
const ::std::vector< OUString > &  rTabNames,
const OUString &  rBaseName 
)
bool ScExternalRefCache::isDocInitialized ( sal_uInt16  nFileId)
bool ScExternalRefCache::isValidRangeName ( sal_uInt16  nFileId,
const OUString &  rName 
) const
void ScExternalRefCache::setAllCacheTableReferencedStati ( bool  bReferenced)
bool ScExternalRefCache::setCacheDocReferenced ( sal_uInt16  nFileId)

Set all tables of a document as referenced, used only during store-to-file.

Returns
<TRUE> if ALL tables of ALL documents are marked.

Definition at line 1102 of file externalrefmgr.cxx.

References addCacheDocToReferenced(), areAllCacheTablesReferenced(), getDocItem(), and ScExternalRefCache::DocItem::maTables.

Referenced by ScExternalRefManager::markUsedByLinkListeners().

bool ScExternalRefCache::setCacheTableReferenced ( sal_uInt16  nFileId,
const OUString &  rTabName,
size_t  nSheets 
)

Set a table as referenced, used only during store-to-file.

Returns
<TRUE> if ALL tables of ALL documents are marked.

Definition at line 1117 of file externalrefmgr.cxx.

References addCacheTableToReferenced(), areAllCacheTablesReferenced(), getDocItem(), ScExternalRefCache::DocItem::getTableDataIndex(), i, ScExternalRefCache::DocItem::maTables, and nIndex.

Referenced by ScExternalRefManager::setCacheTableReferenced().

void ScExternalRefCache::setCellData ( sal_uInt16  nFileId,
const OUString &  rTabName,
SCCOL  nCol,
SCROW  nRow,
TokenRef const &  pToken,
sal_uLong  nFmtIndex 
)
void ScExternalRefCache::setCellRangeData ( sal_uInt16  nFileId,
const ScRange rRange,
const ::std::vector< SingleRangeData > &  rData,
const TokenArrayRef pArray 
)
void ScExternalRefCache::setRangeName ( sal_uInt16  nFileId,
const OUString &  rName 
)
void ScExternalRefCache::setRangeNameTokens ( sal_uInt16  nFileId,
const OUString &  rName,
TokenArrayRef  pArray 
)

Member Data Documentation

DocDataType ScExternalRefCache::maDocs
mutableprivate
osl::Mutex ScExternalRefCache::maMtxDocs
mutableprivate
struct ScExternalRefCache::ReferencedStatus ScExternalRefCache::maReferenced
private
ScDocumentUniquePtr ScExternalRefCache::mxFakeDoc
private

Definition at line 362 of file externalrefmgr.hxx.

Referenced by getCellRangeData(), and getFakeDoc().


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