summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2016-07-22 11:50:57 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-07-22 15:35:28 +0000
commitd7da58ae362b661c03fc754e4e8f4a89798b0127 (patch)
tree9c4640870e204fcca73d1fa2161f16d9aca6cbc7 /vcl
parentb920fa5e90343a7e9ca6e9f1934f22b527ed9791 (diff)
GSoC notebookbar: better default page handling
+ selected default tab page in the Impress + the default tab page is set when context isn't supported + switching between unsupported contexts is not causing switch to default tab to avoid closing of tab which was recently used by user Change-Id: Ieeda8a79e6c67708551351f9bb49d8b006c0e74f Reviewed-on: https://gerrit.libreoffice.org/27432 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/tabctrl.cxx17
1 files changed, 16 insertions, 1 deletions
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<TabPage*>(GetChild(nChild));
@@ -2231,10 +2234,22 @@ void NotebookbarTabControl::SetContext( vcl::EnumContext::Context eContext )
else
EnablePage(nChild + 2, false);
+ 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;
}
}