Kaydet (Commit) 630db80d authored tarafından Noel Grandin's avatar Noel Grandin

handle empty tools::Rectangle in vcl

Change-Id: I64b5c3c5a19408febe7753db6ea403b91f7f5c83
Reviewed-on: https://gerrit.libreoffice.org/72188
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 71eea07e
......@@ -544,11 +544,13 @@ tools::Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, l
nLastPos = 0;
tools::Rectangle aRect = ImplGetTabRect( nLastPos, nWidth, nHeight );
if (aRect.IsEmpty())
return aRect;
long nW = nWidth-TAB_OFFSET*2;
long nH = nHeight-aRect.Bottom()-TAB_OFFSET*2;
aRect = (nW > 0 && nH > 0)
? tools::Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ), Size( nW, nH ) )
: tools::Rectangle();
? tools::Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ), Size( nW, nH ) )
: tools::Rectangle();
return aRect;
}
......
......@@ -607,11 +607,13 @@ void EMFWriter::ImplWriteSize( const Size& rSize)
void EMFWriter::ImplWriteRect( const tools::Rectangle& rRect )
{
const tools::Rectangle aRect( OutputDevice::LogicToLogic ( rRect, maVDev->GetMapMode(), maDestMapMode ));
auto right = aRect.IsWidthEmpty() ? aRect.Left() : aRect.Right();
auto bottom = aRect.IsHeightEmpty() ? aRect.Top() : aRect.Bottom();
m_rStm
.WriteInt32( aRect.Left() )
.WriteInt32( aRect.Top() )
.WriteInt32( aRect.Right() )
.WriteInt32( aRect.Bottom() );
.WriteInt32( right )
.WriteInt32( bottom );
}
void EMFWriter::ImplWritePolygonRecord( const tools::Polygon& rPoly, bool bClose )
......
......@@ -1863,10 +1863,14 @@ tools::Rectangle OutputDevice::LogicToLogic( const tools::Rectangle& rRectSource
{
ENTER3( eUnitSource, eUnitDest );
return tools::Rectangle( fn3( rRectSource.Left(), nNumerator, nDenominator ),
fn3( rRectSource.Top(), nNumerator, nDenominator ),
fn3( rRectSource.Right(), nNumerator, nDenominator ),
fn3( rRectSource.Bottom(), nNumerator, nDenominator ) );
auto left = fn3( rRectSource.Left(), nNumerator, nDenominator );
auto top = fn3( rRectSource.Top(), nNumerator, nDenominator );
if (rRectSource.IsEmpty())
return tools::Rectangle( left, top );
auto right = fn3( rRectSource.Right(), nNumerator, nDenominator );
auto bottom = fn3( rRectSource.Bottom(), nNumerator, nDenominator );
return tools::Rectangle(left, top, right, bottom);
}
else
{
......
......@@ -731,15 +731,19 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
{
tools::Rectangle aBtn1Rect = NWGetScrollButtonRect(ControlPart::ButtonLeft, aTrackRect);
tools::Rectangle aBtn2Rect = NWGetScrollButtonRect(ControlPart::ButtonRight, aTrackRect);
aTrackRect.SetLeft( aBtn1Rect.Right() );
aTrackRect.SetRight( aBtn2Rect.Left() );
if (!aBtn1Rect.IsWidthEmpty())
aTrackRect.SetLeft( aBtn1Rect.Right() );
if (!aBtn2Rect.IsWidthEmpty())
aTrackRect.SetRight( aBtn2Rect.Left() );
}
else
{
tools::Rectangle aBtn1Rect = NWGetScrollButtonRect(ControlPart::ButtonUp, aTrackRect);
tools::Rectangle aBtn2Rect = NWGetScrollButtonRect(ControlPart::ButtonDown, aTrackRect);
aTrackRect.SetTop( aBtn1Rect.Bottom() + 1 );
aTrackRect.SetBottom( aBtn2Rect.Top() );
if (!aBtn1Rect.IsHeightEmpty())
aTrackRect.SetTop( aBtn1Rect.Bottom() + 1 );
if (!aBtn2Rect.IsHeightEmpty())
aTrackRect.SetBottom( aBtn2Rect.Top() );
}
GtkStyleContext* pScrollbarTroughStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment