LibreOffice Module sc (master) 1
|
Cache table for external reference data. More...
#include <externalrefmgr.hxx>
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< ScTokenArray > | TokenArrayRef |
typedef std::shared_ptr< Table > | TableTypeRef |
typedef std::unordered_map< OUString, size_t > | TableNameIndexMap |
Public Member Functions | |
ScExternalRefCache (const ScDocument &rDoc) | |
~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 ScDocument & | getDoc () const |
Private Types | |
typedef std::unordered_map< SCCOL, Cell > | RowDataType |
typedef std::unordered_map< SCROW, RowDataType > | RowsDataType |
typedef std::unordered_map< OUString, TokenArrayRef > | RangeNameMap |
typedef std::unordered_map< ScRange, TokenArrayRef, RangeHash > | RangeArrayMap |
typedef std::unordered_map< OUString, OUString > | NamePairMap |
typedef std::unordered_map< sal_uInt16, DocItem > | DocDataType |
Private Member Functions | |
void | addCacheTableToReferenced (sal_uInt16 nFileId, size_t nIndex) |
void | addCacheDocToReferenced (sal_uInt16 nFileId) |
DocItem * | getDocItem (sal_uInt16 nFileId) const |
DocItem * | getDocItem (std::unique_lock< std::mutex > &rGuard, sal_uInt16 nFileId) const |
Private Attributes | |
struct ScExternalRefCache::ReferencedStatus | maReferenced |
std::mutex | maMtxDocs |
DocDataType | maDocs |
const ScDocument & | mrDoc |
Cache table for external reference data.
Definition at line 81 of file externalrefmgr.hxx.
|
private |
Definition at line 362 of file externalrefmgr.hxx.
|
private |
Definition at line 331 of file externalrefmgr.hxx.
|
private |
Definition at line 330 of file externalrefmgr.hxx.
|
private |
Definition at line 329 of file externalrefmgr.hxx.
|
private |
Definition at line 111 of file externalrefmgr.hxx.
|
private |
Definition at line 112 of file externalrefmgr.hxx.
typedef std::unordered_map< OUString, size_t> ScExternalRefCache::TableNameIndexMap |
Definition at line 190 of file externalrefmgr.hxx.
typedef std::shared_ptr<Table> ScExternalRefCache::TableTypeRef |
Definition at line 188 of file externalrefmgr.hxx.
typedef std::shared_ptr<ScTokenArray> ScExternalRefCache::TokenArrayRef |
Definition at line 85 of file externalrefmgr.hxx.
Definition at line 84 of file externalrefmgr.hxx.
ScExternalRefCache::ScExternalRefCache | ( | const ScDocument & | rDoc | ) |
Definition at line 485 of file externalrefmgr.cxx.
ScExternalRefCache::~ScExternalRefCache | ( | ) |
Definition at line 490 of file externalrefmgr.cxx.
|
private |
Definition at line 1244 of file externalrefmgr.cxx.
References ScExternalRefCache::ReferencedStatus::checkAllDocs(), i, ScExternalRefCache::ReferencedStatus::maDocs, and maReferenced.
Referenced by setCacheDocReferenced().
|
private |
Definition at line 1220 of file externalrefmgr.cxx.
References ScExternalRefCache::ReferencedStatus::checkAllDocs(), i, ScExternalRefCache::ReferencedStatus::maDocs, maReferenced, and nIndex.
Referenced by setCacheTableReferenced().
|
inline |
Definition at line 258 of file externalrefmgr.hxx.
References maReferenced, and ScExternalRefCache::ReferencedStatus::mbAllReferenced.
Referenced by setCacheDocReferenced(), and setCacheTableReferenced().
void ScExternalRefCache::clearCache | ( | sal_uInt16 | nFileId | ) |
Clear all caches including the cache tables.
Definition at line 1390 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 1396 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 1260 of file externalrefmgr.cxx.
References getDocItem(), ScExternalRefCache::DocItem::maTables, and rSet.
Referenced by ScExternalRefManager::refreshSrcDocument().
void ScExternalRefCache::getAllNumberFormats | ( | ::std::vector< sal_uInt32 > & | rNumFmts | ) | const |
Definition at line 1104 of file externalrefmgr.cxx.
References maDocs, and maMtxDocs.
Referenced by ScExternalRefManager::getAllCachedNumberFormats().
void ScExternalRefCache::getAllTableNames | ( | sal_uInt16 | nFileId, |
::std::vector< OUString > & | rTabNames | ||
) | const |
Definition at line 1067 of file externalrefmgr.cxx.
References getDocItem(), ScExternalRefCache::DocItem::maTableNames, and n.
Referenced by ScExternalRefManager::getAllCachedTableNames().
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable | ( | sal_uInt16 | nFileId, |
const OUString & | rTabName, | ||
bool | bCreateNew, | ||
size_t * | pnIndex, | ||
const OUString * | pExtUrl | ||
) |
Definition at line 1325 of file externalrefmgr.cxx.
References INetURLObject::GetBase(), ScGlobal::getCharClass(), getDocItem(), ScExternalRefCache::DocItem::getTableDataIndex(), ScGlobal::GetTransliteration(), ScExternalRefCache::DocItem::maSingleTableNameAlias, ScExternalRefCache::DocItem::maTableNameIndex, ScExternalRefCache::DocItem::maTableNames, ScExternalRefCache::DocItem::maTables, nIndex, and CharClass::uppercase().
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable | ( | sal_uInt16 | nFileId, |
size_t | nTabIndex | ||
) | const |
Definition at line 1316 of file externalrefmgr.cxx.
References getDocItem(), and ScExternalRefCache::DocItem::maTables.
Referenced by ScExternalRefManager::getCacheTable(), and ScExternalRefManager::getSingleRefToken().
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.
nFileId | file ID of an external document |
rTabName | sheet name |
nCol | |
nRow |
Definition at line 535 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.
Definition at line 565 of file externalrefmgr.cxx.
References ScRange::aEnd, ScRange::aStart, ScAddress::Col(), ScExternalRefCache::DocItem::findTableNameIndex(), maDocs, o3tl::make_unsigned(), maMtxDocs, ScExternalRefCache::DocItem::maRangeArrays, ScExternalRefCache::DocItem::maTableNameIndex, ScExternalRefCache::DocItem::maTables, MAXCOL, MAXROW, mrDoc, ocSep, ScAddress::Row(), svDouble, svString, and ScAddress::Tab().
Referenced by ScExternalRefManager::getDoubleRefTokens().
|
inline |
Definition at line 309 of file externalrefmgr.hxx.
References mrDoc.
Referenced by ScExternalRefManager::getDoubleRefTokens().
|
private |
Definition at line 1420 of file externalrefmgr.cxx.
References getDocItem(), and maMtxDocs.
Referenced by clearCacheTables(), getAllCachedDataSpans(), getAllTableNames(), getCacheTable(), getDocItem(), getRangeNameTokens(), getSrcDocTable(), getTableName(), getTabSpan(), initializeDoc(), isDocInitialized(), isValidRangeName(), setCacheDocReferenced(), setCacheTableReferenced(), setCellData(), setCellRangeData(), setRangeName(), and setRangeNameTokens().
|
private |
Definition at line 1426 of file externalrefmgr.cxx.
References maDocs.
ScExternalRefCache::TokenArrayRef ScExternalRefCache::getRangeNameTokens | ( | sal_uInt16 | nFileId, |
const OUString & | rName | ||
) |
Definition at line 736 of file externalrefmgr.cxx.
References ScGlobal::getCharClass(), getDocItem(), maMtxDocs, and ScExternalRefCache::DocItem::maRangeNames.
Referenced by ScExternalRefManager::getRangeNameTokens().
const OUString * ScExternalRefCache::getRealRangeName | ( | sal_uInt16 | nFileId, |
const OUString & | rRangeName | ||
) | const |
Definition at line 514 of file externalrefmgr.cxx.
References ScGlobal::getCharClass(), maDocs, maMtxDocs, and ScExternalRefCache::DocItem::maRealRangeNameMap.
Referenced by ScExternalRefManager::getRealRangeName().
const OUString * ScExternalRefCache::getRealTableName | ( | sal_uInt16 | nFileId, |
const OUString & | rTabName | ||
) | const |
Definition at line 492 of file externalrefmgr.cxx.
References ScExternalRefCache::DocItem::findTableNameIndex(), maDocs, maMtxDocs, ScExternalRefCache::DocItem::maTableNameIndex, and ScExternalRefCache::DocItem::maTableNames.
Referenced by ScExternalRefManager::getRealTableName().
bool ScExternalRefCache::getSrcDocTable | ( | const ScDocument & | rSrcDoc, |
const OUString & | rTabName, | ||
SCTAB & | rTab, | ||
sal_uInt16 | nFileId | ||
) | const |
Definition at line 1041 of file externalrefmgr.cxx.
References getDocItem(), ScExternalRefCache::DocItem::getSingleTableNameAlternative(), and ScDocument::GetTable().
Referenced by ScExternalRefManager::getSrcDocTable().
OUString ScExternalRefCache::getTableName | ( | sal_uInt16 | nFileId, |
size_t | nCacheId | ||
) | const |
Definition at line 1059 of file externalrefmgr.cxx.
References getDocItem().
Referenced by ScExternalRefManager::getCacheTableName(), and ScExternalRefManager::storeRangeNameTokens().
SCTAB ScExternalRefCache::getTabSpan | ( | sal_uInt16 | nFileId, |
const OUString & | rStartTabName, | ||
const OUString & | rEndTabName | ||
) | const |
Definition at line 1080 of file externalrefmgr.cxx.
References getDocItem(), and ScExternalRefCache::DocItem::maTableNames.
Referenced by ScExternalRefManager::getCachedTabSpan().
void ScExternalRefCache::initializeDoc | ( | sal_uInt16 | nFileId, |
const ::std::vector< OUString > & | rTabNames, | ||
const OUString & | rBaseName | ||
) |
Definition at line 943 of file externalrefmgr.cxx.
References ScGlobal::getCharClass(), getDocItem(), ScGlobal::GetTransliteration(), i, lcl_getStrictTableDataIndex(), ScExternalRefCache::DocItem::maSingleTableNameAlias, ScExternalRefCache::DocItem::maTableNameIndex, ScExternalRefCache::DocItem::maTableNames, ScExternalRefCache::DocItem::maTables, ScExternalRefCache::DocItem::mbInitFromSource, n, and nIndex.
bool ScExternalRefCache::isDocInitialized | ( | sal_uInt16 | nFileId | ) |
Definition at line 903 of file externalrefmgr.cxx.
References getDocItem(), and ScExternalRefCache::DocItem::mbInitFromSource.
Referenced by setCellData(), and setCellRangeData().
bool ScExternalRefCache::isValidRangeName | ( | sal_uInt16 | nFileId, |
const OUString & | rName | ||
) | const |
Definition at line 767 of file externalrefmgr.cxx.
References ScGlobal::getCharClass(), getDocItem(), maMtxDocs, ScExternalRefCache::DocItem::maRangeNames, and CharClass::uppercase().
Referenced by ScExternalRefManager::isValidRangeName().
void ScExternalRefCache::setAllCacheTableReferencedStati | ( | bool | bReferenced | ) |
Definition at line 1171 of file externalrefmgr.cxx.
References a, i, ScExternalRefCache::ReferencedStatus::maDocs, maDocs, maMtxDocs, maReferenced, ScExternalRefCache::ReferencedStatus::DocReferenced::maTables, ScExternalRefCache::DocItem::maTables, ScExternalRefCache::ReferencedStatus::mbAllReferenced, ScExternalRefCache::ReferencedStatus::DocReferenced::mbAllTablesReferenced, and ScExternalRefCache::ReferencedStatus::reset().
Referenced by ScExternalRefManager::setAllCacheTableReferencedStati().
bool ScExternalRefCache::setCacheDocReferenced | ( | sal_uInt16 | nFileId | ) |
Set all tables of a document as referenced, used only during store-to-file.
Definition at line 1130 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.
Definition at line 1145 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 | ||
) |
Definition at line 792 of file externalrefmgr.cxx.
References ScExternalRefCache::DocItem::findTableNameIndex(), getDocItem(), isDocInitialized(), ScExternalRefCache::DocItem::maTableNameIndex, and ScExternalRefCache::DocItem::maTables.
void ScExternalRefCache::setCellRangeData | ( | sal_uInt16 | nFileId, |
const ScRange & | rRange, | ||
const ::std::vector< SingleRangeData > & | rData, | ||
const TokenArrayRef & | pArray | ||
) |
Definition at line 819 of file externalrefmgr.cxx.
References ScRange::aEnd, ScRange::aStart, col, ScAddress::Col(), ScExternalRefCache::DocItem::findTableNameIndex(), getDocItem(), GetDoubleErrorValue(), i, isDocInitialized(), o3tl::make_unsigned(), ScExternalRefCache::DocItem::maRangeArrays, ScExternalRefCache::DocItem::maTableNameIndex, ScExternalRefCache::DocItem::maTables, ScAddress::Row(), SAL_WARN, and ScAddress::Tab().
void ScExternalRefCache::setRangeName | ( | sal_uInt16 | nFileId, |
const OUString & | rName | ||
) |
Definition at line 780 of file externalrefmgr.cxx.
References ScGlobal::getCharClass(), getDocItem(), maMtxDocs, ScExternalRefCache::DocItem::maRealRangeNameMap, and CharClass::uppercase().
Referenced by ScExternalRefManager::isValidRangeName().
void ScExternalRefCache::setRangeNameTokens | ( | sal_uInt16 | nFileId, |
const OUString & | rName, | ||
TokenArrayRef | pArray | ||
) |
Definition at line 753 of file externalrefmgr.cxx.
References ScGlobal::getCharClass(), getDocItem(), maMtxDocs, ScExternalRefCache::DocItem::maRangeNames, ScExternalRefCache::DocItem::maRealRangeNameMap, and CharClass::uppercase().
Referenced by ScExternalRefManager::getRangeNameTokens(), and ScExternalRefManager::storeRangeNameTokens().
|
mutableprivate |
Definition at line 368 of file externalrefmgr.hxx.
Referenced by ScExternalRefCache::ReferencedStatus::checkAllDocs(), clearCache(), getAllNumberFormats(), getCellData(), getCellRangeData(), getDocItem(), getRealRangeName(), getRealTableName(), ScExternalRefCache::ReferencedStatus::reset(), and setAllCacheTableReferencedStati().
|
mutableprivate |
Definition at line 367 of file externalrefmgr.hxx.
Referenced by clearCache(), clearCacheTables(), getAllNumberFormats(), getCellData(), getCellRangeData(), getDocItem(), getRangeNameTokens(), getRealRangeName(), getRealTableName(), isValidRangeName(), setAllCacheTableReferencedStati(), setRangeName(), and setRangeNameTokens().
|
private |
|
private |
Definition at line 369 of file externalrefmgr.hxx.
Referenced by getCellRangeData(), and getDoc().