summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-04-09 13:45:10 +0200
committerLászló Németh <nemeth@numbertext.org>2020-04-17 12:16:17 +0200
commit434d92a51409b0847ee7d313b50fc547b7615bff (patch)
tree5eb1bc8b13585c8e05223197a56eac2d7a8d4044 /chart2
parent8cb04bde0aeea1bd0f324ecf989af015356da285 (diff)
tdf#131979 Chart ODF import-export of Link to source format
setting also into data point styles, fixing lost numbering style of custom data points. (Only export into the data series style was supported previously.) Also fix tdf#131115 - FILEOPEN: Incorrect format of single data label Regression from commit: e57d90cd4e51a1353eafc87bb29cfe6076704a7c (tdf#129173 tdf#129175 Fix number format of data labels) Data point styles in older ODF files do not contain the 'link-data-style-to-source' property, so they used the data series style property during the import previously. Now we set the default false value, if the data point style contains a 'data-style-name' (number format). Change-Id: I4786e62ca75770ed632463bcf1275ece7ea793f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91967 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2export.cxx33
-rw-r--r--chart2/qa/extras/data/ods/tdf131115.odsbin0 -> 13814 bytes
-rw-r--r--chart2/qa/extras/data/ods/tdf131979.odsbin0 -> 11510 bytes
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx12
4 files changed, 39 insertions, 6 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 10b284adb344..378e2361d034 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -164,6 +164,7 @@ public:
void testTdf126076();
void testTdf75330();
void testTdf127792();
+ void testTdf131979();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
@@ -291,6 +292,7 @@ public:
CPPUNIT_TEST(testTdf126076);
CPPUNIT_TEST(testTdf75330);
CPPUNIT_TEST(testTdf127792);
+ CPPUNIT_TEST(testTdf131979);
CPPUNIT_TEST_SUITE_END();
@@ -2678,6 +2680,37 @@ void Chart2ExportTest::testTdf127792()
}
}
+void Chart2ExportTest::testTdf131979()
+{
+ load("/chart2/qa/extras/data/ods/", "tdf131115.ods");
+ {
+ reload("calc8");
+ Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT(xChartDoc.is());
+ Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+ CPPUNIT_ASSERT(xDataSeries.is());
+ Reference<beans::XPropertySet> xPropertySet;
+ xPropertySet.set(xDataSeries->getDataPointByIndex(2), uno::UNO_SET_THROW);
+ bool blinknumberformattosource = true;
+ CPPUNIT_ASSERT(xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= blinknumberformattosource);
+ CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to false.", !blinknumberformattosource);
+ }
+
+ load("/chart2/qa/extras/data/ods/", "tdf131979.ods");
+ {
+ reload("calc8");
+ Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT(xChartDoc.is());
+ Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+ CPPUNIT_ASSERT(xDataSeries.is());
+ Reference<beans::XPropertySet> xPropertySet;
+ xPropertySet.set(xDataSeries->getDataPointByIndex(2), uno::UNO_SET_THROW);
+ bool blinknumberformattosource = true;
+ CPPUNIT_ASSERT(xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= blinknumberformattosource);
+ CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", blinknumberformattosource);
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/ods/tdf131115.ods b/chart2/qa/extras/data/ods/tdf131115.ods
new file mode 100644
index 000000000000..76a87c2c226c
--- /dev/null
+++ b/chart2/qa/extras/data/ods/tdf131115.ods
Binary files differ
diff --git a/chart2/qa/extras/data/ods/tdf131979.ods b/chart2/qa/extras/data/ods/tdf131979.ods
new file mode 100644
index 000000000000..3dfcf6b699f9
--- /dev/null
+++ b/chart2/qa/extras/data/ods/tdf131979.ods
Binary files differ
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index db8fd95abea7..a695076a4c13 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -118,6 +118,12 @@ void lcl_AddPropertiesToVector_PointProperties(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID );
+ rOutProperties.emplace_back( CHART_UNONAME_LINK_TO_SRC_NUMFMT,
+ PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
+ cppu::UnoType<bool>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
+
rOutProperties.emplace_back( "PercentageNumberFormat",
PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
cppu::UnoType<sal_Int32>::get(),
@@ -176,12 +182,6 @@ void lcl_AddPropertiesToVector_SeriesOnly(
cppu::UnoType<sal_Int32>::get(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT );
-
- rOutProperties.emplace_back( CHART_UNONAME_LINK_TO_SRC_NUMFMT,
- PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
- cppu::UnoType<bool>::get(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT );
}
uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType )