Kaydet (Commit) dcca78f4 authored tarafından Oliver Specht's avatar Oliver Specht

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/20766Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarOliver Specht <oliver.specht@cib.de>
üst 42645fe6
......@@ -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 );
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment