diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-11-15 16:35:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-11-17 17:43:15 +0100 |
commit | 22f4a98bae32dedb0b1c24e9b86876041532168c (patch) | |
tree | 148709936509ab762fe52f7a5d1cd523b1011a43 /vcl | |
parent | da6c0638507aec8c9e8be2b8f63140136f1bff1d (diff) |
Resolves: tdf#121432 don't insert an extra page when parent is tabcontrol
but the new child is a toplevel widget
Change-Id: Ib794e076e2626485b9d9231daf914db6dd9b5e2f
Reviewed-on: https://gerrit.libreoffice.org/63439
Tested-by: Jenkins
Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/builder.cxx | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index efa62401f876..f45d2cd2aff5 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1395,30 +1395,34 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & if (pParent && pParent->GetType() == WindowType::TABCONTROL) { - //We have to add a page - - //make default pageid == position - TabControl *pTabControl = static_cast<TabControl*>(pParent); - sal_uInt16 nNewPageCount = pTabControl->GetPageCount()+1; - sal_uInt16 nNewPageId = nNewPageCount; - pTabControl->InsertPage(nNewPageId, OUString()); - pTabControl->SetCurPageId(nNewPageId); - SAL_WARN_IF(bIsPlaceHolder, "vcl.layout", "we should have no placeholders for tabpages"); - if (!bIsPlaceHolder) - { - VclPtrInstance<TabPage> pPage(pTabControl); - pPage->Show(); - - //Make up a name for it - OString sTabPageId = get_by_window(pParent) + - OString("-page") + - OString::number(nNewPageCount); - m_aChildren.emplace_back(sTabPageId, pPage, false); - pPage->SetHelpId(m_sHelpRoot + sTabPageId); - - pParent = pPage; - - pTabControl->SetTabPage(nNewPageId, pPage); + bool bTopLevel(name == "GtkDialog" || name == "GtkMessageDialog" || + name == "GtkWindow" || name == "GtkPopover"); + if (!bTopLevel) + { + //We have to add a page + //make default pageid == position + TabControl *pTabControl = static_cast<TabControl*>(pParent); + sal_uInt16 nNewPageCount = pTabControl->GetPageCount()+1; + sal_uInt16 nNewPageId = nNewPageCount; + pTabControl->InsertPage(nNewPageId, OUString()); + pTabControl->SetCurPageId(nNewPageId); + SAL_WARN_IF(bIsPlaceHolder, "vcl.layout", "we should have no placeholders for tabpages"); + if (!bIsPlaceHolder) + { + VclPtrInstance<TabPage> pPage(pTabControl); + pPage->Show(); + + //Make up a name for it + OString sTabPageId = get_by_window(pParent) + + OString("-page") + + OString::number(nNewPageCount); + m_aChildren.emplace_back(sTabPageId, pPage, false); + pPage->SetHelpId(m_sHelpRoot + sTabPageId); + + pParent = pPage; + + pTabControl->SetTabPage(nNewPageId, pPage); + } } } |