chart2/source/view/charttypes/PieChart.cxx | 35 ++++++++++------------------- 1 file changed, 13 insertions(+), 22 deletions(-)
New commits: commit 65b09ff5975f1c53ed33870ffa974fbf8b94279d Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Fri Aug 15 13:25:39 2014 -0400 Annotate code & remove unnecessary scope. Change-Id: I4b8ccef5125c52c48e5d9757bb1f245bf73d0629 diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 1f52415..3edf2af 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -46,7 +46,7 @@ struct PieChart::ShapeParam double mfUnitCircleOuterRadius; double mfUnitCircleInnerRadius; double mfExplodePercentage; - double mfLogicYSum; + double mfLogicYSum; // sum of all Y values in a single series. double mfLogicZ; double mfDepth; @@ -227,6 +227,7 @@ void PieChart::createTextLabelShape( VDataSeries& rSeries, sal_Int32 nPointIndex, ShapeParam& rParam ) { if (!rSeries.getDataPointLabelIfLabel(nPointIndex)) + // There is no text label for this data point. Nothing to do. return; if (!rtl::math::approxEqual(rParam.mfExplodePercentage, 0.0)) @@ -254,6 +255,7 @@ void PieChart::createTextLabelShape( nScreenValueOffsetInRadiusDirection = (3!=m_nDimension) ? 150 : 0;//todo maybe calculate this font height dependent else if( nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::INSIDE ) nScreenValueOffsetInRadiusDirection = (3!=m_nDimension) ? -150 : 0;//todo maybe calculate this font height dependent + PolarLabelPositionHelper aPolarPosHelper(m_pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory); awt::Point aScreenPosition2D( aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment, nLabelPlacement @@ -438,6 +440,7 @@ void PieChart::createShapes() bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor"); + // Counter-clockwise offset from the 3 o'clock position. m_pPosHelper->m_fAngleDegreeOffset = pSeries->getStartingAngle(); //iterate through all points to get the sum @@ -456,6 +459,7 @@ void PieChart::createShapes() } if (aParam.mfLogicYSum == 0.0) + // Total sum of all Y values in this series is zero. Skip the whole series. continue; double fLogicYForNextPoint = 0.0; @@ -507,13 +511,11 @@ void PieChart::createShapes() //point color: boost::scoped_ptr< tPropertyNameValueMap > apOverwritePropertiesMap(NULL); + if (!pSeries->hasPointOwnColor(nPointIndex) && m_xColorScheme.is()) { - if(!pSeries->hasPointOwnColor(nPointIndex) && m_xColorScheme.is()) - { - apOverwritePropertiesMap.reset( new tPropertyNameValueMap() ); - (*apOverwritePropertiesMap)["FillColor"] = uno::makeAny( - m_xColorScheme->getColorByIndex( nPointIndex )); - } + apOverwritePropertiesMap.reset( new tPropertyNameValueMap() ); + (*apOverwritePropertiesMap)["FillColor"] = uno::makeAny( + m_xColorScheme->getColorByIndex( nPointIndex )); } //create data point commit 5cc38c1bf60dc851ec908f7a9eac4c6e70e849f7 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Fri Aug 15 09:39:19 2014 -0400 Nested conditional !(cond1 && cond2 && cond3) is harder on human brain. Change-Id: I1c10c7f0f85607a826ec06ffce12de761af3921a diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 32542d2..1f52415 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -391,8 +391,8 @@ void PieChart::createShapes() // No series to plot. return; - OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"PieChart is not proper initialized"); - if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is())) + OSL_ENSURE(m_pShapeFactory && m_xLogicTarget.is() && m_xFinalTarget.is(), "PieChart is not properly initialized."); + if (!m_pShapeFactory || !m_xLogicTarget.is() || !m_xFinalTarget.is()) return; //the text labels should be always on top of the other series shapes commit 7ecc633bfe4bda3e0647b411ad7d1e6a3357c908 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Fri Aug 15 09:36:42 2014 -0400 Using empty() makes it clearer. Change-Id: I031f478aab721af0a65762f98bcde3b2473453e6 diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index eeaf1c5..32542d2 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -387,7 +387,8 @@ bool PieChart::isSeparateStackingForDifferentSigns( sal_Int32 /* nDimensionIndex void PieChart::createShapes() { - if( m_aZSlots.begin() == m_aZSlots.end() ) //no series + if (m_aZSlots.empty()) + // No series to plot. return; OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"PieChart is not proper initialized"); commit 9177375a5e0795d073770e119ba5a8851103d046 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Fri Aug 15 09:30:27 2014 -0400 TODO items from the old maintainers. No longer relevant. Change-Id: I699e320af9862fa3dc5f7408a834714668625888 diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index b900e9c..eeaf1c5 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -573,18 +573,6 @@ void PieChart::createShapes() }//next series in x slot (next y slot) }//next category }//next x slot - /* @todo remove series shapes if empty - //remove and delete point-group-shape if empty - if(!xSeriesGroupShape_Shapes->getCount()) - { - (*aSeriesIter)->m_xShape.set(NULL); - m_xLogicTarget->remove(xSeriesGroupShape_Shape); - } - */ - - //remove and delete series-group-shape if empty - - //... todo } namespace _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits