include/tools/gen.hxx | 2 +- oox/source/drawingml/chart/converterbase.cxx | 16 ++++++++-------- tools/source/generic/gen.cxx | 7 +++++++ 3 files changed, 16 insertions(+), 9 deletions(-)
New commits: commit 48480d4f19d2fb92ca4ae0527eec4753cdc439c0 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jul 15 09:44:10 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jul 15 18:07:29 2019 +0200 make tools::Rectangle::getBottom return 0 when empty LayoutConverter::calcAbsRectangle needed to be tweaked because we now end up with a zero width/height instead of a large negative number. Change-Id: I81f04759a1d5bf6f44753a1701596796fad40567 Reviewed-on: https://gerrit.libreoffice.org/75610 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 9dea74be4caa..b8ee06c8031e 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -457,7 +457,7 @@ public: /// Returns the difference between right and left, assuming the range includes one end, but not the other. long getWidth() const; /// Returns the difference between bottom and top, assuming the range includes one end, but not the other. - long getHeight() const { return nBottom - nTop; } + long getHeight() const; /// Set the left edge of the rectangle to x, preserving the width void setX( long x ); /// Set the top edge of the rectangle to y, preserving the height diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx index 7faeb36576d1..7f12741c568e 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -350,18 +350,18 @@ bool LayoutConverter::calcAbsRectangle( awt::Rectangle& orRect ) const { if( !mrModel.mbAutoLayout ) { - awt::Size rChartSize=getChartSize(); - if( (rChartSize.Width < 0) || (rChartSize.Height < 0) ) + awt::Size aChartSize=getChartSize(); + if( aChartSize.Width <= 0 || aChartSize.Height <= 0 ) { - rChartSize.Width = 16000; - rChartSize.Height = 9000; + aChartSize.Width = 16000; + aChartSize.Height = 9000; } - orRect.X = lclCalcPosition( rChartSize.Width, mrModel.mfX, mrModel.mnXMode ); - orRect.Y = lclCalcPosition( rChartSize.Height, mrModel.mfY, mrModel.mnYMode ); + orRect.X = lclCalcPosition( aChartSize.Width, mrModel.mfX, mrModel.mnXMode ); + orRect.Y = lclCalcPosition( aChartSize.Height, mrModel.mfY, mrModel.mnYMode ); if( (orRect.X >= 0) && (orRect.Y >= 0) ) { - orRect.Width = lclCalcSize( orRect.X, rChartSize.Width, mrModel.mfW, mrModel.mnWMode ); - orRect.Height = lclCalcSize( orRect.Y, rChartSize.Height, mrModel.mfH, mrModel.mnHMode ); + orRect.Width = lclCalcSize( orRect.X, aChartSize.Width, mrModel.mfW, mrModel.mnWMode ); + orRect.Height = lclCalcSize( orRect.Y, aChartSize.Height, mrModel.mfH, mrModel.mnHMode ); return (orRect.Width > 0) && (orRect.Height > 0); } } diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 5755929bd502..0a488a4e51b4 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -308,4 +308,11 @@ long tools::Rectangle::getWidth() const { return nRight == RECT_EMPTY ? 0 : nRight - nLeft; } + +/// Returns the difference between bottom and top, assuming the range includes one end, but not the other. +long tools::Rectangle::getHeight() const +{ + return nBottom == RECT_EMPTY ? 0 : nBottom - nTop; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits