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 <jluth@mail.com>
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index fd6f53d..c384cb0 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)
if (!pPage)
continue;
SetPageVisible(nPageId, pPage->HasContext(eContext) || pPage->HasContext(vcl::EnumContext::Context::Any));
if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Any)
{
SetPageVisible(nPageId, pPage->HasContext(eContext) || pPage->HasContext(vcl::EnumContext::Context::Any));
SetCurPageId(nPageId);
bHandled = true;
bLastContextWasSupported = true;
}
if (!bHandled && bLastContextWasSupported
&& pPage->HasContext(vcl::EnumContext::Context::Default))
{
SetCurPageId(nPageId);
}
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);
}
}