diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-04-26 10:44:55 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-05-01 20:59:09 +0200 |
commit | 3893c06e42c94d16e4fd7aa1d0e7e28b8320df5b (patch) | |
tree | 9c89adaa68e04fb9522bc6774f962381b520355d | |
parent | 0e6562fffc0ea43e49bfd909ed824738325ce5f4 (diff) |
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@collabora.co.uk>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Jenkins
-rw-r--r-- | sc/source/ui/inc/content.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/inc/navipi.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/navipi/content.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.cxx | 17 |
4 files changed, 27 insertions, 5 deletions
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) |