diff options
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 16 |
1 files changed, 13 insertions, 3 deletions
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); } } } |