vcl/source/control/tabctrl.cxx | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
New commits: commit 7626e37b7c77980ba41bdc7e9131b9c373dea038 Author: Justin Luth <jl...@mail.com> AuthorDate: Thu Jun 22 12:23:21 2023 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Fri Jun 23 02:54:38 2023 +0200 tdf#141136 NBB SetContext: don't SetCurPageId twice for the same page I noticed that SetCurPageId was running multiple times for the HomeLabel page. Plus, let's flatten this a bit more. It has always been like since, since commit d7da58ae362b661c03fc754e4e8f4a89798b0127 Author: Szymon Kłos on Fri Jul 22 11:50:57 2016 +0200 GSoC notebookbar: better default page handling Change-Id: Ied13ea5019df7cce2afe38d5d5d3615168338f0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153475 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index fd6f53d63a1e..c384cb036db6 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2290,22 +2290,22 @@ void NotebookbarTabControlBase::SetContext( vcl::EnumContext::Context eContext ) sal_uInt16 nPageId = TabControl::GetPageId(nChild); TabPage* pPage = GetTabPage(nPageId); - if (pPage) - { - SetPageVisible(nPageId, pPage->HasContext(eContext) || pPage->HasContext(vcl::EnumContext::Context::Any)); + if (!pPage) + continue; - if (!bHandled && bLastContextWasSupported - && pPage->HasContext(vcl::EnumContext::Context::Default)) - { - SetCurPageId(nPageId); - } + SetPageVisible(nPageId, pPage->HasContext(eContext) || pPage->HasContext(vcl::EnumContext::Context::Any)); - if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Any) - { - SetCurPageId(nPageId); - bHandled = true; - bLastContextWasSupported = true; - } + if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Any) + { + SetCurPageId(nPageId); + bHandled = true; + bLastContextWasSupported = true; + } + + if (!bHandled && bLastContextWasSupported + && pPage->HasContext(vcl::EnumContext::Context::Default)) + { + SetCurPageId(nPageId); } }