[Libreoffice-commits] .: vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 8 08:15:50 PDT 2012


 vcl/source/control/tabctrl.cxx |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

New commits:
commit c5f401ed8991985c3f6701fdaf5f9ee53429fdb0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 8 16:13:53 2012 +0100

    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

diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 2ad68d1..c918815 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;


More information about the Libreoffice-commits mailing list