summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorIngrid Halama [iha] <Ingrid.Halama@oracle.com>2011-02-23 11:51:24 +0100
committerIngrid Halama [iha] <Ingrid.Halama@oracle.com>2011-02-23 11:51:24 +0100
commita3cef22c9f2a47486cd1c3df2250b72efa15cd87 (patch)
tree336a5316b2c4f2ed3ee645c2b8b608d031701084 /chart2/source
parent87635e20d18a4bd8e9da9382771c2c32496ec7ed (diff)
chart51: #i112773# ensure correct position for equation
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx16
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);
}
}
}