[Libreoffice-commits] core.git: vcl/source
Stefano Facchini
stefano.facchini at gmail.com
Mon Aug 26 13:10:12 PDT 2013
vcl/source/control/tabctrl.cxx | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
New commits:
commit fa9a2aaa2246e6eb0665d36aa7c6c75fd31c4e3e
Author: Stefano Facchini <stefano.facchini at gmail.com>
Date: Thu Aug 22 21:48:19 2013 +0200
fdo#66435: distribute tabs more evenly across rows
Change-Id: I9df2312f257867fc89aa29672f2d58ea40363b14
Reviewed-on: https://gerrit.libreoffice.org/5588
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 86e3ead..4449181 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -403,6 +403,14 @@ Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, long nHe
long nLineWidthAry[100];
sal_uInt16 nLinePosAry[101];
+ long nTotalWidth = nOffsetX;
+ for( std::vector<ImplTabItem>::iterator it = mpTabCtrlData->maItemList.begin();
+ it != mpTabCtrlData->maItemList.end(); ++it )
+ {
+ nTotalWidth += ImplGetItemSize( &(*it), nMaxWidth ).Width();
+ }
+ long nWrapWidth = nWidth / ceil((double)nTotalWidth / nWidth);
+
nLineWidthAry[0] = 0;
nLinePosAry[0] = 0;
for( std::vector<ImplTabItem>::iterator it = mpTabCtrlData->maItemList.begin();
@@ -410,18 +418,6 @@ Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, long nHe
{
aSize = ImplGetItemSize( &(*it), nMaxWidth );
- if ( ((nX+aSize.Width()) > nWidth - 2) && (nWidth > 2+nOffsetX) )
- {
- if ( nLines == 99 )
- break;
-
- nX = nOffsetX;
- nY += aSize.Height();
- nLines++;
- nLineWidthAry[nLines] = 0;
- nLinePosAry[nLines] = nPos;
- }
-
Rectangle aNewRect( Point( nX, nY ), aSize );
if ( mbSmallInvalidate && (it->maRect != aNewRect) )
mbSmallInvalidate = sal_False;
@@ -436,6 +432,23 @@ Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, long nHe
nCurLine = nLines;
nPos++;
+
+ if ( (nX > nWrapWidth - 2) && (nWidth > 2+nOffsetX) )
+ {
+ if ( nLines == 99 )
+ break;
+
+ nX = nOffsetX;
+ nY += aSize.Height();
+ nLines++;
+ nLineWidthAry[nLines] = 0;
+ nLinePosAry[nLines] = nPos;
+ }
+ }
+
+ if ( nX == nOffsetX )
+ {
+ nLines--;
}
if ( nLines && !mpTabCtrlData->maItemList.empty() )
More information about the Libreoffice-commits
mailing list