summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/tabctrl.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index c384cb036db6..d44554b80b83 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2285,17 +2285,27 @@ void NotebookbarTabControlBase::SetContext( vcl::EnumContext::Context eContext )
bool bHandled = false;
+ TabPage* pPage = GetTabPage(mnCurPageId);
+ // Try to stay on the current tab (unless the new context has a special tab)
+ if (pPage && eLastContext != vcl::EnumContext::Context::Any
+ && pPage->HasContext(vcl::EnumContext::Context::Any) && pPage->IsEnabled())
+ {
+ bHandled = true;
+ }
+
for (int nChild = 0; nChild < GetPageCount(); ++nChild)
{
sal_uInt16 nPageId = TabControl::GetPageId(nChild);
- TabPage* pPage = GetTabPage(nPageId);
+ pPage = GetTabPage(nPageId);
if (!pPage)
continue;
SetPageVisible(nPageId, pPage->HasContext(eContext) || pPage->HasContext(vcl::EnumContext::Context::Any));
- if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Any)
+ if (eContext != vcl::EnumContext::Context::Any
+ && (!bHandled || !pPage->HasContext(vcl::EnumContext::Context::Any))
+ && pPage->HasContext(eContext))
{
SetCurPageId(nPageId);
bHandled = true;