summaryrefslogtreecommitdiff
path: root/svtools/source/graphic/grfmgr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/graphic/grfmgr.cxx')
-rw-r--r--svtools/source/graphic/grfmgr.cxx42
1 files changed, 41 insertions, 1 deletions
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index e6811764e087..41049c7afb0f 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -415,10 +415,50 @@ void GraphicObject::SetSwapStreamHdl()
}
}
-void GraphicObject::SetSwapStreamHdl( const Link& rHdl, const sal_uLong nSwapOutTimeout )
+#define SWAPGRAPHIC_TIMEOUT 5000
+
+// #i122985# it is not correct to set the swap-timeout to a hard-coded 5000ms
+// as it was before. Added code and experimented what to do as a good
+// compromise, see description.
+static sal_uInt32 GetCacheTimeInMs()
+{
+ static bool bSetAtAll(true);
+
+ if (bSetAtAll)
+ {
+ static bool bSetToPreferenceTime(true);
+
+ if (bSetToPreferenceTime)
+ {
+ const sal_uInt32 nSeconds =
+ officecfg::Office::Common::Cache::GraphicManager::ObjectReleaseTime::get(
+ comphelper::getProcessComponentContext());
+
+
+ // The default is 10 minutes. The minimum is one minute, thus 60
+ // seconds. When the minimum should match to the former hard-coded
+ // 5 seconds, we have a divisor of 12 to use. For the default of 10
+ // minutes this would mean 50 seconds. Compared to before this is
+ // ten times more (would allow better navigation by switching
+ // through pages) and is controllable by the user by setting the
+ // tools/options/memory/Remove_from_memory_after setting. Seems to
+ // be a good compromise to me.
+ return nSeconds * 1000 / 12;
+ }
+ else
+ {
+ return SWAPGRAPHIC_TIMEOUT;
+ }
+ }
+
+ return 0;
+}
+
+void GraphicObject::SetSwapStreamHdl(const Link& rHdl)
{
delete mpSwapStreamHdl, mpSwapStreamHdl = new Link( rHdl );
+ sal_uInt32 const nSwapOutTimeout(GetCacheTimeInMs());
if( nSwapOutTimeout )
{
if( !mpSwapOutTimer )