[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2export3.cxx| 25 + chart2/qa/extras/data/ods/tdf148142.ods |binary xmloff/source/chart/SchXMLAxisContext.cxx |1 + 3 files changed, 26 insertions(+) New commits: commit deb2512e5ea16ad8fa9f975569fbc5363cebf8dd Author: Tünde Tóth AuthorDate: Wed May 17 13:49:29 2023 +0200 Commit: László Németh CommitDate: Fri May 19 13:09:26 2023 +0200 tdf#148142 chart: fix export of modified On/Between tick marks Reset the MajorOrigin property after import to avoid of the bad export of the modified document, which reset the original On tick marks/Between tick marks value. Follow-up to commit 40d83914d43f60a196dfabddea0b52e2046b333a "tdf#127792 implement UNO chart attribute MajorOrigin". Change-Id: I0e3915b7d1b601abd40fbd1ba9d01fc05a8fb7c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151885 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/qa/extras/chart2export3.cxx b/chart2/qa/extras/chart2export3.cxx index d22d5e51e545..845e6c98c6a6 100644 --- a/chart2/qa/extras/chart2export3.cxx +++ b/chart2/qa/extras/chart2export3.cxx @@ -716,6 +716,31 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testBarChartSecondaryAxisXLSX) assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:axId", "val", YValueIdOf2Barchart); } +CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testTdf148142) +{ +// The document contains a line chart with "Between tick marks" X axis position. +loadFromURL(u"ods/tdf148142.ods"); +Reference xChartDoc = getChartDocFromSheet(0, mxComponent); +CPPUNIT_ASSERT(xChartDoc.is()); +Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); +CPPUNIT_ASSERT(xAxis.is()); +chart2::ScaleData aScaleData = xAxis->getScaleData(); +CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition); + +// Set the X axis position to "On tick marks". +aScaleData.ShiftedCategoryPosition = false; +xAxis->setScaleData(aScaleData); + +// Check the X axis position after export. +saveAndReload("calc8"); +Reference xChartDoc2 = getChartDocFromSheet(0, mxComponent); +CPPUNIT_ASSERT(xChartDoc2.is()); +Reference xAxis2 = getAxisFromDoc(xChartDoc2, 0, 0, 0); +CPPUNIT_ASSERT(xAxis2.is()); +chart2::ScaleData aScaleData2 = xAxis2->getScaleData(); +CPPUNIT_ASSERT(!aScaleData2.ShiftedCategoryPosition); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/qa/extras/data/ods/tdf148142.ods b/chart2/qa/extras/data/ods/tdf148142.ods new file mode 100644 index ..9b736a06d19a Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf148142.ods differ diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx index ad8b187f88e2..ae55da90f8b5 100644 --- a/xmloff/source/chart/SchXMLAxisContext.cxx +++ b/xmloff/source/chart/SchXMLAxisContext.cxx @@ -547,6 +547,7 @@ void SchXMLAxisContext::CreateAxis() { aScaleData.ShiftedCategoryPosition = rtl::math::approxEqual(fMajorOrigin, 0.5); xAxis->setScaleData(aScaleData); +m_xAxisProps->setPropertyValue("MajorOrigin", uno::Any()); } }
[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2export.cxx| 22 +- xmloff/source/chart/SchXMLExport.cxx | 12 2 files changed, 33 insertions(+), 1 deletion(-) New commits: commit f1d798151048dde3f48b124ef406416668d1e9c5 Author: Tünde Tóth AuthorDate: Fri Oct 16 13:41:28 2020 +0200 Commit: László Németh CommitDate: Mon Oct 19 14:19:34 2020 +0200 tdf#137585 Chart ODF: fix export of DataLabelPlacement::CUSTOM Saving .ods, the DataLabelPlacement::CUSTOM converted to the default "avoid-overlap" instead of the requested "outside". Follow-up of commit 20da1a5dd37c7edac620566c992d5a53b23a5f12 (tdf#134978 Chart OOXML Import: fix pie chart label custom position) Change-Id: Ib15c7f24e0a650c84e6afce08b84e7eece8dafea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104430 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index e9d154d4ade1..d86fa14ef84c 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -180,6 +180,7 @@ public: void testTdf134977(); void testTdf123647(); void testTdf136267(); +void testDataLabelPlacementPieChart(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -322,6 +323,7 @@ public: CPPUNIT_TEST(testTdf134977); CPPUNIT_TEST(testTdf123647); CPPUNIT_TEST(testTdf136267); +CPPUNIT_TEST(testDataLabelPlacementPieChart); CPPUNIT_TEST_SUITE_END(); @@ -1432,7 +1434,7 @@ void Chart2ExportTest::testPieChartDataLabels() load("/chart2/qa/extras/data/docx/", "PieChartDataLabels.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); -assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser[1]/c:dLbls/c:dLbl[1]/c:dLblPos", "val", "bestFit"); +assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser[1]/c:dLbls/c:dLbl[1]/c:dLblPos", "val", "outEnd"); } void Chart2ExportTest::testSeriesIdxOrder() @@ -2949,6 +2951,24 @@ void Chart2ExportTest::testTdf136267() assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:cat/c:strRef/c:strCache/c:pt/c:v", "John"); } +void Chart2ExportTest::testDataLabelPlacementPieChart() +{ +load("/chart2/qa/extras/data/xlsx/", "tdf134978.xlsx"); +reload("calc8"); +uno::Reference xChartDoc(getChartCompFromSheet(0, mxComponent), + UNO_QUERY_THROW); +// test the placement of the manually positioned label +Reference + xDataPointPropSet(xChartDoc->getDiagram()->getDataPointProperties(2, 0), + uno::UNO_SET_THROW); +uno::Any aAny = xDataPointPropSet->getPropertyValue("LabelPlacement"); +CPPUNIT_ASSERT(aAny.hasValue()); +sal_Int32 nLabelPlacement = 0; +CPPUNIT_ASSERT(aAny >>= nLabelPlacement); +CPPUNIT_ASSERT_EQUAL(chart::DataLabelPlacement::OUTSIDE, nLabelPlacement); + +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 07a1019ccc71..723c07fe15c4 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -3407,6 +3408,17 @@ void SchXMLExportHelper_Impl::exportDataPoints( mxExpPropMapper); } +if (nCurrentODFVersion & SvtSaveOptions::ODFSVER_EXTENDED) +{ +sal_Int32 nPlacement = 0; +xPropSet->getPropertyValue("LabelPlacement") >>= nPlacement; +if (nPlacement == chart::DataLabelPlacement::CUSTOM) +{ +xPropSet->setPropertyValue("LabelPlacement", + uno::Any(chart::DataLabelPlacement::OUTSIDE)); +} +} + aPropertyStates = mxExpPropMapper->Filter(xPropSet); if (!aPropertyStates.empty() || !aDataLabelPropertyStates.empty()) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2geometry.cxx | 56 +++ chart2/qa/extras/data/odt/tdf135366_data_label_export.odt |binary chart2/qa/extras/data/pptx/tdf135366_CustomLabelText.pptx |binary xmloff/source/chart/SchXMLExport.cxx | 210 +++--- 4 files changed, 235 insertions(+), 31 deletions(-) New commits: commit 6d7a72ab1c044f7e1f30f7c4133dafdb214dfcbf Author: Regina Henschel AuthorDate: Thu Sep 10 14:42:55 2020 +0200 Commit: Regina Henschel CommitDate: Sat Sep 19 14:27:24 2020 +0200 tdf#135366 Save line and fill of data labels to ODF LibreOffice has line and fill properties of data labels in charts as loext attributes in the style of the or element. For ODF there has to be a element with line and fill properties in its style. This patch adds the needed elements and their associated elements. The element exists in ODF since version 1.2. The solution requires no extended namespace. The check is adapted in lcl_getCustomLabelField. Import was already done in commit 87d1ebeb11a00301745ee3c3c03fffb7033ab59d Change-Id: I829dae5433e8257c775aa4f08e511d514df4e936 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102381 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/chart2/qa/extras/chart2geometry.cxx b/chart2/qa/extras/chart2geometry.cxx index b3f537c372e0..be6d842d7780 100644 --- a/chart2/qa/extras/chart2geometry.cxx +++ b/chart2/qa/extras/chart2geometry.cxx @@ -21,6 +21,7 @@ #include #include +#include #include @@ -52,6 +53,8 @@ public: void testTdf128345Legend_CS_TG_axial_import(); void testTdf135366LabelOnSeries(); void testTdf135366LabelOnPoint(); +void testTdf135366LabelExport(); +void testTdf135366_CustomLabelText(); CPPUNIT_TEST_SUITE(Chart2GeometryTest); CPPUNIT_TEST(testTdf135184RoundLineCap); @@ -66,6 +69,8 @@ public: CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_import); CPPUNIT_TEST(testTdf135366LabelOnSeries); CPPUNIT_TEST(testTdf135366LabelOnPoint); +CPPUNIT_TEST(testTdf135366LabelExport); +CPPUNIT_TEST(testTdf135366_CustomLabelText); CPPUNIT_TEST_SUITE_END(); @@ -502,6 +507,57 @@ void Chart2GeometryTest::testTdf135366LabelOnPoint() nFillColor); } +void Chart2GeometryTest::testTdf135366LabelExport() +{ +// Error was, that line and fill properties were not exported as +// graphic-properties of a element, but only +// as loext chart-properties of the element. +load("/chart2/qa/extras/data/odt/", "tdf135366_data_label_export.odt"); +xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "writer8"); +CPPUNIT_ASSERT(pXmlDoc); + +// Find label style +const OString sLabelPath( + "//office:document-content/office:body/office:chart/chart:chart/chart:plot-area" + "/chart:series/chart:data-point[1]/chart:data-label/@chart:style-name"); +const OUString sOULabelStyleName = getXPathContent(pXmlDoc, sLabelPath); + +// Verify content of graphic properties of label style +const OString sStylePath( + "//office:document-content/office:automatic-styles/style:style[@style:name='" ++ OU2O(sOULabelStyleName) + "']/style:graphic-properties"); +assertXPath(pXmlDoc, sStylePath, 1); +assertXPath(pXmlDoc, sStylePath + "[@draw:fill='solid']"); +assertXPath(pXmlDoc, sStylePath + "[@draw:fill-color='#5050a0']"); +assertXPath(pXmlDoc, sStylePath + "[@draw:stroke='solid']"); +assertXPath(pXmlDoc, sStylePath + "[@svg:stroke-width='0.254cm']"); +assertXPath(pXmlDoc, sStylePath + "[@svg:stroke-color='#00']"); +} + +void Chart2GeometryTest::testTdf135366_CustomLabelText() +{ +// Error was, that custom text in a data label was only exported in ODF extended, +// although the used element exists since ODF 1.2. +SvtSaveOptions aSaveOpt; +const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(aSaveOpt.GetODFDefaultVersion()); +aSaveOpt.SetODFDefaultVersion(SvtSaveOptions::ODFVER_012); +load("/chart2/qa/extras/data/pptx/", "tdf135366_CustomLabelText.pptx"); +xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8"); +CPPUNIT_ASSERT(pXmlDoc); + +// Find custom text. As of version 7.0 it is in a element. +const OString sCustomTextPath( + "//office:document-content/office:body/office:chart/chart:chart/chart:plot-area" +"/chart:series/chart:data-point[2]/chart:data-label/text:p/text:span"); +assertXPath(pXmlDoc, sCustomTextPath, 1); + +// Verify text content +const OUString sOUTextContent = getXPathContent(pXmlDoc, sCustomTextPath); +CPPUNIT_ASSERT_EQUAL(OUString("Custom"), sOUTextContent); + +aSaveOpt.SetODFDefaultVersion(nCurrentODFVersion); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2GeometryTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/
[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2geometry.cxx | 100 +- chart2/qa/extras/data/ods/tdf135366_data_label_series.ods |binary chart2/qa/extras/data/odt/tdf135366_data_label_point.odt |binary xmloff/source/chart/SchXMLPlotAreaContext.cxx | 62 +++ xmloff/source/chart/SchXMLPlotAreaContext.hxx | 16 xmloff/source/chart/SchXMLSeries2Context.cxx | 231 ++ xmloff/source/chart/SchXMLSeries2Context.hxx |3 xmloff/source/chart/transporttypes.hxx| 18 + 8 files changed, 350 insertions(+), 80 deletions(-) New commits: commit 87d1ebeb11a00301745ee3c3c03fffb7033ab59d Author: Regina Henschel AuthorDate: Sat Aug 22 23:03:02 2020 +0200 Commit: Regina Henschel CommitDate: Sat Sep 5 17:49:15 2020 +0200 tdf#135366 ODF import of line and fill of data labels LibreOffice has line and fill properties of data labels in a chart in properties of kind "LabelBorderWidth" or "LabelFillColor" at a data point or, as defaults for the points, at a series. But ODF has such information in a element, which is refered by a element. That one can be child of a and child of a element. Microsoft Office correctly uses the element and its style for the line and fill properties of data labels. Up to now LO cannot import such information and does not write the ODF elements. Instead LibreOffice reads and writes attributes in 'loext' namespace. Using the "LabelFoo" properties was implemented by Kohei Yoshida, July 2014. Although there is no published service, these properties can be used in macros. Because they are now available since six years, the decision was to keep this internal model and convert on import and export. This patch implements the import of the ODF fill and line properties from the element and converts them to the internal used properties. LibreOffice has currently only implemented a few of the possible line and fill properties. When more are implemented, their pairs need to be added to the array aApiToLabelFooPairs, further adaptions are not needed. The contains in addition the absolute position of a data label. LibreOffice has internally only a position offset relative to the regular position of the label. The conversion of the position is not included in the patch. Change-Id: I5fd868945585971dac3dd945804a4a2951b8c12d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101194 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/chart2/qa/extras/chart2geometry.cxx b/chart2/qa/extras/chart2geometry.cxx index 091dafe67265..b3f537c372e0 100644 --- a/chart2/qa/extras/chart2geometry.cxx +++ b/chart2/qa/extras/chart2geometry.cxx @@ -11,10 +11,14 @@ #include +#include +#include #include +#include +#include +#include #include #include -#include #include @@ -46,6 +50,8 @@ public: void testTdf128345ChartWall_CS_TG_import(); void testTdf128345Legend_CS_TG_axial_export(); void testTdf128345Legend_CS_TG_axial_import(); +void testTdf135366LabelOnSeries(); +void testTdf135366LabelOnPoint(); CPPUNIT_TEST_SUITE(Chart2GeometryTest); CPPUNIT_TEST(testTdf135184RoundLineCap); @@ -58,6 +64,8 @@ public: CPPUNIT_TEST(testTdf128345ChartWall_CS_TG_import); CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_export); CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_import); +CPPUNIT_TEST(testTdf135366LabelOnSeries); +CPPUNIT_TEST(testTdf135366LabelOnPoint); CPPUNIT_TEST_SUITE_END(); @@ -71,12 +79,12 @@ protected: xmlDocUniquePtr parseExport(const OUString& rDir, const OUString& rFilterFormat); }; -// This is copied from Chart2ExportTest. It allows to access the chart form a MS Office document +namespace +{ +// This is copied from Chart2ExportTest. It allows to access the chart from a MS Office document // without knowing whether the file is a chart1.xml or chart2.xml... As of August 2020, Calc // and Impress use a static variable for the number and therefore the number depends on whether // there had already been savings before. -namespace -{ struct CheckForChartName { private: @@ -410,6 +418,90 @@ void Chart2GeometryTest::testTdf128345Legend_CS_TG_axial_import() assertXPath(pXmlDoc2, sStart + " and @draw:end='100%']"); } +void Chart2GeometryTest::testTdf135366LabelOnSeries() +{ +// Error was, that the fill and line properties of a were not +// imported at all. Here they should be at the series. +load("/chart2/qa/extras/data/ods/", "tdf135366_data_label_series.ods"); +uno::Reference xChartDoc = getChartDocFromSheet(0, mxComponent); +CPPUNIT_ASSERT(xChartDoc.is()); +Reference xDataSeries = getDataSeriesFromDoc(xChartDoc, 0); +CPPUNIT_ASSERT(xDataSeries.is()); +Reference xPropSet(xDataSeries, UNO_QUERY_THROW); +un
[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2export.cxx | 18 ++ chart2/qa/extras/data/ods/tdf136024.ods |binary xmloff/source/chart/SchXMLExport.cxx|1 + 3 files changed, 19 insertions(+) New commits: commit 177b54c2de7626ae42b65441cb81f359407431a1 Author: Balazs Varga AuthorDate: Fri Aug 28 14:18:57 2020 +0200 Commit: László Németh CommitDate: Mon Aug 31 09:45:16 2020 +0200 tdf#136024 chart2: fix ODF export of custom label positions of pie and donut chart data labels. Follow-up of commit 5339d0800ccdcd325294e61f8ae9e67648beb035 (tdf#130590 Chart OOXML export: fix custom label position). Change-Id: Ic45204a1273e59a47d1376f5f6c250025e3de621 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101543 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 6384ac17f0bc..fddfdc0c2e67 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -2312,6 +2313,23 @@ void Chart2ExportTest::testCustomPositionofDataLabel() double nY = aYVal.toDouble(); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.172648731408574, nY, 1e-7); } + +load("/chart2/qa/extras/data/ods/", "tdf136024.ods"); +{ +reload("calc8"); +// tdf#136024: test custom position of pie chart data label after an ods export +Reference xChartDoc = getChartDocFromSheet(0, mxComponent); +CPPUNIT_ASSERT(xChartDoc.is()); + +Reference xDataSeries(getDataSeriesFromDoc(xChartDoc, 0)); +CPPUNIT_ASSERT(xDataSeries.is()); +uno::Reference xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW); + +chart2::RelativePosition aCustomLabelPosition; +CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition); +CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Primary, -0.0961935120945059, 1e-5); +CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Secondary, 0.209578842093566, 1e-5); +} } void Chart2ExportTest::testCustomDataLabelMultipleSeries() diff --git a/chart2/qa/extras/data/ods/tdf136024.ods b/chart2/qa/extras/data/ods/tdf136024.ods new file mode 100644 index ..c8d004f54469 Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf136024.ods differ diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 2d65645d26c5..a2c18e494d19 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -3315,6 +3315,7 @@ void SchXMLExportHelper_Impl::exportDataPoints( aPoint.maStyleName = maAutoStyleNameQueue.front(); if(bExportNumFmt) aPoint.mCustomLabelText = lcl_getCustomLabelField(nElement, xSeries); +aPoint.mCustomLabelPos = lcl_getCustomLabelPosition(nElement, xSeries); maAutoStyleNameQueue.pop(); aDataPointVector.push_back( aPoint ); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2export.cxx | 21 chart2/qa/extras/data/docx/testCustomlabeltext.docx |binary xmloff/source/chart/SchXMLExport.cxx|2 - 3 files changed, 21 insertions(+), 2 deletions(-) New commits: commit ff0f684393b56182e01614d23d4ef836338d3517 Author: Balazs Varga AuthorDate: Wed Feb 26 10:26:43 2020 +0100 Commit: László Németh CommitDate: Sat Feb 29 18:03:11 2020 +0100 tdf#130955 chart export: fix repeated custom labels Do not add mCustomLabelText to aDataPointVector when we write leading empty data points, it is enough to add them, when we write data-point with style. Note: this fixes also DOCX import, when the embedded charts are imported by using ODF export in the background. Regression from commit: 7d2c7e7af04d9604d86d2d605ef95b9abb10966c (tdf#123206 Store custom label as chart:data-label) Change-Id: Ib3b370236323a57ac6800035d71321f7ee5dbe41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89504 Tested-by: László Németh Reviewed-by: László Németh diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 90b20d363b80..46c3e186d912 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -154,6 +154,7 @@ public: void testTdf122031(); void testTdf115012(); void testTdf123206_customLabelText(); +void testCustomLabelText(); void testDeletedLegendEntries(); void testTdf130225(); void testTdf126076(); @@ -274,6 +275,7 @@ public: CPPUNIT_TEST(testTdf122031); CPPUNIT_TEST(testTdf115012); CPPUNIT_TEST(testTdf123206_customLabelText); +CPPUNIT_TEST(testCustomLabelText); CPPUNIT_TEST(testDeletedLegendEntries); CPPUNIT_TEST(testTdf130225); CPPUNIT_TEST(testTdf126076); @@ -2484,6 +2486,25 @@ void Chart2ExportTest::testTdf123206_customLabelText() assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r/a:t", "kiscica"); } +void Chart2ExportTest::testCustomLabelText() +{ +load("/chart2/qa/extras/data/docx/", "testCustomlabeltext.docx"); + +Reference xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); +CPPUNIT_ASSERT(xChartDoc.is()); + +xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); +CPPUNIT_ASSERT(pXmlDoc); + +assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:idx", "val", "2"); +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:tx/c:rich/a:p/a:r[1]/a:t", "3.5"); +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:tx/c:rich/a:p/a:r[3]/a:t", "CustomLabel 1"); + +assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[2]/c:idx", "val", "3"); +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r[1]/a:t", "4.5"); +assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r[3]/a:t", "CustomLabel 2"); +} + void Chart2ExportTest::testDeletedLegendEntries() { load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry.xlsx"); diff --git a/chart2/qa/extras/data/docx/testCustomlabeltext.docx b/chart2/qa/extras/data/docx/testCustomlabeltext.docx new file mode 100644 index ..db28209c9c20 Binary files /dev/null and b/chart2/qa/extras/data/docx/testCustomlabeltext.docx differ diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 9c63a13b0217..51f399956ae0 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -3317,7 +3317,6 @@ void SchXMLExportHelper_Impl::exportDataPoints( { SchXMLDataPointStruct aPoint; aPoint.mnRepeat = nCurrIndex - nLastIndex - 1; -aPoint.mCustomLabelText = lcl_getCustomLabelField(nCurrIndex, xSeries); aDataPointVector.push_back( aPoint ); } @@ -3367,7 +3366,6 @@ void SchXMLExportHelper_Impl::exportDataPoints( // if we get here the property states are empty SchXMLDataPointStruct aPoint; -aPoint.mCustomLabelText = lcl_getCustomLabelField(nCurrIndex, xSeries); aDataPointVector.push_back( aPoint ); nLastIndex = nCurrIndex; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2export.cxx | 16 ++ chart2/qa/extras/data/docx/piechart_deleted_legend_entry.docx |binary xmloff/source/chart/SchXMLExport.cxx | 25 +- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 19 +++ 4 files changed, 59 insertions(+), 1 deletion(-) New commits: commit a96ec04a07c35338f5f9a0cb361b9322e5ca9cec Author: Tünde Tóth AuthorDate: Wed Feb 5 13:37:00 2020 +0100 Commit: László Németh CommitDate: Thu Feb 13 11:15:56 2020 +0100 tdf#130225 implement ODF export of deleted legend entries of pie charts Follow-up of the following commits related to the new UNO property DeletedLegendEntries for pie charts: commit 86be3422cd55fa9e44104f1628648061bb6a3495 (tdf#129857 Chart OOXML export: fix deleted legend entries) commit 6e847aa817999ab18acd534f9e6a86685bb268fc (tdf#129859 XLSX import: don't show deleted legend entries) Change-Id: Id24cddefa83e50dde1ec6555d02891753483dd5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88018 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 5ee135f5920b..1ff1064046e1 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -153,6 +153,7 @@ public: void testTdf115012(); void testTdf123206_customLabelText(); void testDeletedLegendEntries(); +void testTdf130225(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -269,6 +270,7 @@ public: CPPUNIT_TEST(testTdf115012); CPPUNIT_TEST(testTdf123206_customLabelText); CPPUNIT_TEST(testDeletedLegendEntries); +CPPUNIT_TEST(testTdf130225); CPPUNIT_TEST_SUITE_END(); @@ -2469,6 +2471,20 @@ void Chart2ExportTest::testDeletedLegendEntries() } } +void Chart2ExportTest::testTdf130225() +{ +load("/chart2/qa/extras/data/docx/", "piechart_deleted_legend_entry.docx"); +reload("Office Open XML Text"); +Reference xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); +CPPUNIT_ASSERT(xChartDoc.is()); +Reference xDataSeries(getDataSeriesFromDoc(xChartDoc, 0)); +CPPUNIT_ASSERT(xDataSeries.is()); +Reference xPropertySet(xDataSeries, uno::UNO_QUERY_THROW); +Sequence deletedLegendEntriesSeq; +CPPUNIT_ASSERT(xPropertySet->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), deletedLegendEntriesSeq[0]); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/docx/piechart_deleted_legend_entry.docx b/chart2/qa/extras/data/docx/piechart_deleted_legend_entry.docx new file mode 100644 index ..da6b2fa19a63 Binary files /dev/null and b/chart2/qa/extras/data/docx/piechart_deleted_legend_entry.docx differ diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index b3d18c7c758c..12f772b0d8b5 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -3188,10 +3188,15 @@ void SchXMLExportHelper_Impl::exportDataPoints( bool bVaryColorsByPoint = false; Sequence< sal_Int32 > aDataPointSeq; +Sequence deletedLegendEntriesSeq; if( xSeriesProperties.is()) { xSeriesProperties->getPropertyValue("AttributedDataPoints") >>= aDataPointSeq; xSeriesProperties->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint; + +const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); +if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 ) +xSeriesProperties->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq; } sal_Int32 nSize = aDataPointSeq.getLength(); @@ -3362,7 +3367,7 @@ void SchXMLExportHelper_Impl::exportDataPoints( // initialize so that it doesn't matter if // the element is counted in the first iteration aLastPoint.mnRepeat = 0; - +sal_Int32 nIndex = 0; for( const auto& rPoint : aDataPointVector ) { aPoint = rPoint; @@ -3379,6 +3384,15 @@ void SchXMLExportHelper_Impl::exportDataPoints( mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_REPEATED, OUString::number( ( aLastPoint.mnRepeat ) )); +for (auto& deletedLegendEntry : deletedLegendEntriesSeq) +{ +if (nIndex == deletedLegendEntry) +{ +mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_HIDE_LEGEND, OUString::boolean(true)); +break; +} +} +nIndex++; SvXMLElementExport aPointElem( mrExport, XML_NAMESPACE_CHART, XML_DATA_POINT, true, true ); exportCustomLabel(aLastPoint.mCustomLabelText);
[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2import.cxx | 22 -- chart2/qa/extras/data/odp/tdf123206.odp |binary xmloff/source/chart/SchXMLPlotAreaContext.cxx |2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) New commits: commit 2c7ef73e99dcecb6c86bcbf19135b89ad9e7db3a Author: Tamas Bunth AuthorDate: Thu Jan 2 12:55:16 2020 +0100 Commit: Tamás Bunth CommitDate: Thu Jan 2 14:38:12 2020 +0100 tdf#123206 Add test: import custom-label-field Add test for deprecated custom-label-field attribute of the data-point element. Change-Id: I9a7619898fa72900323e5b41728d2146c14203e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86103 Tested-by: Jenkins Reviewed-by: Tamás Bunth diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index be010f3b309f..3c505c8c201d 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -149,7 +149,7 @@ public: void testTdf123504(); void testTdf122765(); void testTdf121991(); - +void testTdf123206CustomLabelField(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); CPPUNIT_TEST(testSteppedLines); @@ -247,7 +247,7 @@ public: CPPUNIT_TEST(testTdf123504); CPPUNIT_TEST(testTdf122765); CPPUNIT_TEST(testTdf121991); - +CPPUNIT_TEST(testTdf123206CustomLabelField); CPPUNIT_TEST_SUITE_END(); private: @@ -2296,6 +2296,24 @@ void Chart2ImportTest::testTdf121991() CPPUNIT_ASSERT(!bShowLegendEntry); } +void Chart2ImportTest::testTdf123206CustomLabelField() +{ +// File contains the deprecated "custom-label-field" attribute of the +// "data-point" element. It should be interpreted and stored as a data point +// property. +uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromImpress("/chart2/qa/extras/data/odp/", "tdf123206.odp"), uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); +CPPUNIT_ASSERT(xChartDoc.is()); +Reference xDataSeries = getDataSeriesFromDoc(xChartDoc, 0); +CPPUNIT_ASSERT(xDataSeries.is()); +Reference xDp = xDataSeries->getDataPointByIndex(1); +Sequence> aLabelFields; +CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= aLabelFields); +CPPUNIT_ASSERT_EQUAL(static_cast(1), aLabelFields.getLength()); +CPPUNIT_ASSERT_EQUAL(OUString("Kiskacsa"), aLabelFields[0]->getString()); + +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/odp/tdf123206.odp b/chart2/qa/extras/data/odp/tdf123206.odp new file mode 100644 index ..1975756bce18 Binary files /dev/null and b/chart2/qa/extras/data/odp/tdf123206.odp differ diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 9767efd933dc..f488244e142f 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -702,6 +702,8 @@ void SchXMLDataPointContext::StartElement( const uno::Reference< xml::sax::XAttr } else if( nPrefix == XML_NAMESPACE_LO_EXT) { +// Deprecated. New documents use the chart:data-label element +// instead in order to store custom label text. if( IsXMLToken( aLocalName, XML_CUSTOM_LABEL_FIELD) && !mbHasLabelParagraph) { sCustomLabelField = xAttrList->getValueByIndex( i ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2import.cxx | 17 + chart2/qa/extras/data/ods/tdf128432.ods |binary xmloff/source/chart/SchXMLAxisContext.cxx | 19 +++ 3 files changed, 36 insertions(+) New commits: commit d0aaad22a95d96f4da2c930d98bdba138d4e15a1 Author: Balazs Varga AuthorDate: Tue Oct 29 16:55:40 2019 +0100 Commit: László Németh CommitDate: Wed Oct 30 10:17:38 2019 +0100 tdf#128432 OOXML chart import: fix x axis scale regression of 3D charts Set 3D charts ShiftedCategoryPosition value to default true in case of BarDiagram and StockDiagram. Regression from commit: 111c260ab2883b7906f1a66e222dbf4dc3c58c4f tdf#12 OOXML chart export: fix "CrossBetween" for not imported charts Change-Id: I5bf0e6f6e7ad96e6c96c01ab18d74d51419f5e3c Reviewed-on: https://gerrit.libreoffice.org/81695 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 ab1233b13110..134dec112caa 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -132,6 +132,7 @@ public: void testTdf114179(); void testTdf124243(); void testTdf127393(); +void testTdf128432(); void testDeletedDataLabel(); void testDataPointInheritedColorDOCX(); void testExternalStrRefsXLSX(); @@ -224,6 +225,7 @@ public: CPPUNIT_TEST(testTdf114179); CPPUNIT_TEST(testTdf124243); CPPUNIT_TEST(testTdf127393); +CPPUNIT_TEST(testTdf128432); CPPUNIT_TEST(testDeletedDataLabel); CPPUNIT_TEST(testDataPointInheritedColorDOCX); CPPUNIT_TEST(testExternalStrRefsXLSX); @@ -1995,6 +1997,21 @@ void Chart2ImportTest::testTdf127393() CPPUNIT_ASSERT(!aScaleData2.ShiftedCategoryPosition); } +void Chart2ImportTest::testTdf128432() +{ +load("/chart2/qa/extras/data/ods/", "tdf128432.ods"); + +uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, mxComponent); +CPPUNIT_ASSERT(xChartDoc.is()); + +Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); +CPPUNIT_ASSERT(xAxis.is()); + +chart2::ScaleData aScaleData = xAxis->getScaleData(); +CPPUNIT_ASSERT(aScaleData.Categories.is()); +CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition); +} + namespace { void checkDataLabelProperties(const Reference& xDataSeries, sal_Int32 nDataPointIndex, bool bValueVisible) diff --git a/chart2/qa/extras/data/ods/tdf128432.ods b/chart2/qa/extras/data/ods/tdf128432.ods new file mode 100644 index ..a93822fc9b66 Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf128432.ods differ diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx index aaa3b6f75bf1..931983bc8c01 100644 --- a/xmloff/source/chart/SchXMLAxisContext.cxx +++ b/xmloff/source/chart/SchXMLAxisContext.cxx @@ -461,6 +461,25 @@ void SchXMLAxisContext::CreateAxis() if( m_bAxisTypeImported ) m_xAxisProps->setPropertyValue("AxisType", uno::makeAny(m_nAxisType) ); +if( m_aCurrentAxis.eDimension == SCH_XML_AXIS_X ) +{ +bool bIs3DChart = false; +if( (xDiaProp->getPropertyValue("Dim3D") >>= bIs3DChart) && bIs3DChart ) +{ +OUString sChartType = m_xDiagram->getDiagramType(); +if( sChartType == "com.sun.star.chart.BarDiagram" || sChartType == "com.sun.star.chart.StockDiagram" ) +{ +Reference< chart2::XAxis > xAxis(lcl_getAxis(GetImport().GetModel(), m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex)); +if( xAxis.is() ) +{ +chart2::ScaleData aScaleData(xAxis->getScaleData()); +aScaleData.ShiftedCategoryPosition = true; +xAxis->setScaleData(aScaleData); +} +} +} +} + if( !m_aAutoStyleName.isEmpty()) { const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: chart2/qa xmloff/source
chart2/qa/extras/chart2import.cxx | 19 +++ chart2/qa/extras/data/docx/tdf124243.docx |binary xmloff/source/chart/SchXMLAxisContext.cxx |4 +--- 3 files changed, 20 insertions(+), 3 deletions(-) New commits: commit e8c7f4cd5bd95b8112c1795ed11b7ac7caed00a2 Author: Balazs Varga AuthorDate: Tue Aug 13 22:53:40 2019 +0200 Commit: László Németh CommitDate: Wed Aug 14 09:06:10 2019 +0200 tdf#124243 fix import of deleted X axis of 3D charts 3D charts imported from ODF and DOCX showed the deleted X axis. Change-Id: I3316d08af3acd122e5f75fbf0031dda6a337edbd Reviewed-on: https://gerrit.libreoffice.org/77432 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 90a1bd8485cf..116a0a93519f 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -128,6 +128,7 @@ public: void testTdf121205(); void testTdf114179(); +void testTdf124243(); void testDeletedDataLabel(); void testDataPointInheritedColorDOCX(); void testExternalStrRefsXLSX(); @@ -215,6 +216,7 @@ public: CPPUNIT_TEST(testTdf121205); CPPUNIT_TEST(testTdf114179); +CPPUNIT_TEST(testTdf124243); CPPUNIT_TEST(testDeletedDataLabel); CPPUNIT_TEST(testDataPointInheritedColorDOCX); CPPUNIT_TEST(testExternalStrRefsXLSX); @@ -1908,6 +1910,23 @@ void Chart2ImportTest::testTdf114179() CPPUNIT_ASSERT( aSize.Height > 0); } +void Chart2ImportTest::testTdf124243() +{ +load("/chart2/qa/extras/data/docx/", "tdf124243.docx"); +uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); + +Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); +CPPUNIT_ASSERT(xAxis.is()); + +Reference xPS(xAxis, uno::UNO_QUERY_THROW); +bool bShow = true; +// test X Axis is not visible. +bool bSuccess = xPS->getPropertyValue("Show") >>= bShow; +CPPUNIT_ASSERT(bSuccess); +CPPUNIT_ASSERT(!bShow); +} + namespace { void checkDataLabelProperties(const Reference& xDataSeries, sal_Int32 nDataPointIndex, bool bValueVisible) diff --git a/chart2/qa/extras/data/docx/tdf124243.docx b/chart2/qa/extras/data/docx/tdf124243.docx new file mode 100644 index ..e58ef6a02e45 Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf124243.docx differ diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx index f55877609937..881fa4d274fb 100644 --- a/xmloff/source/chart/SchXMLAxisContext.cxx +++ b/xmloff/source/chart/SchXMLAxisContext.cxx @@ -391,9 +391,7 @@ void SchXMLAxisContext::CreateAxis() break; case SCH_XML_AXIS_Z: if( m_aCurrentAxis.nAxisIndex == 0 ) -aPropName = "HasXAxis"; -else -aPropName = "HasSecondaryXAxis"; +aPropName = "HasZAxis"; break; case SCH_XML_AXIS_UNDEF: SAL_INFO("xmloff.chart", "Invalid axis" ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits