chart2/source/inc/ChartTypeHelper.hxx | 1 + chart2/source/tools/ChartTypeHelper.cxx | 11 +++++++++++ chart2/source/view/main/ChartView.cxx | 3 ++- sw/qa/extras/layout/data/tdf129054.docx |binary sw/qa/extras/layout/layout.cxx | 26 ++++++++++++++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-)
New commits: commit 408d90c89eefedfe487c00bd8c6ba9ee76870bf7 Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Wed Nov 27 10:31:48 2019 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Thu Dec 5 09:42:59 2019 +0100 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 <nem...@numbertext.org> (cherry picked from commit ea97f0926e138712c3800f5274012f0f04fc1c47) Reviewed-on: https://gerrit.libreoffice.org/84187 Reviewed-by: Balazs Varga <balazs.varga...@gmail.com> 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); diff --git a/sw/qa/extras/layout/data/tdf129054.docx b/sw/qa/extras/layout/data/tdf129054.docx new file mode 100644 index 000000000000..5d02d7e87a33 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf129054.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 70dd29b73cc1..f02a69ae042e 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2447,6 +2447,32 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) "15"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129054) +{ + SwDoc* pDoc = createDoc("tdf129054.docx"); + SwDocShell* pShell = pDoc->GetDocShell(); + + // Dump the rendering of the first page as an XML file. + std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); + MetafileXmlDump dumper; + xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + + // Test the size of diameter of Pie chart. + sal_Int32 nYTop + = getXPath(pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/push[4]/polyline[1]/point[1]", + "y") + .toInt32(); + sal_Int32 nYBottom + = getXPath( + pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/push[4]/polyline[1]/point[31]", + "y") + .toInt32(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4810), nYTop - nYBottom); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116925) { SwDoc* pDoc = createDoc("tdf116925.docx"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits