LibreOffice Module sc (master)
1
|
#include <externalrefmgr.hxx>
Classes | |
class | ApiGuard |
Use this guard when performing something from the API that might query values from external references. More... | |
class | LinkListener |
Base class for objects that need to listen to link updates. More... | |
struct | SrcFileData |
Source document meta-data container. More... | |
struct | SrcShell |
Shell instance for a source document. More... | |
Public Types | |
enum | LinkUpdateType { LINK_MODIFIED, LINK_BROKEN } |
typedef std::set< ScFormulaCell * > | RefCellSet |
typedef std::unordered_map< sal_uInt16, RefCellSet > | RefCellMap |
Public Member Functions | |
ScExternalRefManager (ScDocument &rDoc) | |
virtual | ~ScExternalRefManager () override |
virtual OUString | getCacheTableName (sal_uInt16 nFileId, size_t nTabIndex) const override |
ScExternalRefCache::TableTypeRef | getCacheTable (sal_uInt16 nFileId, size_t nTabIndex) const |
Get a cache table instance for specified table and table index. More... | |
ScExternalRefCache::TableTypeRef | getCacheTable (sal_uInt16 nFileId, const OUString &rTabName, bool bCreateNew, size_t *pnIndex=nullptr, const OUString *pExtUrl=nullptr) |
Get a cache table instance for specified file and table name. More... | |
void | getAllCachedTableNames (sal_uInt16 nFileId,::std::vector< OUString > &rTabNames) const |
Returns a vector containing all (real) table names and cache tables of the specified file. More... | |
SCTAB | getCachedTabSpan (sal_uInt16 nFileId, const OUString &rStartTabName, const OUString &rEndTabName) const |
Get the span (distance+sign(distance)) of two sheets of a specified file. More... | |
void | getAllCachedNumberFormats (::std::vector< sal_uInt32 > &rNumFmts) const |
Get all unique number format indices that are used in the cache tables. More... | |
sal_uInt16 | getExternalFileCount () const |
void | markUsedByLinkListeners () |
Mark all tables as referenced that are used by any LinkListener, used only during store-to-file. More... | |
void | markUsedExternalRefCells () |
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 | isInReferenceMarking () const |
void | storeRangeNameTokens (sal_uInt16 nFileId, const OUString &rName, const ScTokenArray &rArray) |
ScExternalRefCache::TokenRef | getSingleRefToken (sal_uInt16 nFileId, const OUString &rTabName, const ScAddress &rCell, const ScAddress *pCurPos, SCTAB *pTab, ScExternalRefCache::CellFormat *pFmt=nullptr) |
ScExternalRefCache::TokenArrayRef | getDoubleRefTokens (sal_uInt16 nFileId, const OUString &rTabName, const ScRange &rRange, const ScAddress *pCurPos) |
Get an array of tokens that consist of the specified external cell range. More... | |
ScExternalRefCache::TokenArrayRef | getRangeNameTokens (sal_uInt16 nFileId, const OUString &rName, const ScAddress *pCurPos=nullptr) |
Get an array of tokens corresponding with a specified name in a specified file. More... | |
bool | isValidRangeName (sal_uInt16 nFileId, const OUString &rName) |
OUString | getOwnDocumentName () const |
bool | isOwnDocument (std::u16string_view rFile) const |
void | convertToAbsName (OUString &rFile) const |
Takes a flat file name, and convert it to an absolute URL path. More... | |
sal_uInt16 | getExternalFileId (const OUString &rFile) |
const OUString * | getExternalFileName (sal_uInt16 nFileId, bool bForceOriginal=false) |
It returns a pointer to the name of the URI associated with a given external file ID. More... | |
sal_uInt16 | convertFileIdToUsedFileId (sal_uInt16 nFileId) |
Reindex external file references to skip unused files, if skipping is enabled. More... | |
void | setSkipUnusedFileIds (std::vector< sal_uInt16 > &pExternFileIds) |
void | disableSkipUnusedFileIds () |
std::vector< OUString > | getAllCachedExternalFileNames () const |
Get all cached external file names as an array. More... | |
bool | hasExternalFile (sal_uInt16 nFileId) const |
bool | hasExternalFile (const OUString &rFile) const |
const SrcFileData * | getExternalFileData (sal_uInt16 nFileId) const |
const OUString * | getRealTableName (sal_uInt16 nFileId, const OUString &rTabName) const |
const OUString * | getRealRangeName (sal_uInt16 nFileId, const OUString &rRangeName) const |
void | clearCache (sal_uInt16 nFileId) |
bool | refreshSrcDocument (sal_uInt16 nFileId) |
void | breakLink (sal_uInt16 nFileId) |
void | switchSrcFile (sal_uInt16 nFileId, const OUString &rNewFile, const OUString &rNewFilter) |
void | setRelativeFileName (sal_uInt16 nFileId, const OUString &rRelUrl) |
Set a relative file path for the specified file ID. More... | |
void | setFilterData (sal_uInt16 nFileId, const OUString &rFilterName, const OUString &rOptions) |
Set the filter name and options if any for a given source document. More... | |
void | clear () |
bool | hasExternalData () const |
void | resetSrcFileData (const OUString &rBaseFileUrl) |
Re-generates relative names for all stored source files. More... | |
void | updateAbsAfterLoad () |
Replace the original URL with the real URL that was generated from the relative URL. More... | |
void | removeRefCell (ScFormulaCell *pCell) |
Stop tracking a specific formula cell. More... | |
void | addLinkListener (sal_uInt16 nFileId, LinkListener *pListener) |
Register a new link listener to a specified external document. More... | |
void | removeLinkListener (sal_uInt16 nFileId, LinkListener *pListener) |
Remove an existing link listener. More... | |
void | removeLinkListener (LinkListener *pListener) |
void | notifyAllLinkListeners (sal_uInt16 nFileId, LinkUpdateType eType) |
Notify all listeners that are listening to a specified external document. More... | |
bool | isFileLoadable (const OUString &rFile) const |
Check if the file specified by the path is a legitimate file that exists & can be loaded. More... | |
virtual void | Notify (SfxBroadcaster &rBC, const SfxHint &rHint) override |
bool | containsUnsavedReferences () const |
If we still contain unsaved files we should warn the user before saving. More... | |
void | insertRefCell (sal_uInt16 nFileId, const ScAddress &rCell) |
void | insertRefCellFromTemplate (ScFormulaCell *pTemplateCell, ScFormulaCell *pCell) |
Add a cell to reference the same files as the template cell. More... | |
bool | hasCellExternalReference (const ScAddress &rCell) |
void | enableDocTimer (bool bEnable) |
void | addFilesToLinkManager () |
Add all known external files to the LinkManager. More... | |
![]() | |
SfxListener () | |
SfxListener (const SfxListener &rCopy) | |
virtual | ~SfxListener () COVERITY_NOEXCEPT_FALSE |
void | StartListening (SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected) |
void | EndListening (SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false) |
void | EndListeningAll () |
bool | IsListening (SfxBroadcaster &rBroadcaster) const |
sal_uInt16 | GetBroadcasterCount () const |
SfxBroadcaster * | GetBroadcasterJOE (sal_uInt16 nNo) const |
void | RemoveBroadcaster_Impl (SfxBroadcaster &rBC) |
Private Types | |
typedef std::unordered_map< sal_uInt16, SrcShell > | DocShellMap |
typedef std::unordered_map< sal_uInt16, bool > | LinkedDocMap |
typedef std::unordered_map< sal_uInt16, SvNumberFormatterMergeMap > | NumFmtMap |
typedef o3tl::sorted_vector< LinkListener * > | LinkListeners |
typedef std::unordered_map< sal_uInt16, LinkListeners > | LinkListenerMap |
Private Member Functions | |
ScExternalRefManager (const ScExternalRefManager &)=delete | |
void | refreshAllRefCells (sal_uInt16 nFileId) |
void | fillCellFormat (sal_uLong nFmtIndex, ScExternalRefCache::CellFormat *pFmt) const |
bool | getSrcDocTable (const ScDocument &rSrcDoc, const OUString &rTabName, SCTAB &rTab, sal_uInt16 nFileId) const |
ScExternalRefCache::TokenRef | getSingleRefTokenFromSrcDoc (sal_uInt16 nFileId, ScDocument &rSrcDoc, const ScAddress &rPos, ScExternalRefCache::CellFormat *pFmt) |
ScExternalRefCache::TokenArrayRef | getDoubleRefTokensFromSrcDoc (const ScDocument &rSrcDoc, const OUString &rTabName, ScRange &rRange,::std::vector< ScExternalRefCache::SingleRangeData > &rCacheData) |
Retrieve a range token array from a source document instance. More... | |
ScDocument * | getInMemorySrcDocument (sal_uInt16 nFileId) |
ScDocument * | getSrcDocument (sal_uInt16 nFileId) |
SfxObjectShellRef | loadSrcDocument (sal_uInt16 nFileId, OUString &rFilter) |
ScDocument & | cacheNewDocShell (sal_uInt16 nFileId, SrcShell &rSrcShell) |
Caller must ensure that the passed shell is not already stored. More... | |
void | maybeLinkExternalFile (sal_uInt16 nFileId, bool bDeferFilterDetection=false) |
void | maybeCreateRealFileName (sal_uInt16 nFileId) |
Try to create a "real" file name from the relative path. More... | |
void | purgeStaleSrcDocument (sal_Int32 nTimeOut) |
Purge those source document instances that have not been accessed for the specified duration. More... | |
sal_uInt32 | getMappedNumberFormat (sal_uInt16 nFileId, sal_uInt32 nNumFmt, const ScDocument &rSrcDoc) |
void | transformUnsavedRefToSavedRef (SfxObjectShell *pShell) |
If in maUnsavedDocShells move it to maDocShells and create a correct external reference entry. More... | |
DECL_LINK (TimeOutHdl, Timer *, void) | |
Static Private Member Functions | |
static ScExternalRefCache::TokenArrayRef | getRangeNameTokensFromSrcDoc (sal_uInt16 nFileId, const ScDocument &rSrcDoc, OUString &rName) |
Retrieve range name token array from a source document instance. More... | |
Private Attributes | |
ScDocument & | mrDoc |
ScExternalRefCache | maRefCache |
cache of referenced ranges and names from source documents. More... | |
DocShellMap | maDocShells |
Source document cache. More... | |
DocShellMap | maUnsavedDocShells |
DocShells to unsaved but referenced documents. More... | |
LinkedDocMap | maLinkedDocs |
list of source documents that are managed by the link manager. More... | |
RefCellMap | maRefCells |
List of referencing cells that may contain external names. More... | |
LinkListenerMap | maLinkListeners |
NumFmtMap | maNumFormatMap |
std::vector< SrcFileData > | maSrcFiles |
List of external source document meta-data, used to keep track of external document identifiers. More... | |
bool | mbInReferenceMarking:1 |
Status whether in reference marking state. More... | |
bool | mbUserInteractionEnabled:1 |
Controls whether or not to allow user interaction. More... | |
bool | mbSkipUnusedFileIds = false |
std::vector< sal_uInt16 > | maConvertFileIdToUsedFileId |
bool | mbDocTimerEnabled:1 |
AutoTimer | maSrcDocTimer |
Additional Inherited Members | |
![]() | |
~ExternalReferenceHelper () | |
Definition at line 365 of file externalrefmgr.hxx.
|
private |
Definition at line 412 of file externalrefmgr.hxx.
|
private |
Definition at line 413 of file externalrefmgr.hxx.
|
private |
Definition at line 418 of file externalrefmgr.hxx.
|
private |
Definition at line 417 of file externalrefmgr.hxx.
|
private |
Definition at line 415 of file externalrefmgr.hxx.
typedef std::unordered_map<sal_uInt16, RefCellSet> ScExternalRefManager::RefCellMap |
Definition at line 370 of file externalrefmgr.hxx.
Definition at line 369 of file externalrefmgr.hxx.
Enumerator | |
---|---|
LINK_MODIFIED | |
LINK_BROKEN |
Definition at line 372 of file externalrefmgr.hxx.
|
explicit |
Definition at line 1637 of file externalrefmgr.cxx.
References LINK, maSrcDocTimer, Task::SetDebugName(), Timer::SetInvokeHandler(), Timer::SetTimeout(), and SRCDOC_SCAN_INTERVAL.
|
overridevirtual |
Definition at line 1648 of file externalrefmgr.cxx.
References clear().
|
privatedelete |
void ScExternalRefManager::addFilesToLinkManager | ( | ) |
Add all known external files to the LinkManager.
Definition at line 2635 of file externalrefmgr.cxx.
References maSrcFiles, maybeLinkExternalFile(), SAL_MAX_UINT16, and SAL_WARN_IF.
Referenced by oox::xls::FormulaBuffer::finalizeImport().
void ScExternalRefManager::addLinkListener | ( | sal_uInt16 | nFileId, |
LinkListener * | pListener | ||
) |
Register a new link listener to a specified external document.
Note that the caller is responsible for managing the life cycle of the listener object.
Definition at line 3082 of file externalrefmgr.cxx.
References o3tl::sorted_vector< Value, Compare, Find, class >::insert(), and maLinkListeners.
Referenced by ScChart2DataSequence::CopyData(), and ScChart2DataSequence::FillCacheFromExternalRef().
void ScExternalRefManager::breakLink | ( | sal_uInt16 | nFileId | ) |
Definition at line 2963 of file externalrefmgr.cxx.
References clearCache(), ScDocument::GetRangeName(), ScDocument::GetTableCount(), i, lcl_removeByFileId(), LINK_BROKEN, maDocShells, maLinkedDocs, maRefCells, maSrcDocTimer, mrDoc, n, notifyAllLinkListeners(), and Task::Stop().
Referenced by ScExternalRefLink::Closed().
|
private |
Caller must ensure that the passed shell is not already stored.
Definition at line 2553 of file externalrefmgr.cxx.
References maDocShells, maRefCache, ScExternalRefManager::SrcShell::maShell, maSrcDocTimer, mbDocTimerEnabled, and Timer::Start().
Referenced by getSrcDocument(), and refreshSrcDocument().
void ScExternalRefManager::clear | ( | ) |
Definition at line 3034 of file externalrefmgr.cxx.
References maDocShells, maSrcDocTimer, and Task::Stop().
Referenced by ~ScExternalRefManager().
void ScExternalRefManager::clearCache | ( | sal_uInt16 | nFileId | ) |
Definition at line 2820 of file externalrefmgr.cxx.
References ScExternalRefCache::clearCache(), and maRefCache.
Referenced by breakLink().
|
inline |
If we still contain unsaved files we should warn the user before saving.
Definition at line 706 of file externalrefmgr.hxx.
sal_uInt16 ScExternalRefManager::convertFileIdToUsedFileId | ( | sal_uInt16 | nFileId | ) |
Reindex external file references to skip unused files, if skipping is enabled.
Definition at line 2743 of file externalrefmgr.cxx.
References maConvertFileIdToUsedFileId, and mbSkipUnusedFileIds.
Referenced by ScCompiler::CreateStringFromExternal().
void ScExternalRefManager::convertToAbsName | ( | OUString & | rFile | ) | const |
Takes a flat file name, and convert it to an absolute URL path.
An absolute URL path begins with 'file:///.
rFile | file name to convert |
Definition at line 2695 of file externalrefmgr.cxx.
References ScGlobal::GetAbsDocName(), ScDocument::GetDocumentShell(), SfxObjectShell::GetFirst(), SfxShell::GetName(), SfxObjectShell::GetNext(), and mrDoc.
Referenced by ScCompiler::IsExternalNamedRange(), lcl_ScAddress_Parse_OOo(), ScRange::Parse_XL_Header(), and XclImpChangeTrack::Read3DTabRefInfo().
void ScExternalRefManager::disableSkipUnusedFileIds | ( | ) |
Definition at line 2763 of file externalrefmgr.cxx.
References mbSkipUnusedFileIds.
void ScExternalRefManager::enableDocTimer | ( | bool | bEnable | ) |
Definition at line 2185 of file externalrefmgr.cxx.
References maDocShells, maSrcDocTimer, mbDocTimerEnabled, Timer::Start(), Task::Stop(), and tools::Time::SYSTEM.
|
private |
Definition at line 2205 of file externalrefmgr.cxx.
References ScDocument::GetFormatTable(), SvNumberFormatter::GetType(), ScExternalRefCache::CellFormat::mbIsSet, ScExternalRefCache::CellFormat::mnIndex, ScExternalRefCache::CellFormat::mnType, and mrDoc.
Referenced by getSingleRefToken(), and getSingleRefTokenFromSrcDoc().
std::vector< OUString > ScExternalRefManager::getAllCachedExternalFileNames | ( | ) | const |
Get all cached external file names as an array.
Array indices of the returned name array correspond with external file ID's.
Definition at line 2768 of file externalrefmgr.cxx.
References maSrcFiles, and rData.
Referenced by sc::TokenStringContext::TokenStringContext().
void ScExternalRefManager::getAllCachedNumberFormats | ( | ::std::vector< sal_uInt32 > & | rNumFmts | ) | const |
Get all unique number format indices that are used in the cache tables.
The retrieved indices are sorted in ascending order.
rNumFmts | (reference) all unique number format indices. |
Definition at line 1701 of file externalrefmgr.cxx.
References ScExternalRefCache::getAllNumberFormats(), and maRefCache.
Referenced by ScXMLExport::ExportExternalRefCacheStyles().
void ScExternalRefManager::getAllCachedTableNames | ( | sal_uInt16 | nFileId, |
::std::vector< OUString > & | rTabNames | ||
) | const |
Returns a vector containing all (real) table names and cache tables of the specified file.
The index in the returned vector corresponds to the table index used to access the cache table, e.g. in getCacheTable().
Definition at line 1691 of file externalrefmgr.cxx.
References ScExternalRefCache::getAllTableNames(), and maRefCache.
Referenced by ScCompiler::CreateStringFromExternal(), ScExternalDocLinkObj::getElementNames(), sc::TokenStringContext::TokenStringContext(), and ScXMLExport::WriteExternalRefCaches().
SCTAB ScExternalRefManager::getCachedTabSpan | ( | sal_uInt16 | nFileId, |
const OUString & | rStartTabName, | ||
const OUString & | rEndTabName | ||
) | const |
Get the span (distance+sign(distance)) of two sheets of a specified file.
nFileId | file ID |
rStartTabName | name of first sheet (sheet1) |
rEndTabName | name of second sheet (sheet2) |
Definition at line 1696 of file externalrefmgr.cxx.
References ScExternalRefCache::getTabSpan(), and maRefCache.
ScExternalRefCache::TableTypeRef ScExternalRefManager::getCacheTable | ( | sal_uInt16 | nFileId, |
size_t | nTabIndex | ||
) | const |
Get a cache table instance for specified table and table index.
Unlike the other method that takes a table name, this method does not create a new table when a table is not available for specified index.
nFileId | file ID |
nTabIndex | cache table index |
Definition at line 1658 of file externalrefmgr.cxx.
References ScExternalRefCache::getCacheTable(), and maRefCache.
Referenced by ScExternalDocLinkObj::addSheetCache(), ScTokenConversion::ConvertToTokenSequence(), XclImpExtName::CreateOleData(), ScChart2DataSequence::FillCacheFromExternalRef(), ScExternalDocLinkObj::getByIndex(), ScExternalDocLinkObj::getByName(), ScExternalDocLinkObj::getElementNames(), ScExternalDocLinkObj::hasByName(), XclImpSupbook::LoadCachedValues(), ScInterpreter::ScCellExternal(), ScXMLTableContext::ScXMLTableContext(), and ScXMLExport::WriteExternalRefCaches().
ScExternalRefCache::TableTypeRef ScExternalRefManager::getCacheTable | ( | sal_uInt16 | nFileId, |
const OUString & | rTabName, | ||
bool | bCreateNew, | ||
size_t * | pnIndex = nullptr , |
||
const OUString * | pExtUrl = nullptr |
||
) |
Get a cache table instance for specified file and table name.
If the table instance is not already present, it'll instantiate a new one and append it to the end of the table array. It's important to be aware of this fact especially for multi-table ranges for which table orders are critical.
Excel filter calls this method to populate the cache table from the XCT/CRN records. ODF import calls it for cached tables for external references.
nFileId | file ID |
rTabName | table name |
bCreateNew | if true, create a new table instance if it's not already present. If false, it returns NULL if the specified table's cache doesn't exist. |
pnIndex | if non-NULL pointer is passed, it stores the internal index of a cache table instance. |
pExtUrl | if non-NULL and bCreateNew==true, the base name will be propagated as an alias for the first table (and removed later if further tables are created). |
Definition at line 1663 of file externalrefmgr.cxx.
References ScExternalRefCache::getCacheTable(), and maRefCache.
|
overridevirtual |
Implements formula::ExternalReferenceHelper.
Definition at line 1653 of file externalrefmgr.cxx.
References ScExternalRefCache::getTableName(), and maRefCache.
ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens | ( | sal_uInt16 | nFileId, |
const OUString & | rTabName, | ||
const ScRange & | rRange, | ||
const ScAddress * | pCurPos | ||
) |
Get an array of tokens that consist of the specified external cell range.
nFileId | file ID for an external document |
rTabName | referenced sheet name |
rRange | referenced cell range |
pCurPos | current cursor position to keep track of cells that reference an external data. |
Definition at line 1974 of file externalrefmgr.cxx.
References ScExternalRefCache::getCellRangeData(), getDoubleRefTokensFromSrcDoc(), ScExternalRefCache::getFakeDoc(), getInMemorySrcDocument(), getSrcDocument(), insertRefCell(), maRefCache, and maybeLinkExternalFile().
Referenced by ScChart2DataSequence::FillCacheFromExternalRef().
|
private |
Retrieve a range token array from a source document instance.
rSrcDoc | reference to the source document instance. |
rTabName | name of the first table. |
rRange | range specified. Upon successful retrieval, this range gets modified to contain the correct table IDs, and in case the range is larger than the data area of the source document, it gets reduced to the data area. |
rCacheData | an array of structs, with each struct containing the table name and the data in the specified range. |
Definition at line 2241 of file externalrefmgr.cxx.
References ScRange::aEnd, ScRange::aStart, convertToTokenArray(), ScGlobal::getCharClassPtr(), ScDocument::GetName(), ScDocument::GetTable(), i, mrDoc, ScRange::PutInOrder(), ScAddress::SetTab(), ScAddress::Tab(), and CharClass::uppercase().
Referenced by getDoubleRefTokens().
sal_uInt16 ScExternalRefManager::getExternalFileCount | ( | ) | const |
Definition at line 1706 of file externalrefmgr.cxx.
References maSrcFiles.
Referenced by ScExternalDocLinksObj::getCount(), ScExternalDocLinksObj::getElementNames(), ScExternalDocLinksObj::hasElements(), and ScXMLExport::WriteExternalRefCaches().
const ScExternalRefManager::SrcFileData * ScExternalRefManager::getExternalFileData | ( | sal_uInt16 | nFileId | ) | const |
Definition at line 2790 of file externalrefmgr.cxx.
References maSrcFiles.
Referenced by loadSrcDocument(), maybeLinkExternalFile(), and ScXMLExport::WriteExternalRefCaches().
sal_uInt16 ScExternalRefManager::getExternalFileId | ( | const OUString & | rFile | ) |
Definition at line 2711 of file externalrefmgr.cxx.
References aData, distance, ScExternalRefManager::SrcFileData::maFileName, maSrcFiles, and nId.
Referenced by ScExternalDocLinksObj::addDocLink(), ExcelToSc8::ConvertExternName(), XclImpExtName::CreateOleData(), ScExternalDocLinksObj::getByName(), ExcelToSc8::GetExternalFileIdFromXti(), ScCompiler::IsExternalNamedRange(), lcl_ScAddress_Parse_OOo(), XclImpSupbook::LoadCachedValues(), XclImpChangeTrack::Read3DTabRefInfo(), and ScXMLTableContext::ScXMLTableContext().
const OUString * ScExternalRefManager::getExternalFileName | ( | sal_uInt16 | nFileId, |
bool | bForceOriginal = false |
||
) |
It returns a pointer to the name of the URI associated with a given external file ID.
In case the original document has moved, it returns a URI adjusted for the relocation.
nFileId | file ID for an external document |
bForceOriginal | If true, it always returns the original document URI even if the referring document has relocated. If false, it returns a URI adjusted for relocated document. |
Definition at line 2727 of file externalrefmgr.cxx.
References maSrcFiles, and maybeCreateRealFileName().
Referenced by ScCompiler::CreateStringFromExternal(), ScExternalRefLink::DataChanged(), ScViewFunc::DetectiveMarkPred(), ScExternalDocLinksObj::getElementNames(), getInMemorySrcDocument(), getSrcDocument(), ScCompiler::HandleExternalReference(), lcl_appendCellAddress(), lcl_appendCellRangeAddress(), lcl_ScAddress_Parse_OOo(), maybeLinkExternalFile(), ScGridWindow::MouseButtonUp(), XclExpFmlaCompImpl::ProcessExternalName(), ScInterpreter::ScCellExternal(), and ScXMLExport::WriteExternalRefCaches().
|
private |
Definition at line 2342 of file externalrefmgr.cxx.
References ScDocShell::GetDocument(), getExternalFileName(), SfxObjectShell::GetFirst(), SfxObjectShell::GetMedium(), SfxMedium::GetName(), SfxShell::GetName(), SfxObjectShell::GetNext(), maRefCache, ScExternalRefManager::SrcShell::maShell, maUnsavedDocShells, mrDoc, and SfxListener::StartListening().
Referenced by getDoubleRefTokens(), getRangeNameTokens(), getSingleRefToken(), and isValidRangeName().
|
private |
Definition at line 3154 of file externalrefmgr.cxx.
References aMap, SvNumberFormatter::ConvertMergeTableToMap(), ScDocument::GetFormatTable(), maNumFormatMap, SvNumberFormatter::MergeFormatter(), and mrDoc.
Referenced by getSingleRefTokenFromSrcDoc().
OUString ScExternalRefManager::getOwnDocumentName | ( | ) | const |
Definition at line 2673 of file externalrefmgr.cxx.
References ScDocument::GetDocumentShell(), SfxObjectShell::GetMedium(), SfxMedium::GetName(), utl::ConfigManager::IsFuzzing(), and mrDoc.
Referenced by isOwnDocument(), loadSrcDocument(), maybeCreateRealFileName(), and updateAbsAfterLoad().
ScExternalRefCache::TokenArrayRef ScExternalRefManager::getRangeNameTokens | ( | sal_uInt16 | nFileId, |
const OUString & | rName, | ||
const ScAddress * | pCurPos = nullptr |
||
) |
Get an array of tokens corresponding with a specified name in a specified file.
pCurPos | current cell address where this name token is used. This is purely to keep track of all cells containing external names for refreshing purposes. If this is NULL, then the cell will not be added to the list. |
Definition at line 2020 of file externalrefmgr.cxx.
References getInMemorySrcDocument(), ScExternalRefCache::getRangeNameTokens(), getRangeNameTokensFromSrcDoc(), getSrcDocument(), insertRefCell(), maRefCache, maybeLinkExternalFile(), and ScExternalRefCache::setRangeNameTokens().
Referenced by ScCompiler::HandleExternalReference(), and XclExpFmlaCompImpl::ProcessExternalName().
|
staticprivate |
Retrieve range name token array from a source document instance.
nFileId | file ID of the source document. |
rSrcDoc | reference to the source document instance |
rName | range name to retrieve. Note that the range name lookup is case in-sensitive, and upon successful retrieval of the range name array, this name gets updated to the actual range name with the correct casing. |
Definition at line 2285 of file externalrefmgr.cxx.
References ScRangeName::findByUpperName(), ScGlobal::getCharClassPtr(), ScRangeData::GetCode(), ScRangeData::GetName(), ScDocument::GetName(), ScDocument::GetRangeName(), svDoubleRef, svSingleRef, ScSingleRefData::Tab(), and CharClass::uppercase().
Referenced by getRangeNameTokens().
const OUString * ScExternalRefManager::getRealRangeName | ( | sal_uInt16 | nFileId, |
const OUString & | rRangeName | ||
) | const |
Definition at line 2803 of file externalrefmgr.cxx.
References ScExternalRefCache::getRealRangeName(), and maRefCache.
Referenced by ScCompiler::IsExternalNamedRange().
const OUString * ScExternalRefManager::getRealTableName | ( | sal_uInt16 | nFileId, |
const OUString & | rTabName | ||
) | const |
Definition at line 2798 of file externalrefmgr.cxx.
References ScExternalRefCache::getRealTableName(), and maRefCache.
Referenced by ScCompiler::IsDoubleReference(), and ScCompiler::IsSingleReference().
ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken | ( | sal_uInt16 | nFileId, |
const OUString & | rTabName, | ||
const ScAddress & | rCell, | ||
const ScAddress * | pCurPos, | ||
SCTAB * | pTab, | ||
ScExternalRefCache::CellFormat * | pFmt = nullptr |
||
) |
Definition at line 1872 of file externalrefmgr.cxx.
References ScAddress::Col(), fillCellFormat(), ScExternalRefCache::getCacheTable(), ScExternalRefCache::getCellData(), getInMemorySrcDocument(), getSingleRefTokenFromSrcDoc(), getSrcDocTable(), getSrcDocument(), insertRefCell(), maRefCache, ScDocument::MaxCol(), ScDocument::MaxRow(), maybeLinkExternalFile(), ScExternalRefCache::CellFormat::mbIsSet, mrDoc, ScAddress::Row(), and ScDocument::ShrinkToDataArea().
Referenced by lcl_ScAddress_Parse_OOo().
|
private |
Definition at line 2219 of file externalrefmgr.cxx.
References ScAddress::Col(), convertToToken(), fillCellFormat(), getMappedNumberFormat(), ScDocument::GetNumberFormat(), mrDoc, ScAddress::Row(), and ScAddress::Tab().
Referenced by getSingleRefToken().
|
private |
Definition at line 1866 of file externalrefmgr.cxx.
References ScExternalRefCache::getSrcDocTable(), and maRefCache.
Referenced by getSingleRefToken().
|
private |
Definition at line 2389 of file externalrefmgr.cxx.
References cacheNewDocShell(), getExternalFileName(), tools::SvRef< T >::is(), ScDocument::IsExecuteLinkEnabled(), loadSrcDocument(), maDocShells, ScExternalRefManager::SrcShell::maShell, maUnsavedDocShells, mrDoc, p, and tools::Time::SYSTEM.
Referenced by getDoubleRefTokens(), getRangeNameTokens(), getSingleRefToken(), and isValidRangeName().
bool ScExternalRefManager::hasCellExternalReference | ( | const ScAddress & | rCell | ) |
Definition at line 2174 of file externalrefmgr.cxx.
References ScDocument::GetFormulaCell(), maRefCells, and mrDoc.
bool ScExternalRefManager::hasExternalData | ( | ) | const |
Definition at line 3043 of file externalrefmgr.cxx.
References maSrcFiles.
Referenced by ScTabViewShell::Construct(), ScXMLExport::ExportAutoStyles_(), ScXMLExport::ExportExternalRefCacheStyles(), ScDocShell::PrepareSaveGuard::PrepareSaveGuard(), and ScDocShell::PrepareSaveGuard::~PrepareSaveGuard().
bool ScExternalRefManager::hasExternalFile | ( | sal_uInt16 | nFileId | ) | const |
Definition at line 2780 of file externalrefmgr.cxx.
References maSrcFiles.
Referenced by ScExternalDocLinksObj::getByIndex(), ScExternalDocLinksObj::getByName(), and ScExternalDocLinksObj::hasByName().
bool ScExternalRefManager::hasExternalFile | ( | const OUString & | rFile | ) | const |
Definition at line 2785 of file externalrefmgr.cxx.
References maSrcFiles.
Definition at line 2144 of file externalrefmgr.cxx.
References ScDocument::GetFormulaCell(), maRefCells, and mrDoc.
Referenced by getDoubleRefTokens(), getRangeNameTokens(), and getSingleRefToken().
void ScExternalRefManager::insertRefCellFromTemplate | ( | ScFormulaCell * | pTemplateCell, |
ScFormulaCell * | pCell | ||
) |
Add a cell to reference the same files as the template cell.
Definition at line 2162 of file externalrefmgr.cxx.
References maRefCells.
Referenced by ScFormulaCell::CompileXML().
bool ScExternalRefManager::isFileLoadable | ( | const OUString & | rFile | ) | const |
Check if the file specified by the path is a legitimate file that exists & can be loaded.
Definition at line 2566 of file externalrefmgr.cxx.
References utl::UCBContentHelper::Exists(), utl::UCBContentHelper::IsFolder(), and isOwnDocument().
Referenced by ScExternalRefLink::DataChanged(), and loadSrcDocument().
|
inline |
Definition at line 533 of file externalrefmgr.hxx.
bool ScExternalRefManager::isOwnDocument | ( | std::u16string_view | rFile | ) | const |
Definition at line 2690 of file externalrefmgr.cxx.
References getOwnDocumentName().
Referenced by isFileLoadable(), and lcl_ScAddress_Parse_OOo().
bool ScExternalRefManager::isValidRangeName | ( | sal_uInt16 | nFileId, |
const OUString & | rName | ||
) |
Definition at line 2074 of file externalrefmgr.cxx.
References getInMemorySrcDocument(), getSrcDocument(), ScExternalRefCache::isValidRangeName(), maRefCache, maybeLinkExternalFile(), and ScExternalRefCache::setRangeName().
Referenced by ScCompiler::IsExternalNamedRange().
|
private |
Definition at line 2440 of file externalrefmgr.cxx.
References aStr, tools::SvRef< T >::clear(), SfxObjectShell::DoClose(), SfxObjectShell::DoLoad(), ScDocument::EnableExecuteLink(), ScDocument::EnableUndo(), ScDocument::EnableUserInteraction(), ERRCODE_NONE, ScExtDocOptions::GetDocSettings(), ScDocShell::GetDocument(), ScDocument::GetDocumentShell(), ScDocument::GetExtDocOptions(), getExternalFileData(), ScDocumentLoader::GetFilterName(), SfxMedium::GetItemSet(), SfxItemSet::GetItemState(), INetURLObject::GetMainURL(), SfxObjectShell::GetMedium(), ScDocumentLoader::GetOptions(), getOwnDocumentName(), GetValue, if(), INetURLObject::insertName(), isFileLoadable(), ScDocument::LockAdjustHeight(), ScExternalRefManager::SrcFileData::maFileName, ScExternalRefManager::SrcFileData::maFilterName, ScExternalRefManager::SrcFileData::maFilterOptions, ScExternalRefManager::SrcFileData::maRealFileName, ScExternalRefManager::SrcFileData::maRelativeName, maybeCreateRealFileName(), mbUserInteractionEnabled, ScExtDocSettings::mnLinkCnt, mrDoc, INetURLObject::NONE, ScDocument::SetExtDocOptions(), setFilterData(), setRelativeFileName(), SfxGetpApp(), and URIHelper::simpleNormalizedMakeRelative().
Referenced by getSrcDocument(), and refreshSrcDocument().
void ScExternalRefManager::markUsedByLinkListeners | ( | ) |
Mark all tables as referenced that are used by any LinkListener, used only during store-to-file.
Definition at line 1711 of file externalrefmgr.cxx.
References maLinkListeners, maRefCache, and ScExternalRefCache::setCacheDocReferenced().
void ScExternalRefManager::markUsedExternalRefCells | ( | ) |
Definition at line 1727 of file externalrefmgr.cxx.
References maRefCells, and ScFormulaCell::MarkUsedExternalReferences().
|
private |
Try to create a "real" file name from the relative path.
The original file name may not point to the real document when the referencing and referenced documents have been moved.
For the real file name to be created, the relative name should not be empty before calling this method, or the real file name will not be created.
nFileId | file ID for an external document |
Definition at line 2665 of file externalrefmgr.cxx.
References getOwnDocumentName(), and maSrcFiles.
Referenced by getExternalFileName(), and loadSrcDocument().
|
private |
Definition at line 2588 of file externalrefmgr.cxx.
References sfx2::ClientFile, getExternalFileData(), getExternalFileName(), ScDocumentLoader::GetFilterName(), ScDocument::GetLinkManager(), sfx2::LinkManager::InsertFileLink(), ScExternalRefManager::SrcFileData::maFilterName, ScExternalRefManager::SrcFileData::maFilterOptions, maLinkedDocs, mrDoc, pLink, SAL_WARN, ScExternalRefLink::SetDoRefresh(), and sfx2::SvBaseLink::Update().
Referenced by addFilesToLinkManager(), getDoubleRefTokens(), getRangeNameTokens(), getSingleRefToken(), and isValidRangeName().
|
overridevirtual |
Reimplemented from SfxListener.
Definition at line 3197 of file externalrefmgr.cxx.
References Application::CreateMessageDialog(), ScDocShell::GetActiveDialogParent(), SfxEventHint::GetEventId(), ScResId(), and transformUnsavedRefToSavedRef().
void ScExternalRefManager::notifyAllLinkListeners | ( | sal_uInt16 | nFileId, |
LinkUpdateType | eType | ||
) |
Notify all listeners that are listening to a specified external document.
nFileId | file ID for an external document. |
Definition at line 3123 of file externalrefmgr.cxx.
References o3tl::sorted_vector< Value, Compare, Find, class >::begin(), o3tl::sorted_vector< Value, Compare, Find, class >::end(), and maLinkListeners.
Referenced by breakLink(), and refreshSrcDocument().
|
private |
Purge those source document instances that have not been accessed for the specified duration.
nTimeOut | time out value in 100th of a second |
Definition at line 3134 of file externalrefmgr.cxx.
References GetTime(), maDocShells, maSrcDocTimer, Task::Stop(), and tools::Time::SYSTEM.
Referenced by IMPL_LINK().
|
private |
Definition at line 2107 of file externalrefmgr.cxx.
References ScDocShell::GetViewData(), SfxShell::GetViewShell(), SfxShell::Invalidate(), maRefCells, and ScTabView::PaintGrid().
Referenced by refreshSrcDocument().
bool ScExternalRefManager::refreshSrcDocument | ( | sal_uInt16 | nFileId | ) |
Definition at line 2914 of file externalrefmgr.cxx.
References cacheNewDocShell(), ScExternalRefCache::clearCacheTables(), sc::ColumnSpanSet::executeColumnAction(), ScExternalRefCache::getAllCachedDataSpans(), ScDocShell::GetDocument(), ScDocument::GetSharedStringPool(), tools::SvRef< T >::is(), LINK_MODIFIED, loadSrcDocument(), maDocShells, ScExternalRefManager::SrcShell::maLastAccess, maRefCache, ScExternalRefManager::SrcShell::maShell, mrDoc, notifyAllLinkListeners(), refreshAllRefCells(), and tools::Time::SYSTEM.
Referenced by ScExternalRefLink::DataChanged(), and switchSrcFile().
void ScExternalRefManager::removeLinkListener | ( | sal_uInt16 | nFileId, |
LinkListener * | pListener | ||
) |
Remove an existing link listener.
Note that removing a listener pointer here does not delete the listener object instance.
Definition at line 3102 of file externalrefmgr.cxx.
References o3tl::sorted_vector< Value, Compare, Find, class >::empty(), o3tl::sorted_vector< Value, Compare, Find, class >::erase(), and maLinkListeners.
Referenced by ScChart2DataSequence::StopListeningToAllExternalRefs(), ScChartListener::ExternalRefListener::~ExternalRefListener(), and ScChartListener::~ScChartListener().
void ScExternalRefManager::removeLinkListener | ( | LinkListener * | pListener | ) |
Definition at line 3117 of file externalrefmgr.cxx.
References maLinkListeners.
void ScExternalRefManager::removeRefCell | ( | ScFormulaCell * | pCell | ) |
Stop tracking a specific formula cell.
pCell | pointer to cell that formerly contained external reference. |
Definition at line 3077 of file externalrefmgr.cxx.
References maRefCells.
Referenced by ScFormulaCell::~ScFormulaCell().
void ScExternalRefManager::resetSrcFileData | ( | const OUString & | rBaseFileUrl | ) |
Re-generates relative names for all stored source files.
This is necessary when exporting to an ods document, to ensure that all source files have their respective relative names for xlink:href export.
rBaseFileUrl | Absolute URL of the content.xml fragment of the document being exported. |
Definition at line 3048 of file externalrefmgr.cxx.
References maSrcFiles, and URIHelper::simpleNormalizedMakeRelative().
Referenced by ScXMLExport::WriteExternalRefCaches().
void ScExternalRefManager::setAllCacheTableReferencedStati | ( | bool | bReferenced | ) |
Definition at line 1746 of file externalrefmgr.cxx.
References maRefCache, mbInReferenceMarking, and ScExternalRefCache::setAllCacheTableReferencedStati().
Referenced by ScDocShell::PrepareSaveGuard::PrepareSaveGuard(), and ScDocShell::PrepareSaveGuard::~PrepareSaveGuard().
bool ScExternalRefManager::setCacheTableReferenced | ( | sal_uInt16 | nFileId, |
const OUString & | rTabName, | ||
size_t | nSheets | ||
) |
Set a table as referenced, used only during store-to-file.
Definition at line 1741 of file externalrefmgr.cxx.
References maRefCache, and ScExternalRefCache::setCacheTableReferenced().
void ScExternalRefManager::setFilterData | ( | sal_uInt16 | nFileId, |
const OUString & | rFilterName, | ||
const OUString & | rOptions | ||
) |
Set the filter name and options if any for a given source document.
These values get reset when the source document ever gets reloaded.
nFileId | |
rFilterName | |
rOptions |
Definition at line 3026 of file externalrefmgr.cxx.
References maSrcFiles.
Referenced by ScXMLExternalRefTabSourceContext::endFastElement(), and loadSrcDocument().
void ScExternalRefManager::setRelativeFileName | ( | sal_uInt16 | nFileId, |
const OUString & | rRelUrl | ||
) |
Set a relative file path for the specified file ID.
Note that the caller must ensure that the passed URL is a valid relative URL.
nFileId | file ID for an external document |
rRelUrl | relative URL |
Definition at line 3019 of file externalrefmgr.cxx.
References maSrcFiles.
Referenced by ScXMLExternalRefTabSourceContext::endFastElement(), and loadSrcDocument().
void ScExternalRefManager::setSkipUnusedFileIds | ( | std::vector< sal_uInt16 > & | pExternFileIds | ) |
Definition at line 2751 of file externalrefmgr.cxx.
References maConvertFileIdToUsedFileId, maSrcFiles, and mbSkipUnusedFileIds.
void ScExternalRefManager::storeRangeNameTokens | ( | sal_uInt16 | nFileId, |
const OUString & | rName, | ||
const ScTokenArray & | rArray | ||
) |
Definition at line 1752 of file externalrefmgr.cxx.
References ScTokenArray::Clone(), maRefCache, and ScExternalRefCache::setRangeNameTokens().
Referenced by XclImpExtName::CreateExtNameData().
void ScExternalRefManager::switchSrcFile | ( | sal_uInt16 | nFileId, |
const OUString & | rNewFile, | ||
const OUString & | rNewFilter | ||
) |
Definition at line 3005 of file externalrefmgr.cxx.
References maSrcFiles, and refreshSrcDocument().
Referenced by ScExternalRefLink::DataChanged(), and transformUnsavedRefToSavedRef().
|
private |
If in maUnsavedDocShells move it to maDocShells and create a correct external reference entry.
Pointer | to the newly saved DocumentShell |
Definition at line 3181 of file externalrefmgr.cxx.
References SfxListener::EndListening(), INetURLObject::GetMainURL(), SfxObjectShell::GetMedium(), SfxMedium::GetURLObject(), maUnsavedDocShells, switchSrcFile(), and INetURLObject::ToIUri.
Referenced by Notify().
void ScExternalRefManager::updateAbsAfterLoad | ( | ) |
Replace the original URL with the real URL that was generated from the relative URL.
Definition at line 3062 of file externalrefmgr.cxx.
References getOwnDocumentName(), and maSrcFiles.
Referenced by ScXMLImport::endDocument().
|
private |
Definition at line 856 of file externalrefmgr.hxx.
Referenced by convertFileIdToUsedFileId(), and setSkipUnusedFileIds().
|
private |
Source document cache.
This stores the original source document shell instances. They get purged after a certain period of time.
Definition at line 819 of file externalrefmgr.hxx.
Referenced by breakLink(), cacheNewDocShell(), clear(), enableDocTimer(), getSrcDocument(), purgeStaleSrcDocument(), and refreshSrcDocument().
|
private |
list of source documents that are managed by the link manager.
Definition at line 828 of file externalrefmgr.hxx.
Referenced by breakLink(), and maybeLinkExternalFile().
|
private |
Definition at line 836 of file externalrefmgr.hxx.
Referenced by addLinkListener(), markUsedByLinkListeners(), notifyAllLinkListeners(), and removeLinkListener().
|
private |
Definition at line 838 of file externalrefmgr.hxx.
Referenced by getMappedNumberFormat().
|
private |
cache of referenced ranges and names from source documents.
Definition at line 813 of file externalrefmgr.hxx.
Referenced by cacheNewDocShell(), clearCache(), getAllCachedNumberFormats(), getAllCachedTableNames(), getCachedTabSpan(), getCacheTable(), getCacheTableName(), getDoubleRefTokens(), getInMemorySrcDocument(), getRangeNameTokens(), getRealRangeName(), getRealTableName(), getSingleRefToken(), getSrcDocTable(), isValidRangeName(), markUsedByLinkListeners(), refreshSrcDocument(), setAllCacheTableReferencedStati(), setCacheTableReferenced(), and storeRangeNameTokens().
|
private |
List of referencing cells that may contain external names.
There is one list per source document.
Definition at line 834 of file externalrefmgr.hxx.
Referenced by breakLink(), hasCellExternalReference(), insertRefCell(), insertRefCellFromTemplate(), markUsedExternalRefCells(), refreshAllRefCells(), and removeRefCell().
|
private |
Definition at line 860 of file externalrefmgr.hxx.
Referenced by breakLink(), cacheNewDocShell(), clear(), enableDocTimer(), IMPL_LINK(), purgeStaleSrcDocument(), and ScExternalRefManager().
|
private |
List of external source document meta-data, used to keep track of external document identifiers.
Definition at line 844 of file externalrefmgr.hxx.
Referenced by addFilesToLinkManager(), getAllCachedExternalFileNames(), getExternalFileCount(), getExternalFileData(), getExternalFileId(), getExternalFileName(), hasExternalData(), hasExternalFile(), maybeCreateRealFileName(), resetSrcFileData(), setFilterData(), setRelativeFileName(), setSkipUnusedFileIds(), switchSrcFile(), and updateAbsAfterLoad().
|
private |
DocShells to unsaved but referenced documents.
If not empty ask before saving! Move to maDocShells if document referenced here is saved
Definition at line 825 of file externalrefmgr.hxx.
Referenced by getInMemorySrcDocument(), getSrcDocument(), and transformUnsavedRefToSavedRef().
|
private |
Definition at line 858 of file externalrefmgr.hxx.
Referenced by cacheNewDocShell(), and enableDocTimer().
|
private |
Status whether in reference marking state.
Definition at line 847 of file externalrefmgr.hxx.
Referenced by setAllCacheTableReferencedStati().
|
private |
Definition at line 855 of file externalrefmgr.hxx.
Referenced by convertFileIdToUsedFileId(), disableSkipUnusedFileIds(), and setSkipUnusedFileIds().
|
private |
Controls whether or not to allow user interaction.
We don't want any user interaction when calling from the API.
Definition at line 853 of file externalrefmgr.hxx.
Referenced by ScExternalRefManager::ApiGuard::ApiGuard(), and loadSrcDocument().
|
private |
Definition at line 810 of file externalrefmgr.hxx.
Referenced by breakLink(), convertToAbsName(), fillCellFormat(), getDoubleRefTokensFromSrcDoc(), getInMemorySrcDocument(), getMappedNumberFormat(), getOwnDocumentName(), getSingleRefToken(), getSingleRefTokenFromSrcDoc(), getSrcDocument(), hasCellExternalReference(), insertRefCell(), loadSrcDocument(), maybeLinkExternalFile(), and refreshSrcDocument().