From 126ec8f96680ad5222b10a4bf6aac9ff8b58fe88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 17 Dec 2012 09:27:33 +0000 Subject: [PATCH] Move forcing existence of tabpages to TabControl::GetOptimalSize rather than just for SfxTabDialog, do it for all TabControls Change-Id: I29a19c51c7ce3baec428df716e2ee3595e496c39 --- sfx2/source/dialog/tabdlg.cxx | 11 ----------- vcl/source/control/tabctrl.cxx | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index a7574c573d5a..f3514ed437ac 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -727,17 +727,6 @@ sal_Bool SfxTabDialog::IsApplyButtonEnabled() const void SfxTabDialog::Start_Impl() { - //We need to force all tabs to exist to get overall optimal size for dialog - for (sal_uInt16 n=0; n < m_pTabCtrl->GetPageCount(); ++n) - { - sal_uInt16 nPageId = m_pTabCtrl->GetPageId(n); - if (!m_pTabCtrl->GetTabPage(nPageId)) - { - m_pTabCtrl->SetCurPageId(nPageId); - ActivatePageHdl(m_pTabCtrl); - } - } - DBG_ASSERT( pImpl->pData->Count() == m_pTabCtrl->GetPageCount(), "not all pages registered" ); sal_uInt16 nActPage = m_pTabCtrl->GetPageId( 0 ); diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index e5eb0ce74f06..e2fecc29e0d1 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2205,6 +2205,17 @@ Size TabControl::calculateRequisition() const { const TabPage *pPage = it->mpTabPage; //it's a real nuisance if the page is not inserted yet :-( + //We need to force all tabs to exist to get overall optimal size for dialog + if (!pPage) + { + TabControl *pThis = const_cast(this); + sal_uInt16 nLastPageId = pThis->GetCurPageId(); + pThis->SetCurPageId(it->mnId); + pThis->ActivatePage(); + pThis->SetCurPageId(nLastPageId); + pPage = it->mpTabPage; + } + if (!pPage) continue;