summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-04-26 10:44:55 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-04-28 20:33:25 +0200
commit99668e79c13fee09f8d776dbcd28e7667d7f68fe (patch)
tree3cebc1d2c6ac66542601e1411e0ba8b2c908d249
parent39619da47e029afd3e8be5c2a558683237d94ecb (diff)
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@redhat.com>
-rw-r--r--sc/source/ui/inc/content.hxx4
-rw-r--r--sc/source/ui/inc/navipi.hxx1
-rw-r--r--sc/source/ui/navipi/content.cxx10
-rw-r--r--sc/source/ui/navipi/navipi.cxx16
4 files changed, 26 insertions, 5 deletions
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)