summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-11-27 10:31:48 +0100
committerLászló Németh <nemeth@numbertext.org>2019-12-05 09:42:59 +0100
commit408d90c89eefedfe487c00bd8c6ba9ee76870bf7 (patch)
tree34f3595e21b9bd297dc0826c1da3397ec48fa0e6 /chart2
parent4cd89b652d9de01d4d0e24332d351e8df4089cf0 (diff)
tdf#129054 Chart OOXML Import: Fix size of Pie Chart
Do not shift (set to false ShiftedCategoryPosition) the category axis for Pie chart with complex category. Change-Id: I3b1d99899a2daf9fd7a596c88531797aa5084734 Reviewed-on: https://gerrit.libreoffice.org/83871 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit ea97f0926e138712c3800f5274012f0f04fc1c47) Reviewed-on: https://gerrit.libreoffice.org/84187 Reviewed-by: Balazs Varga <balazs.varga991@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/inc/ChartTypeHelper.hxx1
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx11
-rw-r--r--chart2/source/view/main/ChartView.cxx3
3 files changed, 14 insertions, 1 deletions
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx
index c2945dfb9380..c570a15163bd 100644
--- a/chart2/source/inc/ChartTypeHelper.hxx
+++ b/chart2/source/inc/ChartTypeHelper.hxx
@@ -49,6 +49,7 @@ public:
static bool shiftCategoryPosAtXAxisPerDefault( const css::uno::Reference< css::chart2::XChartType >& xChartType );
static bool isSupportingAxisPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionIndex );
+ static bool isSupportingComplexCategory( const css::uno::Reference< css::chart2::XChartType >& xChartType );
//returns sequence of css::chart::DataLabelPlacement
static css::uno::Sequence < sal_Int32 > getSupportedLabelPlacements(
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index 78d841755374..92974f5c5585 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -419,6 +419,17 @@ bool ChartTypeHelper::isSupportingDateAxis( const uno::Reference< chart2::XChart
return true;
}
+bool ChartTypeHelper::isSupportingComplexCategory( const uno::Reference< chart2::XChartType >& xChartType )
+{
+ if( xChartType.is() )
+ {
+ OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return false;
+ }
+ return true;
+}
+
bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const uno::Reference< chart2::XChartType >& xChartType )
{
if(xChartType.is())
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 0e4d1124847b..f8456f7e6698 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -653,6 +653,7 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
{
uno::Reference<XCoordinateSystem> xCooSys = pVCooSys->getModel();
sal_Int32 nDimCount = xCooSys->getDimension();
+ bool bComplexCategoryAllowed = ChartTypeHelper::isSupportingComplexCategory(AxisHelper::getChartTypeByIndex(xCooSys, 0));
for (sal_Int32 nDimIndex = 0; nDimIndex < nDimCount; ++nDimIndex)
{
@@ -677,7 +678,7 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
if (nDimIndex == 0)
AxisHelper::checkDateAxis( aSourceScale, pCatProvider, bDateAxisAllowed );
- bool bHasComplexCat = pCatProvider && pCatProvider->hasComplexCategories();
+ bool bHasComplexCat = pCatProvider && pCatProvider->hasComplexCategories() && bComplexCategoryAllowed;
aSourceScale.ShiftedCategoryPosition = isCategoryPositionShifted(aSourceScale, bHasComplexCat);
m_aAxisUsageList[xAxis].aAutoScaling = ScaleAutomatism(aSourceScale, rNullDate);