diff options
author | Jaskaran <jvsg1303@gmail.com> | 2016-03-02 07:51:40 +0530 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2016-03-04 09:43:01 +0000 |
commit | 6610ad9aee0c8299880cd1da6cd6a756860ccad9 (patch) | |
tree | 12cbc1521cf8487c54e8bd2d4bbc230f7f23cc4b | |
parent | 3aafe0568be80120afcdd92ea491b55d66bcbac6 (diff) |
tdf#93889 Remove a busy loop
Add SyncFocusState(). Before we needed
pRefInputEdit or bRefInputMode.
Change-Id: Ib1d8c4d26f45824fd6652ef29d56ddf8d276319d
Reviewed-on: https://gerrit.libreoffice.org/22823
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | sc/source/ui/dbgui/sfiltdlg.cxx | 52 | ||||
-rw-r--r-- | sc/source/ui/inc/filtdlg.hxx | 5 |
2 files changed, 19 insertions, 38 deletions
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index 990939dca7ff..f00924e8f76f 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -18,7 +18,6 @@ */ #include <sfx2/dispatch.hxx> -#include <vcl/idle.hxx> #include "uiitems.hxx" #include "rangenam.hxx" @@ -57,8 +56,7 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc pViewData ( nullptr ), pDoc ( nullptr ), pRefInputEdit ( nullptr ), - bRefInputMode ( false ), - pIdle ( nullptr ) + bRefInputMode ( false ) { get(pLbFilterArea,"lbfilterarea"); get(pEdFilterArea,"edfilterarea"); @@ -85,12 +83,6 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc Init( rArgSet ); pEdFilterArea->GrabFocus(); - // Hack: RefInput-Kontrolle - pIdle = new Idle; - // FIXME: this is an abomination - pIdle->SetPriority( SchedulerPriority::LOWEST ); - pIdle->SetIdleHdl( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) ); - pIdle->Start(); pLbCopyArea->SetAccessibleName(pBtnCopyResult->GetText()); pEdCopyArea->SetAccessibleName(pBtnCopyResult->GetText()); @@ -112,10 +104,6 @@ void ScSpecialFilterDlg::dispose() delete pOutItem; - // Hack: RefInput-Kontrolle - pIdle->Stop(); - delete pIdle; - pLbFilterArea.clear(); pEdFilterArea.clear(); pRbFilterArea.clear(); @@ -228,6 +216,7 @@ bool ScSpecialFilterDlg::Close() void ScSpecialFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { + SyncFocusState(); if ( bRefInputMode && pRefInputEdit ) // Nur moeglich, wenn im Referenz-Editmodus { if ( rRef.aStart != rRef.aEnd ) @@ -247,6 +236,7 @@ void ScSpecialFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) void ScSpecialFilterDlg::SetActive() { + SyncFocusState(); if ( bRefInputMode ) { if ( pRefInputEdit == pEdCopyArea ) @@ -399,30 +389,24 @@ IMPL_LINK_TYPED( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void ) } } -IMPL_LINK_TYPED( ScSpecialFilterDlg, TimeOutHdl, Idle*, _pIdle, void ) -{ - // every 50ms check whether RefInputMode is still true - if( (_pIdle == pIdle) && IsActive() ) +void ScSpecialFilterDlg::SyncFocusState() +{ + if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() ) { - if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() ) - { - pRefInputEdit = pEdCopyArea; - bRefInputMode = true; - } - else if( pEdFilterArea->HasFocus() || pRbFilterArea->HasFocus() ) - { - pRefInputEdit = pEdFilterArea; - bRefInputMode = true; - } - else if( bRefInputMode ) - { - pRefInputEdit = nullptr; - bRefInputMode = false; - } + pRefInputEdit = pEdCopyArea; + bRefInputMode = true; + } + else if( pEdFilterArea->HasFocus() || pRbFilterArea->HasFocus() ) + { + pRefInputEdit = pEdFilterArea; + bRefInputMode = true; + } + else if( bRefInputMode ) + { + pRefInputEdit = nullptr; + bRefInputMode = false; } - - pIdle->Start(); } IMPL_LINK_TYPED( ScSpecialFilterDlg, FilterAreaSelHdl, ListBox&, rLb, void ) diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx index ba3a95aa8b9d..473a6fdd3355 100644 --- a/sc/source/ui/inc/filtdlg.hxx +++ b/sc/source/ui/inc/filtdlg.hxx @@ -61,7 +61,6 @@ public: virtual bool IsRefInputMode() const override; virtual void SetActive() override; - virtual bool Close() override; void SliderMoved(); size_t GetSliderPos(); @@ -165,7 +164,7 @@ public: virtual void dispose() override; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override; - + void SyncFocusState(); virtual bool IsRefInputMode() const override; virtual void SetActive() override; @@ -204,8 +203,6 @@ private: VclPtr<formula::RefEdit> pRefInputEdit; bool bRefInputMode; - // Hack: RefInput control - Idle* pIdle; private: void Init( const SfxItemSet& rArgSet ); |