[Libreoffice-commits] core.git: 2 commits - sc/source

Eike Rathke erack at redhat.com
Tue Jul 19 00:19:35 UTC 2016


 sc/source/ui/dbgui/sfiltdlg.cxx |   54 +++++++++++++++++++++++++---------------
 sc/source/ui/inc/filtdlg.hxx    |    5 ++-
 2 files changed, 38 insertions(+), 21 deletions(-)

New commits:
commit 62442d9066ea553a4b68b8a93fa54748cbe96e06
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 19 01:54:36 2016 +0200

    Resolves: tdf#99360 Revert "tdf#93889 Remove a busy loop"
    
    This reverts commit 6610ad9aee0c8299880cd1da6cd6a756860ccad9.
    
    It simply doesn't work, the dialog ends up being modal because
    bRefInputMode is always false.
    
    Calling SyncFocusState() in ctor doesn't help because
    pEdFilterArea->HasFocus() returns false even if we just called
    pEdFilterArea->GrabFocus() ... why?
    
    Also manipulating things with
    
        pRefInputEdit = pEdFilterArea;
        bRefInputMode = true;
    
    doesn't help. This is odd..
    
     Conflicts:
    	sc/source/ui/dbgui/sfiltdlg.cxx
    
    Change-Id: I90fc8cd99a2ab91dd581acfc51d7ca5eea8e1f61

diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index d990a2f..4cbe66f 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <sfx2/dispatch.hxx>
+#include <vcl/idle.hxx>
 
 #include "uiitems.hxx"
 #include "rangenam.hxx"
@@ -56,7 +57,8 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc
         pViewData       ( nullptr ),
         pDoc            ( nullptr ),
         pRefInputEdit   ( nullptr ),
-        bRefInputMode   ( false )
+        bRefInputMode   ( false ),
+        pIdle          ( nullptr )
 {
         get(pLbFilterArea,"lbfilterarea");
         get(pEdFilterArea,"edfilterarea");
@@ -82,6 +84,13 @@ 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();
 }
 
 ScSpecialFilterDlg::~ScSpecialFilterDlg()
@@ -100,6 +109,10 @@ void ScSpecialFilterDlg::dispose()
 
     delete pOutItem;
 
+    // Hack: RefInput-Kontrolle
+    pIdle->Stop();
+    delete pIdle;
+
     pLbFilterArea.clear();
     pEdFilterArea.clear();
     pRbFilterArea.clear();
@@ -212,7 +225,6 @@ 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 )
@@ -232,7 +244,6 @@ void ScSpecialFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
 
 void ScSpecialFilterDlg::SetActive()
 {
-    SyncFocusState();
     if ( bRefInputMode )
     {
         if ( pRefInputEdit == pEdCopyArea )
@@ -385,24 +396,30 @@ IMPL_LINK_TYPED( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void )
     }
 }
 
-
-void ScSpecialFilterDlg::SyncFocusState()
+IMPL_LINK_TYPED( ScSpecialFilterDlg, TimeOutHdl, Idle*, _pIdle, void )
 {
-    if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() )
-    {
-        pRefInputEdit = pEdCopyArea;
-        bRefInputMode = true;
-    }
-    else if( pEdFilterArea->HasFocus() || pRbFilterArea->HasFocus() )
-    {
-        pRefInputEdit = pEdFilterArea;
-        bRefInputMode = true;
-    }
-    else if( bRefInputMode )
+    // every 50ms check whether RefInputMode is still true
+
+    if( (_pIdle == pIdle) && IsActive() )
     {
-        pRefInputEdit = nullptr;
-        bRefInputMode = false;
+        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;
+        }
     }
+
+    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 98f7d4d..2e3e8b9 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -64,6 +64,7 @@ public:
 
     virtual bool    IsRefInputMode() const override;
     virtual void    SetActive() override;
+
     virtual bool    Close() override;
     void            SliderMoved();
     size_t          GetSliderPos();
@@ -167,7 +168,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;
 
@@ -206,6 +207,8 @@ private:
     VclPtr<formula::RefEdit>   pRefInputEdit;
     bool                bRefInputMode;
 
+    // Hack: RefInput control
+    Idle*  pIdle;
 
 private:
     void            Init( const SfxItemSet& rArgSet );
commit 181a1a3b2df7ca427802c1c17f3344a869c91444
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Jul 18 23:53:46 2016 +0200

    Revert "Resolves: tdf#99360 can't select filter criteria with mouse"
    
    This reverts commit db279db13286653bff269f8ae7471b22498be319.
    
    It does not solve the problem but prevents revert of
    6610ad9aee0c8299880cd1da6cd6a756860ccad9.
    
    Change-Id: I8ae22ee9af57bccb9812a7c40802cf19782bedd3

diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index d0ff554..d990a2f 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -388,9 +388,6 @@ IMPL_LINK_TYPED( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void )
 
 void ScSpecialFilterDlg::SyncFocusState()
 {
-    if (!IsActive())
-        return;
-
     if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() )
     {
         pRefInputEdit = pEdCopyArea;


More information about the Libreoffice-commits mailing list