Move forcing existence of tabpages to TabControl::GetOptimalSize

rather than just for SfxTabDialog, do it for all TabControls

Change-Id: I29a19c51c7ce3baec428df716e2ee3595e496c39
This commit is contained in:
Caolán McNamara
2012-12-17 09:27:33 +00:00
parent cbcb304b8b
commit 126ec8f966
2 changed files with 11 additions and 11 deletions

View File

@@ -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 );

View File

@@ -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<TabControl*>(this);
sal_uInt16 nLastPageId = pThis->GetCurPageId();
pThis->SetCurPageId(it->mnId);
pThis->ActivatePage();
pThis->SetCurPageId(nLastPageId);
pPage = it->mpTabPage;
}
if (!pPage)
continue;