diff options
author | Oliver Specht <oliver.specht@cib.de> | 2015-12-17 11:17:36 +0100 |
---|---|---|
committer | Oliver Specht <oliver.specht@cib.de> | 2015-12-18 06:48:45 +0000 |
commit | dcca78f4a720e2d073e49e631b34af3210e0e27f (patch) | |
tree | ec913119dc91aebbd040286c933194af7ded4217 /cui | |
parent | 42645fe67cac22e9a96bc4b34c4f85c09185d9d2 (diff) |
tdf#93008: use up/down/loseFocusHdl and max cache value fixed
use up/down/loseFocusHdl prevents a change of object cache
value while writing
the max. cache value is now set to 2047 MB as this prevents an
overflow of the configuration value
Change-Id: Ib98f7181b10e2875b2037e425eced3f12ba4c0b6
Reviewed-on: https://gerrit.libreoffice.org/20766
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/options/optmemory.cxx | 19 | ||||
-rw-r--r-- | cui/source/options/optmemory.hxx | 3 |
2 files changed, 15 insertions, 7 deletions
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx index 8cd429800169..e3bc43783cd3 100644 --- a/cui/source/options/optmemory.cxx +++ b/cui/source/options/optmemory.cxx @@ -115,8 +115,10 @@ OfaMemoryOptionsPage::OfaMemoryOptionsPage(vcl::Window* pParent, const SfxItemSe : SfxTabPage(pParent, "OptMemoryPage", "cui/ui/optmemorypage.ui", &rSet) { get(m_pNfGraphicCache, "graphiccache"); - m_pNfGraphicCache->SetMax(std::numeric_limits< long >::max() >> 20); + sal_Int32 maxValue = std::numeric_limits< sal_Int32 >::max() >> 20; + m_pNfGraphicCache->SetMax(maxValue); get(m_pNfGraphicObjectCache, "objectcache"); + m_pNfGraphicObjectCache->SetMax(10 * maxValue); get(m_pTfGraphicObjectTime,"objecttime"); get(m_pNfOLECache, "olecache"); get(m_pQuickStarterFrame, "quickstarter"); @@ -137,7 +139,9 @@ OfaMemoryOptionsPage::OfaMemoryOptionsPage(vcl::Window* pParent, const SfxItemSe SetExchangeSupport(); - m_pNfGraphicCache->SetModifyHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) ); + m_pNfGraphicCache->SetUpHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) ); + m_pNfGraphicCache->SetDownHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) ); + m_pNfGraphicCache->SetLoseFocusHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheLoseFocusHdl ) ); } OfaMemoryOptionsPage::~OfaMemoryOptionsPage() @@ -174,7 +178,7 @@ bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet* rSet ) totalCacheSize, batch); sal_Int32 objectCacheSize = GetNfGraphicObjectCacheVal(); officecfg::Office::Common::Cache::GraphicManager::ObjectCacheSize::set( - objectCacheSize, batch); + std::min(objectCacheSize, totalCacheSize), batch); const tools::Time aTime( m_pTfGraphicObjectTime->GetTime() ); sal_Int32 objectReleaseTime = @@ -187,7 +191,7 @@ bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet* rSet ) GraphicManager& rGrfMgr = aDummyObject.GetGraphicManager(); rGrfMgr.SetMaxCacheSize(totalCacheSize); - rGrfMgr.SetMaxObjCacheSize(objectCacheSize, true); + rGrfMgr.SetMaxObjCacheSize(std::min(totalCacheSize, objectCacheSize), true); rGrfMgr.SetCacheTimeout(objectReleaseTime); // OLECache @@ -250,9 +254,12 @@ void OfaMemoryOptionsPage::Reset( const SfxItemSet* rSet ) m_pQuickLaunchCB->SaveValue(); } +IMPL_LINK_NOARG_TYPED(OfaMemoryOptionsPage, GraphicCacheLoseFocusHdl, Control&, void) +{ + GraphicCacheConfigHdl(*m_pNfGraphicCache); +} - -IMPL_LINK_NOARG_TYPED(OfaMemoryOptionsPage, GraphicCacheConfigHdl, Edit&, void) +IMPL_LINK_NOARG_TYPED(OfaMemoryOptionsPage, GraphicCacheConfigHdl, SpinField&, void) { sal_Int32 n = GetNfGraphicCacheVal(); SetNfGraphicObjectCacheMax( n ); diff --git a/cui/source/options/optmemory.hxx b/cui/source/options/optmemory.hxx index 92d53c47ddcd..6415718c5c76 100644 --- a/cui/source/options/optmemory.hxx +++ b/cui/source/options/optmemory.hxx @@ -41,7 +41,8 @@ private: VclPtr<VclContainer> m_pQuickStarterFrame; VclPtr<CheckBox> m_pQuickLaunchCB; - DECL_LINK_TYPED(GraphicCacheConfigHdl, Edit&, void); + DECL_LINK_TYPED(GraphicCacheConfigHdl, SpinField&, void); + DECL_LINK_TYPED(GraphicCacheLoseFocusHdl, Control&, void); sal_Int32 GetNfGraphicCacheVal() const; // returns # of Bytes inline void SetNfGraphicCacheVal( long nSizeInBytes ); |