From a3cef22c9f2a47486cd1c3df2250b72efa15cd87 Mon Sep 17 00:00:00 2001 From: "Ingrid Halama [iha]" Date: Wed, 23 Feb 2011 11:51:24 +0100 Subject: chart51: #i112773# ensure correct position for equation --- chart2/source/view/charttypes/VSeriesPlotter.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'chart2') diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index c37842e19888..a45c97e8513e 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1151,9 +1151,19 @@ void VSeriesPlotter::createRegressionCurveEquationShapes( if( xTextShape.is()) { ShapeFactory::setShapeName( xTextShape, rEquationCID ); - xTextShape->setPosition( - RelativePositionHelper::getUpperLeftCornerOfAnchoredObject( - aScreenPosition2D, xTextShape->getSize(), aRelativePosition.Anchor )); + awt::Size aSize( xTextShape->getSize() ); + awt::Point aPos( RelativePositionHelper::getUpperLeftCornerOfAnchoredObject( + aScreenPosition2D, aSize, aRelativePosition.Anchor ) ); + //ensure that the equation is fully placed within the page (if possible) + if( (aPos.X + aSize.Width) > m_aPageReferenceSize.Width ) + aPos.X = m_aPageReferenceSize.Width - aSize.Width; + if( aPos.X < 0 ) + aPos.X = 0; + if( (aPos.Y + aSize.Height) > m_aPageReferenceSize.Height ) + aPos.Y = m_aPageReferenceSize.Height - aSize.Height; + if( aPos.Y < 0 ) + aPos.Y = 0; + xTextShape->setPosition(aPos); } } } -- cgit