[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 29 12:57:49 UTC 2021


 sc/source/ui/inc/content.hxx    |    4 +++-
 sc/source/ui/inc/navipi.hxx     |    1 +
 sc/source/ui/navipi/content.cxx |   10 +++++++++-
 sc/source/ui/navipi/navipi.cxx  |   17 ++++++++++++++---
 4 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit 5f5cf0d66d14ff246a4fce681459eb605d6c5f39
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Apr 26 10:44:55 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 29 14:57:08 2021 +0200

    Related: tdf#130326 skip calling Refresh if its already just called
    
    Change-Id: I80d3ae7f10b56dfe53a4ab5101ae771b47848092
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114877
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Jenkins

diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx
index f91636802901..985b4665dfc8 100644
--- a/sc/source/ui/inc/content.hxx
+++ b/sc/source/ui/inc/content.hxx
@@ -151,7 +151,9 @@ public:
     void    SetRootType( ScContentId nNew );
     ScContentId  GetRootType() const             { return nRootType; }
 
-    void    ActiveDocChanged();
+    // return true if Refresh was called to allow detecting that the navigator
+    // tree is now up to date
+    bool    ActiveDocChanged();
     void    ResetManualDoc();
     void    SetManualDoc(const OUString& rName);
     void    LoadFile(const OUString& rUrl);
diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx
index 43d48dc74f59..61c4e6da4f4f 100644
--- a/sc/source/ui/inc/navipi.hxx
+++ b/sc/source/ui/inc/navipi.hxx
@@ -142,6 +142,7 @@ private:
     void    SetCurrentObject( const OUString& rName );
     void    SetCurrentDoc( const OUString& rDocName );
     void    UpdateSelection();
+    void    ContentUpdated(); // stop aContentIdle because content is up to date
 
     static ScTabViewShell*  GetTabViewShell();
     static ScNavigatorSettings* GetNavigatorSettings();
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 692894ec8270..1fb9697c6fca 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1409,10 +1409,15 @@ void ScContentTree::ResetManualDoc()
     ActiveDocChanged();
 }
 
-void ScContentTree::ActiveDocChanged()
+bool ScContentTree::ActiveDocChanged()
 {
+    bool bRefreshed = false;
+
     if ( !bHiddenDoc && aManualDoc.isEmpty() )
+    {
         Refresh();                                  // content only if automatic
+        bRefreshed = true;
+    }
 
         //  if flag active Listbox must be updated
 
@@ -1430,12 +1435,15 @@ void ScContentTree::ActiveDocChanged()
 
             aManualDoc.clear();             // again automatically
             Refresh();
+            bRefreshed = true;
             pSh = GetManualOrCurrent();     // should be active now
             if (pSh)
                 aCurrent = pSh->GetTitle();
         }
     }
     pParentWindow->GetDocNames( &aCurrent );        // select
+
+    return bRefreshed;
 }
 
 void ScContentTree::SetManualDoc(const OUString& rName)
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index f9f196d3717b..16e546b8d1c9 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -484,8 +484,14 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint )
         if (pHint->GetEventId() == SfxEventHintId::ActivateDoc)
         {
             UpdateSheetLimits();
-            m_xLbEntries->ActiveDocChanged();
-            UpdateAll();
+            bool bRefreshed = m_xLbEntries->ActiveDocChanged();
+            // UpdateAll just possibly calls Refresh (and always
+            // ContentUpdated) so if ActiveDocChanged already called Refresh
+            // skip re-calling it
+            if (bRefreshed)
+                ContentUpdated();
+            else
+                UpdateAll();
         }
     }
     else
@@ -750,7 +756,12 @@ void ScNavigatorDlg::UpdateAll()
             break;
     }
 
-    aContentIdle.Stop();       // not again
+    ContentUpdated();       // not again
+}
+
+void ScNavigatorDlg::ContentUpdated()
+{
+    aContentIdle.Stop();
 }
 
 void ScNavigatorDlg::SetListMode(NavListMode eMode)


More information about the Libreoffice-commits mailing list