diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx index 14974e7609b3..5b26c830ecac 100644 --- a/include/vcl/tabctrl.hxx +++ b/include/vcl/tabctrl.hxx @@ -213,6 +213,7 @@ protected: virtual void ImplPaint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override; private: + bool bLastContextWasSupported; vcl::EnumContext::Context eLastContext; Link m_aIconClickHdl; }; diff --git a/sd/uiconfig/simpress/ui/notebookbar.ui b/sd/uiconfig/simpress/ui/notebookbar.ui index dd6c0eaa3fd5..bd081e652ad1 100644 --- a/sd/uiconfig/simpress/ui/notebookbar.ui +++ b/sd/uiconfig/simpress/ui/notebookbar.ui @@ -1476,6 +1476,10 @@ False Home True + 1 diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 93b3b2037f5d..9441dea04ef6 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2205,7 +2205,8 @@ VCL_BUILDER_FACTORY(NotebookbarTabControl); NotebookbarTabControl::NotebookbarTabControl(vcl::Window* pParent, WinBits nStyle) : TabControl(pParent, nStyle) - , eLastContext( vcl::EnumContext::Context::Context_Any ) + , bLastContextWasSupported(true) + , eLastContext(vcl::EnumContext::Context::Context_Any) { LanguageTag aLocale( Application::GetSettings().GetUILanguageTag()); ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "vcl", aLocale ); @@ -2222,6 +2223,8 @@ void NotebookbarTabControl::SetContext( vcl::EnumContext::Context eContext ) { if (eLastContext != eContext) { + bool bHandled = false; + for (int nChild = 0; nChild < GetChildCount(); ++nChild) { TabPage* pPage = static_cast(GetChild(nChild)); @@ -2231,10 +2234,22 @@ void NotebookbarTabControl::SetContext( vcl::EnumContext::Context eContext ) else EnablePage(nChild + 2, false); - if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Context_Any) + if (!bHandled && bLastContextWasSupported + && pPage->HasContext(vcl::EnumContext::Context::Context_Default)) + { SetCurPageId(nChild + 2); + } + + if (pPage->HasContext(eContext) && eContext != vcl::EnumContext::Context::Context_Any) + { + SetCurPageId(nChild + 2); + bHandled = true; + bLastContextWasSupported = true; + } } + if (!bHandled) + bLastContextWasSupported = false; eLastContext = eContext; } }