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;