LibreOffice Module sc (master) 1
externalrefmgr.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include "address.hxx"
23#include "document.hxx"
24#include <sfx2/objsh.hxx>
25#include <sfx2/lnkbase.hxx>
26#include <tools/time.hxx>
27#include <vcl/timer.hxx>
28#include <svl/zforlist.hxx>
29#include <svl/lstner.hxx>
30#include "types.hxx"
31#include "rangelst.hxx"
32#include <osl/mutex.hxx>
33#include <formula/types.hxx>
34#include <tools/solar.h>
35
36#include <memory>
37#include <mutex>
38#include <unordered_map>
39#include <unordered_set>
40#include <vector>
41#include <set>
44
45class ScTokenArray;
46namespace weld { class Window; }
47
48class ScFormulaCell;
49
50namespace sc {
51
52class ColumnSpanSet;
53
54}
55
57{
58public:
59 ScExternalRefLink(ScDocument& rDoc, sal_uInt16 nFileId);
60 virtual ~ScExternalRefLink() override;
61
62 virtual void Closed() override;
63 virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
64 const OUString& rMimeType, const css::uno::Any & rValue) override;
65 virtual void Edit(weld::Window* pParent, const Link<SvBaseLink&,void>& rEndEditHdl) override;
66
67 void SetDoRefresh(bool b);
68
69private:
72
73 sal_uInt16 mnFileId;
76};
77
82{
83public:
85 typedef std::shared_ptr<ScTokenArray> TokenArrayRef;
86
87 struct TableName
88 {
89 OUString maUpperName;
90 OUString maRealName;
91
92 explicit TableName(OUString aUpper, OUString aReal);
93 };
94
96 {
97 bool mbIsSet;
100
101 explicit CellFormat();
102 };
103
104private:
106 struct Cell
107 {
110 };
111 typedef std::unordered_map<SCCOL, Cell> RowDataType;
112 typedef std::unordered_map<SCROW, RowDataType> RowsDataType;
113
114public:
124 class Table
125 {
126 public:
127
128 Table();
129 ~Table();
130
131 void clear();
132
140 SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef const & pToken, sal_uLong nFmtIndex = 0, bool bSetCacheRange = true);
141 SC_DLLPUBLIC TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex = nullptr) const;
142 bool hasRow( SCROW nRow ) const;
145 void setReferenced( bool bReferenced );
146 bool isReferenced() const;
148 void getAllRows(::std::vector<SCROW>& rRows, SCROW nLow, SCROW nHigh) const;
149 void getAllRows(::std::vector<SCROW>& rRows) const;
151 SC_DLLPUBLIC ::std::pair< SCROW, SCROW > getRowRange() const;
153 void getAllCols(SCROW nRow, ::std::vector<SCCOL>& rCols, SCCOL nLow, SCCOL nHigh) const;
154 void getAllCols(SCROW nRow, ::std::vector<SCCOL>& rCols) const;
156 SC_DLLPUBLIC ::std::pair< SCCOL, SCCOL > getColRange( SCROW nRow ) const;
157 void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const;
158 bool isRangeCached(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
159
160 void setCachedCell(SCCOL nCol, SCROW nRow);
161 void setCachedCellRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
162
171 private:
172 bool isInCachedRanges(SCCOL nCol, SCROW nRow) const;
173 TokenRef getEmptyOrNullToken(SCCOL nCol, SCROW nRow) const;
174 template< typename P >
175 void getAllRows(::std::vector<SCROW>& rRows, P predicate) const;
176 template< typename P >
177 void getAllCols(SCROW nRow, ::std::vector<SCCOL>& rCols, P predicate) const;
178
179 private:
186 };
187
188 typedef std::shared_ptr<Table> TableTypeRef;
189 typedef std::unordered_map< OUString, size_t>
191
192 ScExternalRefCache(const ScDocument& rDoc);
194
195 const OUString* getRealTableName(sal_uInt16 nFileId, const OUString& rTabName) const;
196 const OUString* getRealRangeName(sal_uInt16 nFileId, const OUString& rRangeName) const;
197
209 sal_uInt16 nFileId, const OUString& rTabName, SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex);
210
219 sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange);
220
221 ScExternalRefCache::TokenArrayRef getRangeNameTokens(sal_uInt16 nFileId, const OUString& rName);
222 void setRangeNameTokens(sal_uInt16 nFileId, const OUString& rName, TokenArrayRef pArray);
223 bool isValidRangeName(sal_uInt16 nFileId, const OUString& rName) const;
224 void setRangeName(sal_uInt16 nFileId, const OUString& rName);
225
226 void setCellData(sal_uInt16 nFileId, const OUString& rTabName,
227 SCCOL nCol, SCROW nRow, TokenRef const & pToken, sal_uLong nFmtIndex);
228
230 {
232 OUString maTableName;
234 };
235 void setCellRangeData(sal_uInt16 nFileId, const ScRange& rRange, const ::std::vector<SingleRangeData>& rData,
236 const TokenArrayRef& pArray);
237
238 bool isDocInitialized(sal_uInt16 nFileId);
239 void initializeDoc(sal_uInt16 nFileId, const ::std::vector<OUString>& rTabNames, const OUString& rBaseName);
240 OUString getTableName(sal_uInt16 nFileId, size_t nCacheId) const;
241 void getAllTableNames(sal_uInt16 nFileId, ::std::vector<OUString>& rTabNames) const;
242 SCTAB getTabSpan( sal_uInt16 nFileId, const OUString& rStartTabName, const OUString& rEndTabName ) const;
243 void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const;
244
250 bool setCacheDocReferenced( sal_uInt16 nFileId );
251
256 bool setCacheTableReferenced( sal_uInt16 nFileId, const OUString& rTabName, size_t nSheets );
257 void setAllCacheTableReferencedStati( bool bReferenced );
259
265 void getAllCachedDataSpans( const ScDocument& rSrcDoc, sal_uInt16 nFileId, sc::ColumnSpanSet& rSet ) const;
266
267 bool getSrcDocTable( const ScDocument& rSrcDoc, const OUString& rTabName, SCTAB& rTab, sal_uInt16 nFileId ) const;
268
269private:
271 {
273 {
274 ::std::vector<bool> maTables;
276 // Initially, documents have no tables but all referenced.
278 };
279 typedef ::std::vector<DocReferenced> DocReferencedVec;
280
283
285 void reset( size_t nDocs );
286 void checkAllDocs();
287
289 void addCacheTableToReferenced( sal_uInt16 nFileId, size_t nIndex );
290 void addCacheDocToReferenced( sal_uInt16 nFileId );
291public:
292
293 ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const;
294 ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, const OUString& rTabName, bool bCreateNew,
295 size_t* pnIndex, const OUString* pExtUrl);
296
300 void clearCache(sal_uInt16 nFileId);
301
306 void clearCacheTables(sal_uInt16 nFileId);
307
308 // Get the doc used to pass to methods that need an ScDocument in order to do row/col validation
309 const ScDocument& getDoc() const { return mrDoc; }
310
311private:
313 {
314 size_t operator()(const ScRange& rRange) const
315 {
316 const ScAddress& s = rRange.aStart;
317 const ScAddress& e = rRange.aEnd;
318 size_t hash = 17;
319 hash = hash * 37 + s.Tab();
320 hash = hash * 37 + s.Col();
321 hash = hash * 37 + s.Row();
322 hash = hash * 37 + e.Tab();
323 hash = hash * 37 + e.Col();
324 hash = hash * 37 + e.Row();
325 return hash;
326 }
327 };
328
329 typedef std::unordered_map<OUString, TokenArrayRef> RangeNameMap;
330 typedef std::unordered_map<ScRange, TokenArrayRef, RangeHash> RangeArrayMap;
331 typedef std::unordered_map<OUString, OUString> NamePairMap;
332
334 struct DocItem
335 {
337 ::std::vector<TableTypeRef> maTables;
339 ::std::vector<TableName> maTableNames;
348
353
355
357
358 TableNameIndexMap::const_iterator findTableNameIndex( const OUString& rTabName ) const;
359 bool getTableDataIndex( const OUString& rTabName, size_t& rIndex ) const;
360 bool getSingleTableNameAlternative( OUString& rTabName ) const;
361 };
362 typedef std::unordered_map<sal_uInt16, DocItem> DocDataType;
363 DocItem* getDocItem(sal_uInt16 nFileId) const;
364 DocItem* getDocItem(std::unique_lock<std::mutex>& rGuard, sal_uInt16 nFileId) const;
365
366private:
367 mutable std::mutex maMtxDocs;
370};
371
373{
374public:
375
376 typedef std::set<ScFormulaCell*> RefCellSet;
377 typedef std::unordered_map<sal_uInt16, RefCellSet> RefCellMap;
378
379 enum LinkUpdateType { LINK_MODIFIED, LINK_BROKEN, OH_NO_WE_ARE_GOING_TO_DIE };
380
386 class SAL_DLLPRIVATE LinkListener
387 {
388 public:
389 LinkListener();
390 virtual ~LinkListener() COVERITY_NOEXCEPT_FALSE = 0;
391 virtual void notify(sal_uInt16 nFileId, LinkUpdateType eType) = 0;
392 };
393
400 {
401 public:
402 ApiGuard(const ScDocument& rDoc);
403 ~ApiGuard();
404 private:
407 };
408
409private:
411 struct SrcShell
412 {
415
416 SrcShell() : maLastAccess( tools::Time::SYSTEM ) {}
417 };
418
419 typedef std::unordered_map<sal_uInt16, SrcShell> DocShellMap;
420 typedef std::unordered_map<sal_uInt16, bool> LinkedDocMap;
421
422 typedef std::unordered_map<sal_uInt16, SvNumberFormatterMergeMap> NumFmtMap;
423
425 typedef std::unordered_map<sal_uInt16, LinkListeners> LinkListenerMap;
426
427public:
429 struct SAL_DLLPRIVATE SrcFileData
430 {
431 OUString maFileName;
432 OUString maRealFileName;
434 OUString maFilterName;
436
437 void maybeCreateRealFileName(std::u16string_view rOwnDocName);
438 };
439
440public:
441 explicit ScExternalRefManager(ScDocument& rDoc);
442 virtual ~ScExternalRefManager() override;
443
444 virtual OUString getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const override;
445
456 ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const;
457
482 ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, const OUString& rTabName, bool bCreateNew,
483 size_t* pnIndex = nullptr, const OUString* pExtUrl = nullptr);
484
491 void getAllCachedTableNames(sal_uInt16 nFileId, ::std::vector<OUString>& rTabNames) const;
492
508 SCTAB getCachedTabSpan(
509 sal_uInt16 nFileId, const OUString& rStartTabName, const OUString& rEndTabName) const;
510
517 void getAllCachedNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const;
518
519 sal_uInt16 getExternalFileCount() const;
520
525 void markUsedByLinkListeners();
526
527 void markUsedExternalRefCells();
528
533 bool setCacheTableReferenced( sal_uInt16 nFileId, const OUString& rTabName, size_t nSheets );
534 void setAllCacheTableReferencedStati( bool bReferenced );
535
540 bool isInReferenceMarking() const { return mbInReferenceMarking; }
541
542 void storeRangeNameTokens(sal_uInt16 nFileId, const OUString& rName, const ScTokenArray& rArray);
543
544 ScExternalRefCache::TokenRef getSingleRefToken(
545 sal_uInt16 nFileId, const OUString& rTabName, const ScAddress& rCell,
546 const ScAddress* pCurPos, SCTAB* pTab, ScExternalRefCache::CellFormat* pFmt = nullptr);
547
561 ScExternalRefCache::TokenArrayRef getDoubleRefTokens(
562 sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange, const ScAddress* pCurPos);
563
575 ScExternalRefCache::TokenArrayRef getRangeNameTokens(
576 sal_uInt16 nFileId, const OUString& rName, const ScAddress* pCurPos = nullptr);
577
578 bool isValidRangeName(sal_uInt16 nFileId, const OUString& rName);
579
580 OUString getOwnDocumentName() const;
581 bool isOwnDocument(std::u16string_view rFile) const;
582
589 void convertToAbsName(OUString& rFile) const;
590 sal_uInt16 getExternalFileId(const OUString& rFile);
591
605 const OUString* getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal = false);
606
610 sal_uInt16 convertFileIdToUsedFileId(sal_uInt16 nFileId);
611 void setSkipUnusedFileIds(std::vector<sal_uInt16>& pExternFileIds);
612 void disableSkipUnusedFileIds();
613
618 std::vector<OUString> getAllCachedExternalFileNames() const;
619
620 bool hasExternalFile(sal_uInt16 nFileId) const;
621 bool hasExternalFile(const OUString& rFile) const;
622 const SrcFileData* getExternalFileData(sal_uInt16 nFileId) const;
623
624 const OUString* getRealTableName(sal_uInt16 nFileId, const OUString& rTabName) const;
625 const OUString* getRealRangeName(sal_uInt16 nFileId, const OUString& rRangeName) const;
626 void clearCache(sal_uInt16 nFileId);
627 bool refreshSrcDocument(sal_uInt16 nFileId);
628 void breakLink(sal_uInt16 nFileId);
629 void switchSrcFile(sal_uInt16 nFileId, const OUString& rNewFile, const OUString& rNewFilter);
630
638 void setRelativeFileName(sal_uInt16 nFileId, const OUString& rRelUrl);
639
648 void setFilterData(sal_uInt16 nFileId, const OUString& rFilterName, const OUString& rOptions);
649
650 void clear();
651
652 bool hasExternalData() const;
653
662 void resetSrcFileData(const OUString& rBaseFileUrl);
663
667 void updateAbsAfterLoad();
668
675 void removeRefCell(ScFormulaCell* pCell);
676
682 void addLinkListener(sal_uInt16 nFileId, LinkListener* pListener);
683
688 void removeLinkListener(sal_uInt16 nFileId, LinkListener* pListener);
689
690 void removeLinkListener(LinkListener* pListener);
691
698 void notifyAllLinkListeners(sal_uInt16 nFileId, LinkUpdateType eType);
699
704 bool isFileLoadable(const OUString& rFile) const;
705
706 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
707
713 bool containsUnsavedReferences() const { return !maUnsavedDocShells.empty(); }
714
715 void insertRefCell(sal_uInt16 nFileId, const ScAddress& rCell);
719 void insertRefCellFromTemplate( ScFormulaCell* pTemplateCell, ScFormulaCell* pCell );
720
721 bool hasCellExternalReference(const ScAddress& rCell);
722
723 void enableDocTimer( bool bEnable );
724
726 void addFilesToLinkManager();
727
728private:
730
731 void refreshAllRefCells(sal_uInt16 nFileId);
732
733 void fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCache::CellFormat* pFmt) const;
734
735 bool getSrcDocTable( const ScDocument& rSrcDoc, const OUString& rTabName, SCTAB& rTab, sal_uInt16 nFileId ) const;
736
737 ScExternalRefCache::TokenRef getSingleRefTokenFromSrcDoc(
738 sal_uInt16 nFileId, ScDocument& rSrcDoc, const ScAddress& rPos,
740
755 ScExternalRefCache::TokenArrayRef getDoubleRefTokensFromSrcDoc(
756 const ScDocument& rSrcDoc, const OUString& rTabName, ScRange& rRange,
757 ::std::vector<ScExternalRefCache::SingleRangeData>& rCacheData);
758
771 static ScExternalRefCache::TokenArrayRef getRangeNameTokensFromSrcDoc(
772 sal_uInt16 nFileId, const ScDocument& rSrcDoc, OUString& rName);
773
774 ScDocument* getInMemorySrcDocument(sal_uInt16 nFileId);
775 ScDocument* getSrcDocument(sal_uInt16 nFileId);
776 SfxObjectShellRef loadSrcDocument(sal_uInt16 nFileId, OUString& rFilter);
777
781 ScDocument& cacheNewDocShell( sal_uInt16 nFileId, SrcShell& rSrcShell );
782
783 void maybeLinkExternalFile( sal_uInt16 nFileId, bool bDeferFilterDetection = false );
784
796 void maybeCreateRealFileName(sal_uInt16 nFileId);
797
804 void purgeStaleSrcDocument(sal_Int32 nTimeOut);
805
806 sal_uInt32 getMappedNumberFormat(sal_uInt16 nFileId, sal_uInt32 nNumFmt, const ScDocument& rSrcDoc);
807
814 void transformUnsavedRefToSavedRef( SfxObjectShell* pShell );
815
816private:
818
821
827
833
836
842
844
846
851 std::vector<SrcFileData> maSrcFiles;
852
855
861
862 bool mbSkipUnusedFileIds = false;
863 std::vector<sal_uInt16> maConvertFileIdToUsedFileId;
864
866
868 DECL_DLLPRIVATE_LINK(TimeOutHdl, Timer*, void);
869};
870
871/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
Represents a single cached table in an external document.
void getAllRows(::std::vector< SCROW > &rRows, SCROW nLow, SCROW nHigh) const
Obtain a sorted vector of rows.
bool hasRow(SCROW nRow) const
SC_DLLPUBLIC TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32 *pnFmtIndex=nullptr) const
void getAllNumberFormats(::std::vector< sal_uInt32 > &rNumFmts) const
bool isRangeCached(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
void getAllRows(::std::vector< SCROW > &rRows) const
void setReferenced(bool bReferenced)
Set/clear referenced status flag only if current status is not REFERENCED_PERMANENT.
SC_DLLPUBLIC void setWholeTableCached()
Call this to mark the entire table "cached".
SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef const &pToken, sal_uLong nFmtIndex=0, bool bSetCacheRange=true)
Add cell value to the cache.
void getAllCols(SCROW nRow, ::std::vector< SCCOL > &rCols, P predicate) const
bool isInCachedRanges(SCCOL nCol, SCROW nRow) const
void getAllRows(::std::vector< SCROW > &rRows, P predicate) const
TokenRef getEmptyOrNullToken(SCCOL nCol, SCROW nRow) const
void setCachedCellRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
void setCachedCell(SCCOL nCol, SCROW nRow)
SC_DLLPUBLIC ::std::pair< SCROW, SCROW > getRowRange() const
Returns the half-open range of used rows in this table. Returns [0,0) if table is empty.
SC_DLLPUBLIC ::std::pair< SCCOL, SCCOL > getColRange(SCROW nRow) const
Returns the half-open range of used columns in the specified row. Returns [0,0) if row is empty.
void getAllCols(SCROW nRow, ::std::vector< SCCOL > &rCols) const
ScRangeList maCachedRanges
Collection of individual cached ranges.
RowsDataType maRows
Data cache.
void getAllCols(SCROW nRow, ::std::vector< SCCOL > &rCols, SCCOL nLow, SCCOL nHigh) const
Obtain a sorted vector of columns.
Cache table for external reference data.
std::unordered_map< SCROW, RowDataType > RowsDataType
bool setCacheDocReferenced(sal_uInt16 nFileId)
Set all tables of a document as referenced, used only during store-to-file.
bool isValidRangeName(sal_uInt16 nFileId, const OUString &rName) const
bool isDocInitialized(sal_uInt16 nFileId)
void clearCache(sal_uInt16 nFileId)
Clear all caches including the cache tables.
const ScDocument & mrDoc
std::unordered_map< OUString, TokenArrayRef > RangeNameMap
std::shared_ptr< Table > TableTypeRef
std::unordered_map< OUString, OUString > NamePairMap
void getAllTableNames(sal_uInt16 nFileId, ::std::vector< OUString > &rTabNames) const
ScExternalRefCache::TokenArrayRef getCellRangeData(sal_uInt16 nFileId, const OUString &rTabName, const ScRange &rRange)
Get a cached cell range data.
std::unordered_map< OUString, size_t > TableNameIndexMap
DocItem * getDocItem(sal_uInt16 nFileId) const
ScExternalRefCache::TokenArrayRef getRangeNameTokens(sal_uInt16 nFileId, const OUString &rName)
void setRangeNameTokens(sal_uInt16 nFileId, const OUString &rName, TokenArrayRef pArray)
std::unordered_map< ScRange, TokenArrayRef, RangeHash > RangeArrayMap
void getAllNumberFormats(::std::vector< sal_uInt32 > &rNumFmts) const
struct ScExternalRefCache::ReferencedStatus maReferenced
void setAllCacheTableReferencedStati(bool bReferenced)
void setRangeName(sal_uInt16 nFileId, const OUString &rName)
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,...
bool setCacheTableReferenced(sal_uInt16 nFileId, const OUString &rTabName, size_t nSheets)
Set a table as referenced, used only during store-to-file.
const ScDocument & getDoc() const
void setCellRangeData(sal_uInt16 nFileId, const ScRange &rRange, const ::std::vector< SingleRangeData > &rData, const TokenArrayRef &pArray)
SCTAB getTabSpan(sal_uInt16 nFileId, const OUString &rStartTabName, const OUString &rEndTabName) const
void clearCacheTables(sal_uInt16 nFileId)
Clear all caches but keep the tables.
std::unordered_map< SCCOL, Cell > RowDataType
std::unordered_map< sal_uInt16, DocItem > DocDataType
void addCacheDocToReferenced(sal_uInt16 nFileId)
ScExternalRefCache(const ScDocument &rDoc)
void initializeDoc(sal_uInt16 nFileId, const ::std::vector< OUString > &rTabNames, const OUString &rBaseName)
void addCacheTableToReferenced(sal_uInt16 nFileId, size_t nIndex)
::formula::FormulaTokenRef TokenRef
OUString getTableName(sal_uInt16 nFileId, size_t nCacheId) const
const OUString * getRealRangeName(sal_uInt16 nFileId, const OUString &rRangeName) const
bool getSrcDocTable(const ScDocument &rSrcDoc, const OUString &rTabName, SCTAB &rTab, sal_uInt16 nFileId) 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.
bool areAllCacheTablesReferenced() const
const OUString * getRealTableName(sal_uInt16 nFileId, const OUString &rTabName) const
std::shared_ptr< ScTokenArray > TokenArrayRef
void setCellData(sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol, SCROW nRow, TokenRef const &pToken, sal_uLong nFmtIndex)
ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const
Use this guard when performing something from the API that might query values from external reference...
ScExternalRefManager * mpMgr
Base class for objects that need to listen to link updates.
virtual void notify(sal_uInt16 nFileId, LinkUpdateType eType)=0
std::unordered_map< sal_uInt16, SrcShell > DocShellMap
DocShellMap maUnsavedDocShells
DocShells to unsaved but referenced documents.
DocShellMap maDocShells
Source document cache.
ScExternalRefCache maRefCache
cache of referenced ranges and names from source documents.
LinkListenerMap maLinkListeners
std::unordered_map< sal_uInt16, RefCellSet > RefCellMap
bool containsUnsavedReferences() const
If we still contain unsaved files we should warn the user before saving.
LinkedDocMap maLinkedDocs
list of source documents that are managed by the link manager.
std::vector< sal_uInt16 > maConvertFileIdToUsedFileId
bool isInReferenceMarking() const
std::set< ScFormulaCell * > RefCellSet
std::unordered_map< sal_uInt16, SvNumberFormatterMergeMap > NumFmtMap
o3tl::sorted_vector< LinkListener * > LinkListeners
bool mbInReferenceMarking
Status whether in reference marking state.
RefCellMap maRefCells
List of referencing cells that may contain external names.
std::unordered_map< sal_uInt16, LinkListeners > LinkListenerMap
ScExternalRefManager(const ScExternalRefManager &)=delete
bool mbUserInteractionEnabled
Controls whether or not to allow user interaction.
std::vector< SrcFileData > maSrcFiles
List of external source document meta-data, used to keep track of external document identifiers.
std::unordered_map< sal_uInt16, bool > LinkedDocMap
DECL_DLLPRIVATE_LINK(TimeOutHdl, Timer *, void)
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
virtual OUString getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const=0
Structure that stores segments of boolean flags per column, and perform custom action on those segmen...
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
Definition: docsh.hxx:498
::boost::intrusive_ptr< FormulaToken > FormulaTokenRef
CAUTION! The following defines must be in the same namespace as the respective type.
Definition: broadcast.cxx:15
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
sal_uIntPtr sal_uLong
individual cell within cached external ref table.
Represents data cached for a single external document.
TableNameIndexMap::const_iterator findTableNameIndex(const OUString &rTabName) const
bool getTableDataIndex(const OUString &rTabName, size_t &rIndex) const
::std::vector< TableTypeRef > maTables
The raw cache tables.
TableNameIndexMap maTableNameIndex
Table name to index map.
RangeNameMap maRangeNames
Range name cache.
::std::vector< TableName > maTableNames
Table name list in correct order, in both upper- and real-case.
NamePairMap maRealRangeNameMap
Upper- to real-case mapping for range names.
OUString maSingleTableNameAlias
Either the base name that was stored as sheet name for CSV files if sheet name is Sheet1,...
bool getSingleTableNameAlternative(OUString &rTabName) const
RangeArrayMap maRangeArrays
Token array cache for cell ranges.
size_t operator()(const ScRange &rRange) const
::std::vector< DocReferenced > DocReferencedVec
OUString maTableName
This name must be in upper-case.
TableName(OUString aUpper, OUString aReal)
Source document meta-data container.
OUString maRealFileName
original file name as loaded from the file.
OUString maRelativeName
file name created from the relative name.
Shell instance for a source document.
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:25
sal_Int32 SCROW
Definition: types.hxx:17
SvNumFormatType