summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-10-08 16:13:53 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-10-08 16:13:53 +0100
commitc5f401ed8991985c3f6701fdaf5f9ee53429fdb0 (patch)
tree435f1bf77a6d15068f674e59510acad5c52e4ace
parentf52f89dc65c3b54215c094e7e93bf239b0a1ba13 (diff)
we're stuck with "double-decker" tab dialogs for now after all
I had hoped to move to single-decker tab dialogs, but e.g. writer's paragraph style dialog has *14* tabs, which is ludicrously wide, so just take optimal size of contents as let the tab dialog double-decker or not based on that width. Change-Id: I8d87ea6221164ba5c082249b498663c77d2f5340
-rw-r--r--vcl/source/control/tabctrl.cxx26
1 files changed, 13 insertions, 13 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 2ad68d1f24b5..c918815af924 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2179,40 +2179,40 @@ Point TabControl::GetItemsOffset() const
Size TabControl::calculateRequisition() const
{
Size aOptimalPageSize(0, 0);
- long nTabLabelsBottom = 0;
- long nTotalTabLabelWidths = 0;
for( std::vector< ImplTabItem >::const_iterator it = mpTabCtrlData->maItemList.begin();
it != mpTabCtrlData->maItemList.end(); ++it )
{
- Size aPageSize;
const TabPage *pPage = it->mpTabPage;
//it's a real nuisance if the page is not inserted yet :-(
- if (pPage)
- aPageSize = pPage->GetOptimalSize(WINDOWSIZE_PREFERRED);
+ if (!pPage)
+ continue;
+
+ Size aPageSize(pPage->GetOptimalSize(WINDOWSIZE_PREFERRED));
if (aPageSize.Width() > aOptimalPageSize.Width())
aOptimalPageSize.Width() = aPageSize.Width();
if (aPageSize.Height() > aOptimalPageSize.Height())
aOptimalPageSize.Height() = aPageSize.Height();
+ }
+ long nTabLabelsBottom = 0, nTabLabelsRight = 0;
+ for( std::vector< ImplTabItem >::const_iterator it = mpTabCtrlData->maItemList.begin();
+ it != mpTabCtrlData->maItemList.end(); ++it )
+ {
TabControl* pThis = const_cast<TabControl*>(this);
sal_uInt16 nPos = it - mpTabCtrlData->maItemList.begin();
- Rectangle aTabRect = pThis->ImplGetTabRect(nPos, LONG_MAX, LONG_MAX);
+ Rectangle aTabRect = pThis->ImplGetTabRect(nPos, aOptimalPageSize.Width(), LONG_MAX);
if (aTabRect.Bottom() > nTabLabelsBottom)
nTabLabelsBottom = aTabRect.Bottom();
-
- ImplTabItem* pItem = const_cast<ImplTabItem*>(&(*it));
- Size aTabSize = pThis->ImplGetItemSize(pItem, LONG_MAX);
- nTotalTabLabelWidths += aTabSize.Width();
+ if (aTabRect.Right() > nTabLabelsRight)
+ nTabLabelsRight = aTabRect.Right();
}
Size aOptimalSize(aOptimalPageSize);
aOptimalSize.Height() += nTabLabelsBottom;
-
- if (nTotalTabLabelWidths > aOptimalSize.Width())
- aOptimalSize.Width() = nTotalTabLabelWidths;
+ aOptimalSize.Width() = std::max(nTabLabelsRight, aOptimalSize.Width());
aOptimalSize.Width() += TAB_OFFSET * 2;
aOptimalSize.Height() += TAB_OFFSET * 2;