tdf#50934: Ensure BarOfPie has ScaleData::ShiftedCategoryPosition == false
Change-Id: I86c7ba4df89a1350f544345938a29c210903c06d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160722
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index 6703914..e91eab1 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -571,7 +571,13 @@ void ChartTypeTemplate::adaptScales(
rtl::Reference< ChartType > xChartType = getChartTypeForNewSeries2({});
if( aData.AxisType == AxisType::CATEGORY )
{
aData.ShiftedCategoryPosition = m_aServiceName.indexOf("Column") != -1 || m_aServiceName.indexOf("Bar") != -1 || m_aServiceName.endsWith("Close");
// Shift for Column, Hi-Lo-Close, and regular
// Bar types, but not BarOfPie
aData.ShiftedCategoryPosition =
m_aServiceName.indexOf("Column") != -1 ||
(m_aServiceName.indexOf("Bar") != -1 &&
!m_aServiceName.indexOf("BarOfPie")) ||
m_aServiceName.endsWith("Close");
}
bool bSupportsDates = ::chart::ChartTypeHelper::isSupportingDateAxis( xChartType, nDimensionX );
if( aData.AxisType != AxisType::CATEGORY && ( aData.AxisType != AxisType::DATE || !bSupportsDates) )
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index 7aeb18d..0f924de 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -287,6 +287,7 @@ rtl::Reference<SvxShape> PieChart::createDataPoint(
aOffset = aNewOrigin - aOrigin;
}
} else if (m_eSubType != PieChartSubType_NONE) {
// Draw the main pie for bar-of-pie/pie-of-pie smaller and to the left
drawing::Position3D aOrigin = m_aPosHelper.transformUnitCircleToScene(0, 0, rParam.mfLogicZ);
drawing::Position3D aNewOrigin = m_aPosHelper.transformUnitCircleToScene(180, 1.0, rParam.mfLogicZ);
aOffset = aNewOrigin - aOrigin;