From dac06a943a6c44befda1ba22f4bd19c0281601d0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 5 Apr 2013 13:26:26 +0100 Subject: Resolves: fdo#61940 unable to change shape fill colors The tab area page has a magic bit which is set when the page is activated that enables its properties to be applied on ok. If another page is activated that also affects area fill using an alternative set of properties, then the bit is unset. For layout we have to activate all pages that don't exist yet to get their optimal size. So we need to re-activate the original/current page after forcing the other pages to exist in order to make this trickery work. Change-Id: I90cac4624a12e6c29f6b226ce831f71c7cc49117 --- vcl/source/control/tabctrl.cxx | 13 +++++++++++-- 1 file 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(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(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 ) -- cgit