diff options
Diffstat (limited to 'vcl/source/control/tabctrl.cxx')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 31de70d73616..3140d100aa86 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -355,15 +355,18 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) Rectangle TabControl::ImplGetTabRect( sal_uInt16 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 ) @@ -375,9 +378,11 @@ Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, long nHe 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; } |