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>
This commit is contained in:
committed by
Samuel Mehrbrodt
parent
b920fa5e90
commit
d7da58ae36
@@ -213,6 +213,7 @@ protected:
|
|||||||
virtual void ImplPaint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
|
virtual void ImplPaint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool bLastContextWasSupported;
|
||||||
vcl::EnumContext::Context eLastContext;
|
vcl::EnumContext::Context eLastContext;
|
||||||
Link<NotebookBar*,void> m_aIconClickHdl;
|
Link<NotebookBar*,void> m_aIconClickHdl;
|
||||||
};
|
};
|
||||||
|
@@ -1476,6 +1476,10 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Home</property>
|
<property name="label" translatable="yes">Home</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
<style>
|
||||||
|
<class name="context-default"/>
|
||||||
|
<class name="context-any"/>
|
||||||
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
|
@@ -2205,7 +2205,8 @@ VCL_BUILDER_FACTORY(NotebookbarTabControl);
|
|||||||
|
|
||||||
NotebookbarTabControl::NotebookbarTabControl(vcl::Window* pParent, WinBits nStyle)
|
NotebookbarTabControl::NotebookbarTabControl(vcl::Window* pParent, WinBits nStyle)
|
||||||
: TabControl(pParent, nStyle)
|
: TabControl(pParent, nStyle)
|
||||||
, eLastContext( vcl::EnumContext::Context::Context_Any )
|
, bLastContextWasSupported(true)
|
||||||
|
, eLastContext(vcl::EnumContext::Context::Context_Any)
|
||||||
{
|
{
|
||||||
LanguageTag aLocale( Application::GetSettings().GetUILanguageTag());
|
LanguageTag aLocale( Application::GetSettings().GetUILanguageTag());
|
||||||
ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "vcl", aLocale );
|
ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "vcl", aLocale );
|
||||||
@@ -2222,6 +2223,8 @@ void NotebookbarTabControl::SetContext( vcl::EnumContext::Context eContext )
|
|||||||
{
|
{
|
||||||
if (eLastContext != eContext)
|
if (eLastContext != eContext)
|
||||||
{
|
{
|
||||||
|
bool bHandled = false;
|
||||||
|
|
||||||
for (int nChild = 0; nChild < GetChildCount(); ++nChild)
|
for (int nChild = 0; nChild < GetChildCount(); ++nChild)
|
||||||
{
|
{
|
||||||
TabPage* pPage = static_cast<TabPage*>(GetChild(nChild));
|
TabPage* pPage = static_cast<TabPage*>(GetChild(nChild));
|
||||||
@@ -2231,10 +2234,22 @@ void NotebookbarTabControl::SetContext( vcl::EnumContext::Context eContext )
|
|||||||
else
|
else
|
||||||
EnablePage(nChild + 2, false);
|
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);
|
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;
|
eLastContext = eContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user