diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-20 00:59:29 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-21 13:25:20 -0400 |
commit | c28aadc7fcb1858acc2e59a875e0a4c9071681ed (patch) | |
tree | be02133f96d41e07f678967c83422f11e52172c4 /sc/source/ui/docshell | |
parent | 1b243b14e9715b7b7da6359b5b752ee6d8278731 (diff) |
cp#1000072: Stop the external doc shell timer while mass-updating.
To prevent collision with the timer wanting to purge the doc cache
while updating external links.
Also, show progress bar, and make the timer interval and the document
cache life span longer.
Change-Id: I325984c8fa68425a2621cf8f9c016463291afc89
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/externalrefmgr.cxx | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 549549a64c42..ded749f222d4 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -71,8 +71,8 @@ using ::std::list; using ::std::unary_function; using namespace formula; -#define SRCDOC_LIFE_SPAN 6000 // 1 minute (in 100th of a sec) -#define SRCDOC_SCAN_INTERVAL 1000*5 // every 5 seconds (in msec) +#define SRCDOC_LIFE_SPAN 30000 // 5 minutes (in 100th of a sec) +#define SRCDOC_SCAN_INTERVAL 1000*30 // every 30 seconds (in msec) namespace { @@ -1537,7 +1537,8 @@ static ScTokenArray* lcl_fillEmptyMatrix(const ScRange& rRange) ScExternalRefManager::ScExternalRefManager(ScDocument* pDoc) : mpDoc(pDoc), mbInReferenceMarking(false), - mbUserInteractionEnabled(true) + mbUserInteractionEnabled(true), + mbDocTimerEnabled(true) { maSrcDocTimer.SetTimeoutHdl( LINK(this, ScExternalRefManager, TimeOutHdl) ); maSrcDocTimer.SetTimeout(SRCDOC_SCAN_INTERVAL); @@ -2009,6 +2010,27 @@ void ScExternalRefManager::insertRefCell(sal_uInt16 nFileId, const ScAddress& rC itr->second.insert(pCell); } +void ScExternalRefManager::enableDocTimer( bool bEnable ) +{ + if (mbDocTimerEnabled == bEnable) + return; + + mbDocTimerEnabled = bEnable; + if (mbDocTimerEnabled) + { + if (!maDocShells.empty()) + { + DocShellMap::iterator it = maDocShells.begin(), itEnd = maDocShells.end(); + for (; it != itEnd; ++it) + it->second.maLastAccess = Time(Time::SYSTEM); + + maSrcDocTimer.Start(); + } + } + else + maSrcDocTimer.Stop(); +} + void ScExternalRefManager::fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCache::CellFormat* pFmt) const { if (!pFmt) @@ -2331,7 +2353,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt ScDocument* ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell& rSrcShell ) { - if (maDocShells.empty()) + if (mbDocTimerEnabled && maDocShells.empty()) // If this is the first source document insertion, start up the timer. maSrcDocTimer.Start(); |