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 () | |
~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 * | getFakeDoc () 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 |
Private Attributes | |
struct ScExternalRefCache::ReferencedStatus | maReferenced |
osl::Mutex | maMtxDocs |
DocDataType | maDocs |
ScDocumentUniquePtr | mxFakeDoc |
Cache table for external reference data.
Definition at line 81 of file externalrefmgr.hxx.
|
private |
Definition at line 356 of file externalrefmgr.hxx.
|
private |
Definition at line 325 of file externalrefmgr.hxx.
|
private |
Definition at line 324 of file externalrefmgr.hxx.
|
private |
Definition at line 323 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 184 of file externalrefmgr.hxx.
typedef std::shared_ptr<Table> ScExternalRefCache::TableTypeRef |
Definition at line 182 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 | ( | ) |
Definition at line 459 of file externalrefmgr.cxx.
ScExternalRefCache::~ScExternalRefCache | ( | ) |
Definition at line 463 of file externalrefmgr.cxx.
|
private |
Definition at line 1216 of file externalrefmgr.cxx.
References ScExternalRefCache::ReferencedStatus::checkAllDocs(), i, ScExternalRefCache::ReferencedStatus::maDocs, and maReferenced.
Referenced by setCacheDocReferenced().
|
private |
Definition at line 1192 of file externalrefmgr.cxx.
References ScExternalRefCache::ReferencedStatus::checkAllDocs(), i, ScExternalRefCache::ReferencedStatus::maDocs, and maReferenced.
Referenced by setCacheTableReferenced().
|
inline |
Definition at line 252 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 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 |
Definition at line 1039 of file externalrefmgr.cxx.
References getDocItem(), ScExternalRefCache::DocItem::maTableNames, and n.
Referenced by ScExternalRefManager::getAllCachedTableNames().
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable | ( | sal_uInt16 | nFileId, |
size_t | nTabIndex | ||
) | const |
Definition at line 1288 of file externalrefmgr.cxx.
References getDocItem(), and ScExternalRefCache::DocItem::maTables.
Referenced by ScExternalRefManager::getCacheTable(), and ScExternalRefManager::getSingleRefToken().
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable | ( | sal_uInt16 | nFileId, |
const OUString & | rTabName, | ||
bool | bCreateNew, | ||
size_t * | pnIndex, | ||
const OUString * | pExtUrl | ||
) |
Definition at line 1297 of file externalrefmgr.cxx.
References INetURLObject::GetBase(), ScGlobal::getCharClassPtr(), getDocItem(), ScGlobal::GetpTransliteration(), ScExternalRefCache::DocItem::getTableDataIndex(), ScExternalRefCache::DocItem::maSingleTableNameAlias, ScExternalRefCache::DocItem::maTableNameIndex, ScExternalRefCache::DocItem::maTableNames, ScExternalRefCache::DocItem::maTables, nIndex, and CharClass::uppercase().
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 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.
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, ocSep, ScAddress::Row(), svDouble, svString, and ScAddress::Tab().
Referenced by ScExternalRefManager::getDoubleRefTokens().
|
private |
Definition at line 1392 of file externalrefmgr.cxx.
References maDocs, and maMtxDocs.
Referenced by clearCacheTables(), getAllCachedDataSpans(), getAllTableNames(), getCacheTable(), getRangeNameTokens(), getSrcDocTable(), getTableName(), getTabSpan(), initializeDoc(), isDocInitialized(), isValidRangeName(), setCacheDocReferenced(), setCacheTableReferenced(), setCellData(), setCellRangeData(), setRangeName(), and setRangeNameTokens().
|
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 | ||
) |
Definition at line 709 of file externalrefmgr.cxx.
References ScGlobal::getCharClassPtr(), getDocItem(), maMtxDocs, and ScExternalRefCache::DocItem::maRangeNames.
Referenced by ScExternalRefManager::getRangeNameTokens().
const OUString * ScExternalRefCache::getRealRangeName | ( | sal_uInt16 | nFileId, |
const OUString & | rRangeName | ||
) | const |
Definition at line 487 of file externalrefmgr.cxx.
References ScGlobal::getCharClassPtr(), maDocs, maMtxDocs, and ScExternalRefCache::DocItem::maRealRangeNameMap.
Referenced by ScExternalRefManager::getRealRangeName().
const OUString * ScExternalRefCache::getRealTableName | ( | sal_uInt16 | nFileId, |
const OUString & | rTabName | ||
) | const |
Definition at line 465 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 1013 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 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 |
Definition at line 1052 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 915 of file externalrefmgr.cxx.
References ScGlobal::getCharClassPtr(), getDocItem(), ScGlobal::GetpTransliteration(), 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 875 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 740 of file externalrefmgr.cxx.
References getDocItem(), maMtxDocs, and ScExternalRefCache::DocItem::maRangeNames.
Referenced by ScExternalRefManager::isValidRangeName().
void ScExternalRefCache::setAllCacheTableReferencedStati | ( | bool | bReferenced | ) |
Definition at line 1143 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 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.
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 | ||
) |
Definition at line 764 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 791 of file externalrefmgr.cxx.
References ScRange::aEnd, ScRange::aStart, 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 752 of file externalrefmgr.cxx.
References ScGlobal::getCharClassPtr(), 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 726 of file externalrefmgr.cxx.
References ScGlobal::getCharClassPtr(), getDocItem(), maMtxDocs, ScExternalRefCache::DocItem::maRangeNames, ScExternalRefCache::DocItem::maRealRangeNameMap, and CharClass::uppercase().
Referenced by ScExternalRefManager::getRangeNameTokens(), and ScExternalRefManager::storeRangeNameTokens().
|
mutableprivate |
Definition at line 361 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 360 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 362 of file externalrefmgr.hxx.
Referenced by getFakeDoc().