vcl/source/control/tabctrl.cxx | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-)
New commits: commit fa9a2aaa2246e6eb0665d36aa7c6c75fd31c4e3e Author: Stefano Facchini <stefano.facch...@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 <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@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() )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits