diff options
author | Jennifer Liebel <jliebel94@gmail.com> | 2014-11-05 09:08:02 +0000 |
---|---|---|
committer | Tobias Madl <tobias.madl.dev@gmail.com> | 2014-12-09 12:34:50 +0000 |
commit | 19b7dc3b1ef8b77d509f46dca96fb0f797abe38c (patch) | |
tree | bf1d9210efc35eeda733e2cb964852778bd30c6d /sc | |
parent | 379f61127e9851e91197007c706c24f479da2b38 (diff) |
changed timers to idles
Change-Id: Iebde351b3bfca907a7730b7af379efb040cbeae2
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/chartlis.hxx | 2 | ||||
-rw-r--r-- | sc/inc/scmod.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/chartlis.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 57 |
4 files changed, 23 insertions, 57 deletions
diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx index 9952d4bc6a03..060546081f26 100644 --- a/sc/inc/chartlis.hxx +++ b/sc/inc/chartlis.hxx @@ -150,7 +150,7 @@ private: ::std::list<RangeListenerItem> maHiddenListeners; StringSetType maNonOleObjectNames; - Timer aTimer; + Idle aIdle; ScDocument* pDoc; DECL_LINK(TimerHdl, void *); diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 59b1ab010468..7d23cc7657bd 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -81,8 +81,8 @@ class ScAnyRefModalDlg; class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener { - Timer aIdleTimer; - Timer aSpellTimer; + Idle aIdle; + Idle aSpellIdle; ScDragData* mpDragData; ScClipData* mpClipData; ScSelectionTransferObj* pSelTransfer; diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx index d68b3538a08c..a565d961e528 100644 --- a/sc/source/core/tool/chartlis.cxx +++ b/sc/source/core/tool/chartlis.cxx @@ -414,7 +414,7 @@ ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) : meModifiedDuringUpdate( SC_CLCUPDATE_NONE ), pDoc( pDocP ) { - aTimer.SetTimeoutHdl( LINK( this, ScChartListenerCollection, TimerHdl ) ); + aIdle.SetIdleHdl( LINK( this, ScChartListenerCollection, TimerHdl ) ); } ScChartListenerCollection::ScChartListenerCollection( @@ -422,12 +422,12 @@ ScChartListenerCollection::ScChartListenerCollection( meModifiedDuringUpdate( SC_CLCUPDATE_NONE ), pDoc( rColl.pDoc ) { - aTimer.SetTimeoutHdl( LINK( this, ScChartListenerCollection, TimerHdl ) ); + aIdle.SetIdleHdl( LINK( this, ScChartListenerCollection, TimerHdl ) ); } ScChartListenerCollection::~ScChartListenerCollection() { - // remove ChartListener objects before aTimer dtor is called, because + // remove ChartListener objects before aIdle dtor is called, because // ScChartListener::EndListeningTo may cause ScChartListenerCollection::StartTimer // to be called if an empty ScNoteCell is deleted @@ -589,15 +589,15 @@ void ScChartListenerCollection::FreeUno( const uno::Reference< chart::XChartData void ScChartListenerCollection::StartTimer() { - aTimer.SetTimeout( SC_CHARTTIMEOUT ); - aTimer.Start(); + aIdle.SetPriority( VCL_IDLE_PRIORITY_REPAINT ); + aIdle.Start(); } IMPL_LINK_NOARG(ScChartListenerCollection, TimerHdl) { if ( Application::AnyInput( VCL_INPUT_KEYBOARD ) ) { - aTimer.Start(); + aIdle.Start(); return 0; } UpdateDirtyCharts(); @@ -618,10 +618,7 @@ void ScChartListenerCollection::UpdateDirtyCharts() if (p->IsDirty()) p->Update(); - if (meModifiedDuringUpdate == SC_CLCUPDATE_MODIFIED) - break; // iterator is invalid - - if (aTimer.IsActive() && !pDoc->IsImportingXML()) + if (aIdle.IsActive() && !pDoc->IsImportingXML()) break; // one interfered } meModifiedDuringUpdate = SC_CLCUPDATE_NONE; diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 947264423957..80a7de377eab 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -112,14 +112,7 @@ #include "formulagroup.hxx" #include <documentlinkmgr.hxx> -#define SC_IDLE_MIN 150 -#define SC_IDLE_MAX 3000 -#define SC_IDLE_STEP 75 -#define SC_IDLE_COUNT 50 - -static sal_uInt16 nIdleCount = 0; - -SFX_IMPL_INTERFACE(ScModule, SfxShell) +SFX_IMPL_INTERFACE(ScModule, SfxShell, ScResId(RID_APPTITLE)) void ScModule::InitInterface_Impl() { @@ -174,11 +167,11 @@ ScModule::ScModule( SfxObjectFactory* pFact ) : ERRCODE_AREA_APP2-1, GetResMgr() ); - aSpellTimer.SetTimeout(10); - aSpellTimer.SetTimeoutHdl( LINK( this, ScModule, SpellTimerHdl ) ); - aIdleTimer.SetTimeout(SC_IDLE_MIN); - aIdleTimer.SetTimeoutHdl( LINK( this, ScModule, IdleHandler ) ); - aIdleTimer.Start(); + aSpellIdle.SetPriority(VCL_IDLE_PRIORITY_REPAINT); + aSpellIdle.SetIdleHdl( LINK( this, ScModule, SpellTimerHdl ) ); + aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWER); + aIdle.SetIdleHdl( LINK( this, ScModule, IdleHandler ) ); + aIdle.Start(); pMessagePool = new ScMessagePool; pMessagePool->FreezeIdRanges(); @@ -1851,11 +1844,7 @@ void ScModule::EndReference() */ void ScModule::AnythingChanged() { - sal_uLong nOldTime = aIdleTimer.GetTimeout(); - if ( nOldTime != SC_IDLE_MIN ) - aIdleTimer.SetTimeout( SC_IDLE_MIN ); - - nIdleCount = 0; + aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWER); } static void lcl_CheckNeedsRepaint( ScDocShell* pDocShell ) @@ -1875,7 +1864,7 @@ IMPL_LINK_NOARG(ScModule, IdleHandler) { if ( Application::AnyInput( VCL_INPUT_MOUSEANDKEYBOARD ) ) { - aIdleTimer.Start(); // Timeout unchanged + aIdle.Start(); // Timeout unchanged return 0; } @@ -1910,35 +1899,15 @@ IMPL_LINK_NOARG(ScModule, IdleHandler) bool bSpell = pViewSh->ContinueOnlineSpelling(); if (bSpell) { - aSpellTimer.Start(); + aSpellIdle.Start(); bMore = true; } } } - sal_uLong nOldTime = aIdleTimer.GetTimeout(); - sal_uLong nNewTime = nOldTime; - if ( bMore ) - { - nNewTime = SC_IDLE_MIN; - nIdleCount = 0; - } - else - { - // Set SC_IDLE_COUNT to initial Timeout - increase afterwards - if ( nIdleCount < SC_IDLE_COUNT ) - ++nIdleCount; - else - { - nNewTime += SC_IDLE_STEP; - if ( nNewTime > SC_IDLE_MAX ) - nNewTime = SC_IDLE_MAX; - } - } - if ( nNewTime != nOldTime ) - aIdleTimer.SetTimeout( nNewTime ); + aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWEST); - aIdleTimer.Start(); + aIdle.Start(); return 0; } @@ -1946,7 +1915,7 @@ IMPL_LINK_NOARG(ScModule, SpellTimerHdl) { if ( Application::AnyInput( VCL_INPUT_KEYBOARD ) ) { - aSpellTimer.Start(); + aSpellIdle.Start(); return 0; // Later again ... } @@ -1954,7 +1923,7 @@ IMPL_LINK_NOARG(ScModule, SpellTimerHdl) if (pViewSh) { if (pViewSh->ContinueOnlineSpelling()) - aSpellTimer.Start(); + aSpellIdle.Start(); } return 0; } |