[Libreoffice-commits] core.git: chart2/qa chart2/source include/oox oox/source
chart2/qa/extras/chart2import.cxx | 38 +++-- chart2/qa/extras/data/docx/testMultilevelCategoryAxis.docx |binary chart2/source/tools/InternalData.cxx | 11 +++ include/oox/drawingml/chart/datasourcemodel.hxx|1 oox/source/drawingml/chart/chartconverter.cxx | 29 + oox/source/drawingml/chart/datasourcecontext.cxx | 25 oox/source/drawingml/chart/datasourcemodel.cxx |3 - oox/source/export/chartexport.cxx |8 ++ 8 files changed, 94 insertions(+), 21 deletions(-) New commits: commit fa0a981af41a2606541eec1cb20a379a739691e0 Author: Balazs Varga AuthorDate: Wed Jul 17 12:57:47 2019 +0200 Commit: László Németh CommitDate: Wed Jul 24 14:04:06 2019 +0200 tdf#114166 DOCX chart import: fix missing complex categories Now complex category labels are visible, and the inner data table contains the correct texts of the category columns. Note: repeating call of createDataSequenceByValueArray() API function can create all columns of the complex categories. See also commit 6c4e21a234f12e1310ba06f9859e08b424acf8bf "bnc#812796: Correctly handle static value array for OOXML charts." Change-Id: I333b79be35a24a912bb9e662116d0c85809a8fb2 Reviewed-on: https://gerrit.libreoffice.org/75776 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 107daed69fea..710d15ebd60e 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -131,6 +131,7 @@ public: void testDataPointInheritedColorDOCX(); void testExternalStrRefsXLSX(); void testSourceNumberFormatComplexCategoriesXLS(); +void testMultilevelCategoryAxis(); void testTdf123504(); void testTdf122765(); @@ -216,6 +217,7 @@ public: CPPUNIT_TEST(testDataPointInheritedColorDOCX); CPPUNIT_TEST(testExternalStrRefsXLSX); CPPUNIT_TEST(testSourceNumberFormatComplexCategoriesXLS); +CPPUNIT_TEST(testMultilevelCategoryAxis); CPPUNIT_TEST(testTdf123504); CPPUNIT_TEST(testTdf122765); @@ -1534,10 +1536,10 @@ void Chart2ImportTest::testInternalDataProvider() { // Parse mixed types, mixed role xDataSeq = rxDataProvider->createDataSequenceByValueArray("categories", "{42;\"hello\";0;\"world\"}"); xSequence = xDataSeq->getData(); -CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("42")),xSequence[0]); -CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("hello")), xSequence[1]); -CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("0")), xSequence[2]); -CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("world")), xSequence[3]); +CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Row 1 42")), xSequence[0]); +CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Row 2 hello")), xSequence[1]); +CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Row 3 0")), xSequence[2]); +CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Row 4 world")), xSequence[3]); } void Chart2ImportTest::testTdf90510() @@ -1946,6 +1948,34 @@ void Chart2ImportTest::testSourceNumberFormatComplexCategoriesXLS() CPPUNIT_ASSERT(nNumberFormat != 0); } +void Chart2ImportTest::testMultilevelCategoryAxis() +{ +load("/chart2/qa/extras/data/docx/", "testMultilevelCategoryAxis.docx"); +uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); +CPPUNIT_ASSERT(xChartDoc.is()); + +// Test the internal data. +CPPUNIT_ASSERT(xChartDoc->hasInternalDataProvider()); + +Reference xInternalProvider(xChartDoc->getDataProvider(), uno::UNO_QUERY); +CPPUNIT_ASSERT(xInternalProvider.is()); + +Reference xDescAccess(xInternalProvider, uno::UNO_QUERY); +CPPUNIT_ASSERT(xDescAccess.is()); + +// Get the complex category labels. +Sequence > aCategories = xDescAccess->getComplexRowDescriptions(); +CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aCategories.getLength()); +CPPUNIT_ASSERT_EQUAL(OUString("2011"), aCategories[0][0]); +CPPUNIT_ASSERT_EQUAL(OUString(""), aCategories[1][0]); +CPPUNIT_ASSERT_EQUAL(OUString("2012"), aCategories[2][0]); +CPPUNIT_ASSERT_EQUAL(OUString(""), aCategories[3][0]); +CPPUNIT_ASSERT_EQUAL(OUString("Categoria 1"), aCategories[0][1]); +CPPUNIT_ASSERT_EQUAL(OUString("Categoria 2"), aCategories[1][1]); +CPPUNIT_ASSERT_EQUAL(OUString("Categoria 3"), aCategories[2][1]); +CPPUNIT_ASSERT_EQUAL(OUString("Categoria 4"), aCategories[3][1]); +} + void Chart2ImportTest::testTdf123504() { load("/chart2/qa/extras/data/ods/", "pie_chart_100_and_0.ods"); diff --git a/chart2/qa/extras/data/docx/testMultilevelCategoryAxis.docx b/chart2/qa/extras/data/docx/testMultilevelCategoryAxis.docx new file mode 100644 index ..75605de72fc5 Binary files /dev/null and b/chart2/qa/extras/data/docx/testMultilevelCategoryAxis.docx differ diff --git a/chart2/so
[Libreoffice-commits] core.git: chart2/qa chart2/source include/oox oox/source
chart2/qa/extras/chart2export.cxx| 38 +++ chart2/qa/extras/data/ods/multilevelcat.ods |binary chart2/qa/extras/data/odt/multilevelcat.odt |binary chart2/source/tools/InternalDataProvider.cxx |1 include/oox/export/chartexport.hxx |3 oox/source/export/chartexport.cxx| 268 ++- 6 files changed, 269 insertions(+), 41 deletions(-) New commits: commit 8906275d40a1828db684e7d9c9bc4934a937bc6c Author: Balazs Varga AuthorDate: Tue Jul 9 13:30:16 2019 +0200 Commit: László Németh CommitDate: Mon Jul 15 11:38:13 2019 +0200 tdf#126193 Chart OOXML: Export Multi-level category labels Fix export of Multi-level category axis labels with the correct OOXML tags (as the OOXML Standard requested) in the correct order. Also fix tdf#126195: but only the export part of the whole fault, which combined (united) the text of the category axis labels at different levels. Change-Id: Iefcef00818a3bb2ee1671bf693335904be471722 Reviewed-on: https://gerrit.libreoffice.org/75299 Reviewed-by: László Németh Tested-by: László Németh diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index f00959bdbfeb..ab932ac2bc68 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -128,6 +128,8 @@ public: void testChartTitlePropertiesGradientFillPPTX(); void testChartTitlePropertiesBitmapFillPPTX(); void testxAxisLabelsRotation(); +void testMultipleCategoryAxisLablesXLSX(); +void testMultipleCategoryAxisLablesDOCX(); void testTdf116163(); void testTdf111824(); void testTdf119029(); @@ -226,6 +228,8 @@ public: CPPUNIT_TEST(testChartTitlePropertiesGradientFillPPTX); CPPUNIT_TEST(testChartTitlePropertiesBitmapFillPPTX); CPPUNIT_TEST(testxAxisLabelsRotation); +CPPUNIT_TEST(testMultipleCategoryAxisLablesXLSX); +CPPUNIT_TEST(testMultipleCategoryAxisLablesDOCX); CPPUNIT_TEST(testTdf116163); CPPUNIT_TEST(testTdf111824); CPPUNIT_TEST(testTdf119029); @@ -2092,6 +2096,40 @@ void Chart2ExportTest::testxAxisLabelsRotation() assertXPath(pXmlDoc1, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:txPr/a:bodyPr", "rot", "270"); } +void Chart2ExportTest::testMultipleCategoryAxisLablesXLSX() +{ +load("/chart2/qa/extras/data/ods/", "multilevelcat.ods"); +xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); +CPPUNIT_ASSERT(pXmlDoc); +// check category axis labels number of first level +assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:ptCount", "val", "6"); +// check category axis labels text of first level +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[1]/c:pt[1]/c:v", "Categoria 1"); +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[1]/c:pt[6]/c:v", "Categoria 6"); +// check category axis labels text of second level +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[2]/c:pt[1]/c:v", "2011"); +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[2]/c:pt[3]/c:v", "2013"); +// check the 'noMultiLvlLbl' tag - ChartExport.cxx:2950 FIXME: seems not support, so check the default noMultiLvlLbl value. +assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:noMultiLvlLbl", "val", "0"); +} + +void Chart2ExportTest::testMultipleCategoryAxisLablesDOCX() +{ +load("/chart2/qa/extras/data/odt/", "multilevelcat.odt"); +xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); +CPPUNIT_ASSERT(pXmlDoc); +// check category axis labels number of first level +assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:ptCount", "val", "4"); +// check category axis labels text of first level +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[1]/c:pt[1]/c:v", "Categoria 1"); +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[1]/c:pt[4]/c:v", "Categoria 4"); +// check category axis labels text of second level +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[2]/c:pt[1]/c:v", "2011"); +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[2]/c:pt[2]/c:v", "2012"); +// check th
[Libreoffice-commits] core.git: chart2/qa chart2/source include/oox oox/source
chart2/qa/extras/chart2export.cxx | 11 +++ chart2/qa/extras/data/pptx/tdf116163.pptx |binary chart2/source/view/axes/VAxisProperties.hxx|2 chart2/source/view/axes/VCartesianAxis.cxx | 50 + chart2/source/view/axes/VCartesianCoordinateSystem.cxx |2 chart2/source/view/axes/VCartesianCoordinateSystem.hxx |3 - chart2/source/view/axes/VCoordinateSystem.cxx |1 chart2/source/view/axes/VPolarCoordinateSystem.cxx |1 chart2/source/view/axes/VPolarCoordinateSystem.hxx |3 - chart2/source/view/inc/VCoordinateSystem.hxx |3 - chart2/source/view/main/ChartView.cxx |2 include/oox/export/chartexport.hxx |2 oox/source/export/chartexport.cxx | 20 +- 13 files changed, 92 insertions(+), 8 deletions(-) New commits: commit 35d062f7879d5414334643cb90bff411726b2168 Author: Szymon Kłos Date: Fri Mar 2 10:39:33 2018 +0100 tdf#116163: Limit label height in chart if needed Change-Id: Ia84fd0c3b76886bc6124dc3b59035465aa31b020 Reviewed-on: https://gerrit.libreoffice.org/50700 Tested-by: Jenkins Reviewed-by: Szymon Kłos diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 9f5efb140036..d0ab36eb743f 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -107,6 +107,7 @@ public: void testCustomDataLabel(); void testCustomDataLabelMultipleSeries(); void testNumberFormatExportPPTX(); +void testTdf116163(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -176,6 +177,7 @@ public: CPPUNIT_TEST(testCustomDataLabel); CPPUNIT_TEST(testCustomDataLabelMultipleSeries); CPPUNIT_TEST(testNumberFormatExportPPTX); +CPPUNIT_TEST(testTdf116163); CPPUNIT_TEST_SUITE_END(); protected: @@ -1743,6 +1745,15 @@ void Chart2ExportTest::testNumberFormatExportPPTX() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", "sourceLinked", "0"); } +void Chart2ExportTest::testTdf116163() +{ +load("/chart2/qa/extras/data/pptx/", "tdf116163.pptx"); +xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); +CPPUNIT_ASSERT(pXmlDoc); + +assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:txPr/a:bodyPr", "rot", "-540"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/pptx/tdf116163.pptx b/chart2/qa/extras/data/pptx/tdf116163.pptx new file mode 100644 index ..5fbee8304a52 Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf116163.pptx differ diff --git a/chart2/source/view/axes/VAxisProperties.hxx b/chart2/source/view/axes/VAxisProperties.hxx index 20f648d4fe8d..9a10c94f4719 100644 --- a/chart2/source/view/axes/VAxisProperties.hxx +++ b/chart2/source/view/axes/VAxisProperties.hxx @@ -137,6 +137,8 @@ struct AxisProperties final css::uno::Reference m_xAxisTextProvider; //for categories or series names //<- category axes +boolm_bLimitSpaceForLabels; + //methods: AxisProperties( const css::uno::Reference< css::chart2::XAxis >& xAxisModel diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 9dab35cc16ed..dd5593c66476 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -74,6 +74,53 @@ VCartesianAxis::~VCartesianAxis() m_pPosHelper = nullptr; } +void lcl_ResizeTextShapeToFitAvailableSpace( Reference< drawing::XShape >& xShape2DText, + const AxisLabelProperties& rAxisLabelProperties, + const OUString& rLabel, + const tNameSequence& rPropNames, + const tAnySequence& rPropValues ) +{ +uno::Reference< text::XTextRange > xTextRange( xShape2DText, uno::UNO_QUERY ); + +if( !xTextRange.is() ) +return; + +const sal_Int32 nFullHeight = rAxisLabelProperties.m_aFontReferenceSize.Height; + +if( !nFullHeight || !rLabel.getLength() ) +return; + +sal_Int32 nMaxLabelsHeight = nFullHeight - rAxisLabelProperties.m_aMaximumSpaceForLabels.Height - rAxisLabelProperties.m_aMaximumSpaceForLabels.Y; +const sal_Int32 nAvgCharWidth = xShape2DText->getSize().Width / rLabel.getLength(); +const sal_Int32 nTextSize = AbstractShapeFactory::getSizeAfterRotation( xShape2DText, + rAxisLabelProperties.fRotationAngleDegree ).Height; + +if( !nAvgCharWidth ) +return; + +const OUString sDots = "..."; +const sal_Int32 nCharsToRemove = ( nTextSize - nMaxLabe