summaryrefslogtreecommitdiff
path: root/chart2/source/view/charttypes/PieChart.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-18 14:08:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-19 11:01:18 +0200
commit9df2821e61979dab32390d5c64dd49bee868adbb (patch)
tree5b827e29e73ac2300c164b0a389a784a358956e6 /chart2/source/view/charttypes/PieChart.cxx
parent8b0a69498b025e13d9772689e9e4fa3d6b05e609 (diff)
loplugin:flatten in chart2
Change-Id: Iadc4da6515a7d82e7a92b33d74d589b61fa2c64f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92480 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/view/charttypes/PieChart.cxx')
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx35
1 files changed, 19 insertions, 16 deletions
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index 0214d0f6a0eb..0e3829c00ab2 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -182,7 +182,10 @@ PieChart::PieChart( const uno::Reference<XChartType>& xChartTypeModel
m_pPosHelper->m_fRingDistance = 0.0;
uno::Reference< beans::XPropertySet > xChartTypeProps( xChartTypeModel, uno::UNO_QUERY );
- if( xChartTypeProps.is() ) try
+ if( !xChartTypeProps.is() )
+ return;
+
+ try
{
xChartTypeProps->getPropertyValue( "UseRings") >>= m_bUseRings;
if( m_bUseRings )
@@ -1573,21 +1576,21 @@ void PieChart::performLabelBestFit(ShapeParam& rShapeParam, PieLabelInfo const &
if( m_bUseRings )
return;
- if( !performLabelBestFitInnerPlacement(rShapeParam, rPieLabelInfo) )
- {
- // If it does not fit inside, let's put it outside
- PolarLabelPositionHelper aPolarPosHelper(m_pPosHelper.get(),m_nDimension,m_xLogicTarget,m_pShapeFactory);
- auto eAlignment = LABEL_ALIGN_CENTER;
- awt::Point aScreenPosition2D(
- aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment, css::chart::DataLabelPlacement::OUTSIDE
- , rShapeParam.mfUnitCircleStartAngleDegree, rShapeParam.mfUnitCircleWidthAngleDegree
- , rShapeParam.mfUnitCircleInnerRadius, rShapeParam.mfUnitCircleOuterRadius, rShapeParam.mfLogicZ+0.5, 0 ));
- basegfx::B2IVector aTranslationVector = rPieLabelInfo.aFirstPosition - rPieLabelInfo.aOrigin;
- aTranslationVector.setLength(150);
- aScreenPosition2D.X += aTranslationVector.getX();
- aScreenPosition2D.Y += aTranslationVector.getY();
- rPieLabelInfo.xLabelGroupShape->setPosition(aScreenPosition2D);
- }
+ if( performLabelBestFitInnerPlacement(rShapeParam, rPieLabelInfo) )
+ return;
+
+ // If it does not fit inside, let's put it outside
+ PolarLabelPositionHelper aPolarPosHelper(m_pPosHelper.get(),m_nDimension,m_xLogicTarget,m_pShapeFactory);
+ auto eAlignment = LABEL_ALIGN_CENTER;
+ awt::Point aScreenPosition2D(
+ aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment, css::chart::DataLabelPlacement::OUTSIDE
+ , rShapeParam.mfUnitCircleStartAngleDegree, rShapeParam.mfUnitCircleWidthAngleDegree
+ , rShapeParam.mfUnitCircleInnerRadius, rShapeParam.mfUnitCircleOuterRadius, rShapeParam.mfLogicZ+0.5, 0 ));
+ basegfx::B2IVector aTranslationVector = rPieLabelInfo.aFirstPosition - rPieLabelInfo.aOrigin;
+ aTranslationVector.setLength(150);
+ aScreenPosition2D.X += aTranslationVector.getX();
+ aScreenPosition2D.Y += aTranslationVector.getY();
+ rPieLabelInfo.xLabelGroupShape->setPosition(aScreenPosition2D);
}
} //namespace chart