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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 28 18:34:09 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  |   16 +++++++++++++---
 4 files changed, 26 insertions(+), 5 deletions(-)

New commits:
commit 99668e79c13fee09f8d776dbcd28e7667d7f68fe
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: Wed Apr 28 20:33:25 2021 +0200

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

diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx
index 88a2b9ac3dc3..c442df3f502f 100644
--- a/sc/source/ui/inc/content.hxx
+++ b/sc/source/ui/inc/content.hxx
@@ -140,7 +140,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 288fdf519a90..ecfe71cfd06d 100644
--- a/sc/source/ui/inc/navipi.hxx
+++ b/sc/source/ui/inc/navipi.hxx
@@ -143,6 +143,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 c870e156c163..93c094f5f18e 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1421,10 +1421,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
 
@@ -1442,12 +1447,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 68fdf7eafb32..f56b730a6ea2 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -489,8 +489,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
@@ -754,8 +760,12 @@ void ScNavigatorDlg::UpdateAll()
         default:
             break;
     }
+    ContentUpdated();       // not again
+}
 
-    aContentIdle.Stop();       // not again
+void ScNavigatorDlg::ContentUpdated()
+{
+    aContentIdle.Stop();
 }
 
 void ScNavigatorDlg::SetListMode(NavListMode eMode)


More information about the Libreoffice-commits mailing list