[Libreoffice-commits] .: Branch 'libreoffice-3-3' - vcl/source
Thorsten Behrens
thorsten at kemper.freedesktop.org
Tue Dec 14 09:12:57 PST 2010
vcl/source/control/tabctrl.cxx | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
New commits:
commit 4b7f081ab7079115050d5329b70c7b965db6ba85
Author: Philipp Lohmann <pl at openoffice.org>
Date: Tue Dec 14 18:11:40 2010 +0100
TabControl::ImplGetTabRect negative height gives BadAlloc
Fix from i#116120
Signed-off-by: Thorsten Behrens <tbehrens at novell.com>
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index d51dc5e..a8ad1ea 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -443,15 +443,18 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight )
{
Size aWinSize = Control::GetOutputSizePixel();
- if ( nWidth == -1 )
+ if ( nWidth < 0 )
nWidth = aWinSize.Width();
- if ( nHeight == -1 )
+ if ( nHeight < 0 )
nHeight = aWinSize.Height();
if ( mpTabCtrlData->maItemList.empty() )
{
- return Rectangle( Point( TAB_OFFSET, TAB_OFFSET ),
- Size( nWidth-TAB_OFFSET*2, nHeight-TAB_OFFSET*2 ) );
+ long nW = nWidth-TAB_OFFSET*2;
+ long nH = nHeight-TAB_OFFSET*2;
+ return (nW > 0 && nH > 0)
+ ? Rectangle( Point( TAB_OFFSET, TAB_OFFSET ), Size( nW, nH ) )
+ : Rectangle();
}
if ( nItemPos == TAB_PAGERECT )
@@ -463,9 +466,11 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight
nLastPos = 0;
Rectangle aRect = ImplGetTabRect( nLastPos, nWidth, nHeight );
- aRect = Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ),
- Size( nWidth-TAB_OFFSET*2,
- nHeight-aRect.Bottom()-TAB_OFFSET*2 ) );
+ long nW = nWidth-TAB_OFFSET*2;
+ long nH = nHeight-aRect.Bottom()-TAB_OFFSET*2;
+ aRect = (nW > 0 && nH > 0)
+ ? Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ), Size( nW, nH ) )
+ : Rectangle();
return aRect;
}
More information about the Libreoffice-commits
mailing list