diff options
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 3e8eb51bc102..3722f80505a7 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2201,6 +2201,7 @@ Size TabControl::calculateRequisition() const { Size aOptimalPageSize(0, 0); + sal_uInt16 nOrigPageId = GetCurPageId(); for( std::vector< ImplTabItem >::const_iterator it = mpTabCtrlData->maItemList.begin(); it != mpTabCtrlData->maItemList.end(); ++it ) { @@ -2210,10 +2211,8 @@ Size TabControl::calculateRequisition() const 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; } @@ -2228,6 +2227,16 @@ Size TabControl::calculateRequisition() const aOptimalPageSize.Height() = aPageSize.Height(); } + //fdo#61940 If we were forced to activate pages in order to on-demand + //create them to get their optimal size, then switch back to the original + //page and re-activate it + if (nOrigPageId != GetCurPageId()) + { + TabControl *pThis = const_cast<TabControl*>(this); + pThis->SetCurPageId(nOrigPageId); + pThis->ActivatePage(); + } + long nTabLabelsBottom = 0, nTabLabelsRight = 0; for( std::vector< ImplTabItem >::const_iterator it = mpTabCtrlData->maItemList.begin(); it != mpTabCtrlData->maItemList.end(); ++it ) |