summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-02-03 00:12:23 +0100
committerMichael Stahl <mstahl@redhat.com>2014-02-03 12:34:07 +0100
commit6ef04640ab92ce69000dcff3071eaef4419a9af6 (patch)
tree60aeee18c60f1922cb73ad2dc3cd11c3a7e3c5cb /svtools
parent2d9d20edc999ef2c2ad2ee628a6a5f27efb801d8 (diff)
remove GraphicObject::SetSwapStreamHdl() timeout parameter
Every call to SetSwapStreamHdl uses the same timeout now so move the function that determines that to svtools. Change-Id: Ib7395d43dd132a9e14e7a7862ff2c2279f319536
Diffstat (limited to 'svtools')
-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 )