tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / qa / extras / chart2export2.cxx
blob12977d0ec44ab52fa15de741f346c202f23698f8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include "charttest.hxx"
12 #include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
13 #include <com/sun/star/chart2/DataPointCustomLabelFieldType.hpp>
14 #include <com/sun/star/chart2/RelativePosition.hpp>
15 #include <com/sun/star/text/XText.hpp>
16 #include <com/sun/star/chart2/DataPointLabel.hpp>
17 #include <com/sun/star/chart/DataLabelPlacement.hpp>
18 #include <com/sun/star/graphic/XGraphic.hpp>
20 using uno::Reference;
21 using beans::XPropertySet;
23 class Chart2ExportTest2 : public ChartTest
25 public:
26 Chart2ExportTest2()
27 : ChartTest(u"/chart2/qa/extras/data/"_ustr)
32 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testSetSeriesToSecondaryAxisXLSX)
34 loadFromFile(u"xlsx/add_series_secondary_axis.xlsx");
35 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
36 // Second series
37 Reference<chart2::XDataSeries> xSeries = getDataSeriesFromDoc(xChartDoc, 1);
38 CPPUNIT_ASSERT(xSeries.is());
40 Reference<beans::XPropertySet> xPropSet(xSeries, uno::UNO_QUERY_THROW);
41 sal_Int32 AxisIndex = 1;
42 // Attach the second series to the secondary axis. (The third series is already attached.)
43 xPropSet->setPropertyValue(u"AttachedAxisIndex"_ustr, uno::Any(AxisIndex));
45 save(u"Calc Office Open XML"_ustr);
46 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
47 CPPUNIT_ASSERT(pXmlDoc);
48 // Check there are only two <lineChart> tag in the XML, one for the primary and one for the secondary axis.
49 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart", 2);
52 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCombinedChartSecondaryAxisXLSX)
54 // Original file was created with MS Office
55 loadFromFile(u"xlsx/combined_chart_secondary_axis.xlsx");
56 save(u"Calc Office Open XML"_ustr);
57 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
58 CPPUNIT_ASSERT(pXmlDoc);
59 // Collect barchart axID on secondary Axis
60 OUString XValueIdOfBarchart
61 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[1]", "val");
62 OUString YValueIdOfBarchart
63 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[2]", "val");
64 // Collect linechart axID on primary Axis
65 OUString XValueIdOfLinechart
66 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[1]", "val");
67 OUString YValueIdOfLinechart
68 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[2]", "val");
69 // Check which c:catAx and c:valAx contain the AxisId of charttypes
70 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx[1]/c:axId", "val",
71 XValueIdOfLinechart);
72 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[1]/c:axId", "val",
73 YValueIdOfLinechart);
74 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx[2]/c:axId", "val",
75 XValueIdOfBarchart);
76 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:axId", "val",
77 YValueIdOfBarchart);
80 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCombinedChartSecondaryAxisODS)
82 // Original file was created with LibreOffice
83 loadFromFile(u"ods/combined_chart_secondary_axis.ods");
84 save(u"Calc Office Open XML"_ustr);
85 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
86 CPPUNIT_ASSERT(pXmlDoc);
87 // Collect barchart axID on secondary Axis
88 OUString XValueIdOfBarchart
89 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[1]", "val");
90 OUString YValueIdOfBarchart
91 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[2]", "val");
92 // Collect linechart axID on primary Axis
93 OUString XValueIdOfLinechart
94 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[1]", "val");
95 OUString YValueIdOfLinechart
96 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[2]", "val");
97 // Check which c:catAx and c:valAx contain the AxisId of charttypes
98 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx[1]/c:axId", "val",
99 XValueIdOfLinechart);
100 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[1]/c:axId", "val",
101 YValueIdOfLinechart);
102 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx[2]/c:axId", "val",
103 XValueIdOfBarchart);
104 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:axId", "val",
105 YValueIdOfBarchart);
106 // do not need CT_crosses tag if the actual axis is deleted, so we need to make sure it is not saved
107 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx[2]/c:crosses", 0);
110 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCrossBetweenXLSX)
112 // FIXME: validation error in OOXML export: Errors: 1
113 skipValidation();
115 // Original files were created with MS Office
117 loadFromFile(u"xlsx/tdf127777.xlsx");
118 save(u"Calc Office Open XML"_ustr);
119 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
120 CPPUNIT_ASSERT(pXmlDoc);
121 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val",
122 u"between");
125 loadFromFile(u"xlsx/tdf132076.xlsx");
126 save(u"Calc Office Open XML"_ustr);
127 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
128 CPPUNIT_ASSERT(pXmlDoc);
129 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val",
130 u"between");
134 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCrossBetweenWithDeletedAxis)
136 // Original file was created with MS Office (the category axis is deleted in the file)
137 loadFromFile(u"xlsx/tdf128633.xlsx");
138 save(u"Calc Office Open XML"_ustr);
139 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
140 CPPUNIT_ASSERT(pXmlDoc);
141 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val",
142 u"between");
145 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCrossBetweenODS)
147 // Original file was created with LibreOffice
148 loadFromFile(u"ods/test_CrossBetween.ods");
149 save(u"Calc Office Open XML"_ustr);
150 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
151 CPPUNIT_ASSERT(pXmlDoc);
152 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val",
153 u"between");
156 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testAxisTitleRotationXLSX)
158 loadFromFile(u"xlsx/axis_title_rotation.xlsx");
159 save(u"Calc Office Open XML"_ustr);
160 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
161 CPPUNIT_ASSERT(pXmlDoc);
163 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:title/c:tx/c:rich/a:bodyPr",
164 "rot", u"0");
167 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testAxisTitlePositionDOCX)
169 loadFromFile(u"docx/testAxisTitlePosition.docx");
170 save(u"Office Open XML Text"_ustr);
171 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
172 CPPUNIT_ASSERT(pXmlDoc);
174 // test X Axis title position
175 OUString aXVal = getXPath(
176 pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:title/c:layout/c:manualLayout/c:x",
177 "val");
178 double nX = aXVal.toDouble();
179 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.698208543867708, nX, 1e-3);
180 OUString aYVal = getXPath(
181 pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:title/c:layout/c:manualLayout/c:y",
182 "val");
183 double nY = aYVal.toDouble();
184 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.805152435594555, nY, 1e-3);
186 // test Y Axis title position
187 aXVal = getXPath(pXmlDoc,
188 "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:title/c:layout/c:manualLayout/c:x",
189 "val");
190 nX = aXVal.toDouble();
191 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0253953671500755, nX, 1e-3);
192 aYVal = getXPath(pXmlDoc,
193 "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:title/c:layout/c:manualLayout/c:y",
194 "val");
195 nY = aYVal.toDouble();
196 // just test the first two decimal digits because it is not perfect in docx yet.
197 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.384070199122511, nY, 1e-2);
200 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testAxisCrossBetweenDOCX)
202 loadFromFile(u"odt/axis-position.odt");
204 // FIXME: validation error in OOXML export: Errors: 3
205 skipValidation();
207 save(u"Office Open XML Text"_ustr);
208 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
209 assertXPath(pXmlDoc, "(//c:crossBetween)[1]", "val", u"midCat");
212 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testPieChartDataPointExplosionXLSX)
214 loadFromFile(u"xlsx/pie_chart_datapoint_explosion.xlsx");
215 save(u"Calc Office Open XML"_ustr);
216 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
217 CPPUNIT_ASSERT(pXmlDoc);
219 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dPt/c:explosion",
220 "val", u"28");
223 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCustomDataLabel)
225 loadFromFile(u"pptx/tdf115107.pptx");
227 Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
228 CPPUNIT_ASSERT(xChartDoc.is());
230 uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
231 CPPUNIT_ASSERT(xDataSeries.is());
232 float nFontSize;
233 sal_Int64 nFontColor;
234 sal_Int32 nCharUnderline;
235 uno::Reference<beans::XPropertySet> xPropertySet;
236 uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields;
238 // 1
239 xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
240 xPropertySet->getPropertyValue(u"CustomLabelFields"_ustr) >>= aFields;
241 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), aFields.getLength());
243 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
244 aFields[0]->getFieldType());
245 CPPUNIT_ASSERT_EQUAL(u"90.0 = "_ustr, aFields[0]->getString());
246 aFields[0]->getPropertyValue(u"CharHeight"_ustr) >>= nFontSize;
247 aFields[0]->getPropertyValue(u"CharColor"_ustr) >>= nFontColor;
248 CPPUNIT_ASSERT_EQUAL(static_cast<float>(18), nFontSize);
249 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xed7d31), nFontColor);
251 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_VALUE,
252 aFields[1]->getFieldType());
253 CPPUNIT_ASSERT_EQUAL(u"90"_ustr, aFields[1]->getString());
254 CPPUNIT_ASSERT_EQUAL(u"{0C576297-5A9F-4B4E-A675-B6BA406B7D87}"_ustr, aFields[1]->getGuid());
256 // 2
257 xPropertySet.set(xDataSeries->getDataPointByIndex(1), uno::UNO_SET_THROW);
258 xPropertySet->getPropertyValue(u"CustomLabelFields"_ustr) >>= aFields;
259 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(8), aFields.getLength());
261 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
262 aFields[0]->getFieldType());
263 CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, aFields[0]->getString());
265 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
266 aFields[1]->getFieldType());
267 CPPUNIT_ASSERT_EQUAL(u" : "_ustr, aFields[1]->getString());
269 CPPUNIT_ASSERT_EQUAL(
270 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CATEGORYNAME,
271 aFields[2]->getFieldType());
272 CPPUNIT_ASSERT_EQUAL(u"B"_ustr, aFields[2]->getString());
273 CPPUNIT_ASSERT_EQUAL(u"{0CCAAACD-B393-42CE-8DBD-82F9F9ADC852}"_ustr, aFields[2]->getGuid());
274 aFields[2]->getPropertyValue(u"CharHeight"_ustr) >>= nFontSize;
275 aFields[2]->getPropertyValue(u"CharColor"_ustr) >>= nFontColor;
276 CPPUNIT_ASSERT_EQUAL(static_cast<float>(16), nFontSize);
277 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xed7d31), nFontColor);
279 CPPUNIT_ASSERT_EQUAL(
280 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE,
281 aFields[3]->getFieldType());
283 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
284 aFields[4]->getFieldType());
285 CPPUNIT_ASSERT_EQUAL(u"Multi"_ustr, aFields[4]->getString());
287 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
288 aFields[5]->getFieldType());
289 CPPUNIT_ASSERT_EQUAL(u"line"_ustr, aFields[5]->getString());
290 aFields[5]->getPropertyValue(u"CharHeight"_ustr) >>= nFontSize;
291 aFields[5]->getPropertyValue(u"CharColor"_ustr) >>= nFontColor;
292 CPPUNIT_ASSERT_EQUAL(static_cast<float>(11.97), nFontSize);
293 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xbf9000), nFontColor);
295 CPPUNIT_ASSERT_EQUAL(
296 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE,
297 aFields[6]->getFieldType());
299 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
300 aFields[7]->getFieldType());
301 CPPUNIT_ASSERT_EQUAL(u"Abc"_ustr, aFields[7]->getString());
302 aFields[7]->getPropertyValue(u"CharHeight"_ustr) >>= nFontSize;
303 aFields[7]->getPropertyValue(u"CharColor"_ustr) >>= nFontColor;
304 aFields[7]->getPropertyValue(u"CharUnderline"_ustr) >>= nCharUnderline;
305 CPPUNIT_ASSERT_EQUAL(static_cast<float>(12), nFontSize);
306 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xa9d18e), nFontColor);
307 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nCharUnderline);
309 // 3
310 xPropertySet.set(xDataSeries->getDataPointByIndex(2), uno::UNO_SET_THROW);
311 xPropertySet->getPropertyValue(u"CustomLabelFields"_ustr) >>= aFields;
312 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aFields.getLength());
314 CPPUNIT_ASSERT_EQUAL(
315 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_SERIESNAME,
316 aFields[0]->getFieldType());
317 CPPUNIT_ASSERT_EQUAL(u"DATA"_ustr, aFields[0]->getString());
318 CPPUNIT_ASSERT_EQUAL(u"{C8F3EB90-8960-4F9A-A3AD-B4FAC4FE4566}"_ustr, aFields[0]->getGuid());
320 // 4
321 xPropertySet.set(xDataSeries->getDataPointByIndex(3), uno::UNO_SET_THROW);
322 xPropertySet->getPropertyValue(u"CustomLabelFields"_ustr) >>= aFields;
323 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), aFields.getLength());
325 CPPUNIT_ASSERT_EQUAL(
326 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLREF,
327 aFields[0]->getFieldType());
328 //CPPUNIT_ASSERT_EQUAL(OUString("70"), aFields[0]->getString()); TODO: Not implemented yet
330 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
331 aFields[1]->getFieldType());
332 CPPUNIT_ASSERT_EQUAL(u" <CELLREF"_ustr, aFields[1]->getString());
334 save(u"Impress MS PowerPoint 2007 XML"_ustr);
335 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
336 CPPUNIT_ASSERT(pXmlDoc);
337 // Check the data labels font color for the complete data series
338 assertXPath(pXmlDoc,
339 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/"
340 "a:defRPr/a:solidFill/a:srgbClr",
341 "val", u"404040");
344 /// Test for tdf#94235
345 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testDataSeriesName)
347 // ODF
349 loadFromFile(u"ods/ser_labels.ods");
350 saveAndReload(u"calc8"_ustr);
351 uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
352 uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
353 CPPUNIT_ASSERT(xDataSeries.is());
354 uno::Reference<beans::XPropertySet> xPropertySet;
355 chart2::DataPointLabel aDataPointLabel;
356 xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
357 xPropertySet->getPropertyValue(u"Label"_ustr) >>= aDataPointLabel;
358 CPPUNIT_ASSERT_EQUAL(sal_True, aDataPointLabel.ShowSeriesName);
361 // OOXML
363 loadFromFile(u"xlsx/ser_labels.xlsx");
364 saveAndReload(u"Calc Office Open XML"_ustr);
365 uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
366 uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
367 CPPUNIT_ASSERT(xDataSeries.is());
368 uno::Reference<beans::XPropertySet> xPropertySet;
369 chart2::DataPointLabel aDataPointLabel;
370 xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
371 xPropertySet->getPropertyValue(u"Label"_ustr) >>= aDataPointLabel;
372 CPPUNIT_ASSERT_EQUAL(sal_True, aDataPointLabel.ShowSeriesName);
376 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCustomPositionofDataLabel)
378 // FIXME: validation error in OOXML export: Errors: 1
379 skipValidation();
381 loadFromFile(u"xlsx/testCustomPosDataLabels.xlsx");
383 save(u"Calc Office Open XML"_ustr);
384 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
385 CPPUNIT_ASSERT(pXmlDoc);
387 // test custom position of data label (xlsx)
388 assertXPath(pXmlDoc,
389 "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:idx",
390 "val", u"2");
391 OUString aXVal = getXPath(pXmlDoc,
392 "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/"
393 "c:dLbl[1]/c:layout/c:manualLayout/c:x",
394 "val");
395 double nX = aXVal.toDouble();
396 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.11027682973075476, nX, 1e-7);
398 OUString aYVal = getXPath(pXmlDoc,
399 "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/"
400 "c:dLbl[1]/c:layout/c:manualLayout/c:y",
401 "val");
402 double nY = aYVal.toDouble();
403 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.0742140311063737, nY, 1e-7);
406 loadFromFile(u"docx/testTdf108110.docx");
408 save(u"Office Open XML Text"_ustr);
409 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
410 CPPUNIT_ASSERT(pXmlDoc);
412 // test custom position of data label (docx)
413 assertXPath(pXmlDoc,
414 "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[2]/c:idx",
415 "val", u"2");
416 OUString aXVal = getXPath(pXmlDoc,
417 "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/"
418 "c:dLbl[2]/c:layout/c:manualLayout/c:x",
419 "val");
420 double nX = aXVal.toDouble();
421 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0227256488772236, nX, 1e-7);
423 OUString aYVal = getXPath(pXmlDoc,
424 "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/"
425 "c:dLbl[2]/c:layout/c:manualLayout/c:y",
426 "val");
427 double nY = aYVal.toDouble();
428 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.172648731408574, nY, 1e-7);
431 loadFromFile(u"ods/tdf136024.ods");
433 saveAndReload(u"calc8"_ustr);
434 // tdf#136024: test custom position of pie chart data label after an ods export
435 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
436 CPPUNIT_ASSERT(xChartDoc.is());
438 Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
439 CPPUNIT_ASSERT(xDataSeries.is());
440 uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries->getDataPointByIndex(0),
441 uno::UNO_SET_THROW);
443 chart2::RelativePosition aCustomLabelPosition;
444 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"CustomLabelPosition"_ustr)
445 >>= aCustomLabelPosition);
446 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.0961935120945059, aCustomLabelPosition.Primary, 1e-5);
447 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.209578842093566, aCustomLabelPosition.Secondary, 1e-5);
451 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf161571PiechartCustomPosDataLabels)
453 // FIXME: validation error in OOXML export
454 skipValidation();
456 loadFromFile(u"xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx");
457 save(u"Calc Office Open XML"_ustr);
458 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
459 CPPUNIT_ASSERT(pXmlDoc);
461 // test custom position of data label (xlsx)
462 assertXPath(pXmlDoc,
463 "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/c:dLbl[2]/c:idx",
464 "val", u"1");
465 OUString aXVal = getXPath(pXmlDoc,
466 "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/"
467 "c:dLbl[2]/c:layout/c:manualLayout/c:x",
468 "val");
469 double nX = aXVal.toDouble();
470 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.13500189609404625, nX, 1e-7);
472 OUString aYVal = getXPath(pXmlDoc,
473 "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/"
474 "c:dLbl[2]/c:layout/c:manualLayout/c:y",
475 "val");
476 double nY = aYVal.toDouble();
477 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.15994818221025045, nY, 1e-7);
480 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCustomDataLabelMultipleSeries)
482 loadFromFile(u"pptx/tdf115107-2.pptx");
484 Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
485 CPPUNIT_ASSERT(xChartDoc.is());
487 uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
488 CPPUNIT_ASSERT(xDataSeries.is());
489 float nFontSize;
490 sal_Int64 nFontColor;
491 uno::Reference<beans::XPropertySet> xPropertySet;
492 uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields;
494 // First series
495 xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
496 xPropertySet->getPropertyValue(u"CustomLabelFields"_ustr) >>= aFields;
497 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), aFields.getLength());
499 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_VALUE,
500 aFields[0]->getFieldType());
501 CPPUNIT_ASSERT_EQUAL(u"4.3"_ustr, aFields[0]->getString());
502 aFields[0]->getPropertyValue(u"CharHeight"_ustr) >>= nFontSize;
503 aFields[0]->getPropertyValue(u"CharColor"_ustr) >>= nFontColor;
504 CPPUNIT_ASSERT_EQUAL(static_cast<float>(18), nFontSize);
505 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xc00000), nFontColor);
507 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
508 aFields[1]->getFieldType());
509 CPPUNIT_ASSERT_EQUAL(u" "_ustr, aFields[1]->getString());
511 CPPUNIT_ASSERT_EQUAL(
512 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_SERIESNAME,
513 aFields[2]->getFieldType());
514 CPPUNIT_ASSERT_EQUAL(u"Bars"_ustr, aFields[2]->getString());
516 // Second series
517 xDataSeries = getDataSeriesFromDoc(xChartDoc, 0, 1);
518 CPPUNIT_ASSERT(xDataSeries.is());
520 xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
521 xPropertySet->getPropertyValue(u"CustomLabelFields"_ustr) >>= aFields;
522 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), aFields.getLength());
524 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_VALUE,
525 aFields[0]->getFieldType());
526 CPPUNIT_ASSERT_EQUAL(u"2"_ustr, aFields[0]->getString());
527 aFields[0]->getPropertyValue(u"CharHeight"_ustr) >>= nFontSize;
528 aFields[0]->getPropertyValue(u"CharColor"_ustr) >>= nFontColor;
529 CPPUNIT_ASSERT_EQUAL(static_cast<float>(18), nFontSize);
530 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xffd966), nFontColor);
532 CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT,
533 aFields[1]->getFieldType());
534 CPPUNIT_ASSERT_EQUAL(u" "_ustr, aFields[1]->getString());
536 CPPUNIT_ASSERT_EQUAL(
537 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_SERIESNAME,
538 aFields[2]->getFieldType());
539 CPPUNIT_ASSERT_EQUAL(u"Line"_ustr, aFields[2]->getString());
542 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testLeaderLines)
544 // FIXME: validation error in OOXML export: Errors: 2
545 skipValidation();
547 loadFromFile(u"xlsx/testTdf90749.xlsx");
549 save(u"Calc Office Open XML"_ustr);
550 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
551 CPPUNIT_ASSERT(pXmlDoc);
552 assertXPath(pXmlDoc,
553 "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[1]/c:dLbls/c:extLst/c:ext/"
554 "c15:showLeaderLines",
555 "val", u"1");
556 assertXPath(pXmlDoc,
557 "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[2]/c:dLbls/c:extLst/c:ext/"
558 "c15:showLeaderLines",
559 "val", u"0");
561 loadFromFile(u"docx/MSO_Custom_Leader_Line.docx");
563 save(u"Office Open XML Text"_ustr);
564 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
565 CPPUNIT_ASSERT(pXmlDoc);
566 // tdf#134571: Check the leader line is switch off.
567 assertXPath(pXmlDoc,
568 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:extLst/c:ext/"
569 "c15:showLeaderLines",
570 "val", u"0");
574 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf161607PieChartLeaderLinesColorWidth)
576 // FIXME: validation error in OOXML export
577 skipValidation();
579 loadFromFile(u"xlsx/tdf161607PieChartLeaderLinesColorWidth.xlsx");
580 save(u"Calc Office Open XML"_ustr);
581 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
582 CPPUNIT_ASSERT(pXmlDoc);
584 // test LeaderLines width
585 OUString aWidth = getXPath(
586 pXmlDoc,
587 "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/c:leaderLines/c:spPr/"
588 "a:ln",
589 "w");
590 sal_Int32 nWidth = aWidth.toInt32();
591 CPPUNIT_ASSERT_LESSEQUAL(static_cast<sal_Int32>(100), std::abs(nWidth - 88900));
593 // test LeaderLines Color
594 assertXPath(
595 pXmlDoc,
596 "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart/c:ser/c:dLbls/c:leaderLines/c:spPr/"
597 "a:ln/a:solidFill/a:srgbClr",
598 "val", u"7030a0");
601 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testNumberFormatExportPPTX)
603 loadFromFile(u"pptx/tdf115859.pptx");
604 save(u"Impress MS PowerPoint 2007 XML"_ustr);
605 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
606 CPPUNIT_ASSERT(pXmlDoc);
608 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt",
609 "formatCode", u"#,##0.00,\\K");
610 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt",
611 "sourceLinked", u"0");
614 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testLabelSeparatorExportDOCX)
616 loadFromFile(u"docx/testLabelSeparator.docx");
618 Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
619 CPPUNIT_ASSERT(xChartDoc.is());
621 save(u"Office Open XML Text"_ustr);
622 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
623 CPPUNIT_ASSERT(pXmlDoc);
625 // The text separator should be a new line
626 assertXPathContent(
627 pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls/c:separator", u"\n");
628 // The text separator should be a comma
629 assertXPathContent(
630 pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[2]/c:dLbls/c:separator", u", ");
631 // The text separator should be a semicolon
632 assertXPathContent(
633 pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[3]/c:dLbls/c:separator", u"; ");
636 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testChartTitlePropertiesColorFillPPTX)
638 loadFromFile(u"pptx/testChartTitlePropertiesColorFill.pptx");
639 save(u"Impress MS PowerPoint 2007 XML"_ustr);
640 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
641 CPPUNIT_ASSERT(pXmlDoc);
642 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val",
643 u"ff0000");
644 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
647 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testChartTitlePropertiesGradientFillPPTX)
649 loadFromFile(u"pptx/testChartTitlePropertiesGradientFill.pptx");
650 save(u"Impress MS PowerPoint 2007 XML"_ustr);
651 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
652 CPPUNIT_ASSERT(pXmlDoc);
653 assertXPath(pXmlDoc,
654 "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val",
655 u"f6f8fc");
656 assertXPath(pXmlDoc,
657 "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr", "val",
658 u"c7d5ed");
659 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
662 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testChartTitlePropertiesBitmapFillPPTX)
664 loadFromFile(u"pptx/testChartTitlePropertiesBitmapFill.pptx");
665 save(u"Impress MS PowerPoint 2007 XML"_ustr);
666 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
667 CPPUNIT_ASSERT(pXmlDoc);
668 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:blipFill/a:blip", "embed",
669 u"rId1");
670 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1);
673 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testxAxisLabelsRotation)
675 loadFromFile(u"xlsx/xAxisLabelsRotation.xlsx");
676 save(u"Calc Office Open XML"_ustr);
677 xmlDocUniquePtr pXmlDoc1 = parseExport(u"xl/charts/chart1.xml"_ustr);
678 CPPUNIT_ASSERT(pXmlDoc1);
680 // Chart1 xAxis labels should be 45 degree
681 assertXPath(pXmlDoc1, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:txPr/a:bodyPr", "rot",
682 u"2700000");
685 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testMultipleCategoryAxisLablesXLSX)
687 loadFromFile(u"ods/multilevelcat.ods");
688 save(u"Calc Office Open XML"_ustr);
689 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
690 CPPUNIT_ASSERT(pXmlDoc);
691 // check category axis labels number of first level
692 assertXPath(pXmlDoc,
693 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/"
694 "c:multiLvlStrCache/c:ptCount",
695 "val", u"6");
696 // check category axis labels text of first level
697 assertXPathContent(pXmlDoc,
698 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/"
699 "c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[1]/c:pt[1]/c:v",
700 u"Categoria 1");
701 assertXPathContent(pXmlDoc,
702 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/"
703 "c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[1]/c:pt[6]/c:v",
704 u"Categoria 6");
705 // check category axis labels text of second level
706 assertXPathContent(pXmlDoc,
707 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/"
708 "c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[2]/c:pt[1]/c:v",
709 u"2011");
710 assertXPathContent(pXmlDoc,
711 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/"
712 "c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[2]/c:pt[3]/c:v",
713 u"2013");
714 // check the 'noMultiLvlLbl' tag - ChartExport.cxx:2950 FIXME: seems not support, so check the default noMultiLvlLbl value.
715 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:noMultiLvlLbl", "val", u"0");
718 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testMultipleCategoryAxisLablesDOCX)
720 loadFromFile(u"odt/multilevelcat.odt");
721 save(u"Office Open XML Text"_ustr);
722 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
723 CPPUNIT_ASSERT(pXmlDoc);
724 // check category axis labels number of first level
725 assertXPath(pXmlDoc,
726 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/"
727 "c:multiLvlStrCache/c:ptCount",
728 "val", u"4");
729 // check category axis labels text of first level
730 assertXPathContent(pXmlDoc,
731 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/"
732 "c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[1]/c:pt[1]/c:v",
733 u"Categoria 1");
734 assertXPathContent(pXmlDoc,
735 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/"
736 "c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[1]/c:pt[4]/c:v",
737 u"Categoria 4");
738 // check category axis labels text of second level
739 assertXPathContent(pXmlDoc,
740 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/"
741 "c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[2]/c:pt[1]/c:v",
742 u"2011");
743 assertXPathContent(pXmlDoc,
744 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/"
745 "c:multiLvlStrRef/c:multiLvlStrCache/c:lvl[2]/c:pt[2]/c:v",
746 u"2012");
747 // check the 'noMultiLvlLbl' tag - ChartExport.cxx:2950 FIXME: seems not support, so check the default noMultiLvlLbl value.
748 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:noMultiLvlLbl", "val", u"0");
751 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf116163)
753 loadFromFile(u"pptx/tdf116163.pptx");
754 save(u"Impress MS PowerPoint 2007 XML"_ustr);
755 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
756 CPPUNIT_ASSERT(pXmlDoc);
758 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:txPr/a:bodyPr", "rot",
759 u"-5400000");
762 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf111824)
764 loadFromFile(u"xlsx/tdf111824.xlsx");
765 save(u"Calc Office Open XML"_ustr);
766 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
767 CPPUNIT_ASSERT(pXmlDoc);
769 // Collect 3D barchart Z axID
770 OUString zAxisIdOf3DBarchart
771 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:bar3DChart/c:axId[3]", "val");
772 // 3D barchart Z axis properties should be in a serAx OOXML tag instead of catAx
773 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:serAx/c:axId", "val",
774 zAxisIdOf3DBarchart);
777 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, test3DAreaChartZAxis)
779 loadFromFile(u"xlsx/test3DAreaChartZAxis.xlsx");
780 save(u"Calc Office Open XML"_ustr);
781 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
782 CPPUNIT_ASSERT(pXmlDoc);
784 // Collect 3D area chart Z axID
785 OUString zAxisIdOf3DAreachart
786 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:area3DChart/c:axId[3]", "val");
787 // 3D area chart z-axis properties should be in a serAx OOXML element instead of catAx
788 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:serAx/c:axId", "val",
789 zAxisIdOf3DAreachart);
792 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf119029)
794 loadFromFile(u"odp/tdf119029.odp");
795 // Only use "chart", without number, because the number depends on the previous tests
796 save(u"Impress MS PowerPoint 2007 XML"_ustr);
797 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
798 CPPUNIT_ASSERT(pXmlDoc);
800 assertXPath(pXmlDoc,
801 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:txPr/a:bodyPr", "rot",
802 u"-5400000");
805 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf108022)
807 loadFromFile(u"odt/tdf108022.odt");
808 saveAndReload(u"Office Open XML Text"_ustr);
810 // assert we really have two charts
811 Reference<chart2::XChartDocument> xChartDoc1(getChartDocFromWriter(0), uno::UNO_QUERY);
812 CPPUNIT_ASSERT(xChartDoc1.is());
813 Reference<chart2::XChartDocument> xChartDoc2(getChartDocFromWriter(1), uno::UNO_QUERY);
814 CPPUNIT_ASSERT(xChartDoc2.is());
817 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf121744)
819 loadFromFile(u"docx/tdf121744.docx");
820 save(u"Office Open XML Text"_ustr);
821 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
822 CPPUNIT_ASSERT(pXmlDoc);
824 OUString XValueId
825 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[1]", "val");
826 OUString YValueId
827 = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[2]", "val");
829 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[1]", "val", XValueId);
830 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[2]", "val", YValueId);
833 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf121189)
835 loadFromFile(u"odp/tdf121189.odp");
836 saveAndReload(u"Impress Office Open XML"_ustr);
838 uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY_THROW);
839 uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0),
840 uno::UNO_QUERY_THROW);
841 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xPage->getCount());
842 uno::Reference<drawing::XShape> xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW);
843 CPPUNIT_ASSERT_EQUAL(u"com.sun.star.drawing.OLE2Shape"_ustr, xShape->getShapeType());
846 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf122031)
848 //Checks pie chart data label format.
849 loadFromFile(u"xlsx/tdf122031.xlsx");
851 // FIXME: validation error in OOXML export: Errors: 1
852 skipValidation();
854 save(u"Calc Office Open XML"_ustr);
855 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
856 CPPUNIT_ASSERT(pXmlDoc);
858 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt",
859 "formatCode", u"0.000%");
860 assertXPath(pXmlDoc,
861 "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:numFmt",
862 "formatCode", u"0.000%");
863 assertXPath(pXmlDoc,
864 "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:numFmt",
865 "formatCode", u"0.000%");
866 assertXPath(pXmlDoc,
867 "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[3]/c:numFmt",
868 "formatCode", u"0.000%");
871 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf115012)
873 loadFromFile(u"xlsx/tdf115012.xlsx");
874 save(u"Calc Office Open XML"_ustr);
875 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
876 CPPUNIT_ASSERT(pXmlDoc);
877 // workaround: use-zero instead of leave-gap to show the original line chart
878 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", u"zero");
881 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf134118)
883 loadFromFile(u"xlsx/tdf134118.xlsx");
885 // FIXME: validation error in OOXML export: Errors: 1
886 skipValidation();
888 save(u"Calc Office Open XML"_ustr);
889 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
890 CPPUNIT_ASSERT(pXmlDoc);
891 // workaround: use leave-gap instead of zero to show the original line chart
892 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", u"gap");
895 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf123206_customLabelText)
897 loadFromFile(u"docx/tdf123206.docx");
899 Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
900 CPPUNIT_ASSERT(xChartDoc.is());
902 // FIXME: validation error in OOXML export: Errors: 2
903 skipValidation();
905 save(u"Office Open XML Text"_ustr);
906 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
907 CPPUNIT_ASSERT(pXmlDoc);
909 assertXPathContent(pXmlDoc,
910 "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/"
911 "c:rich/a:p/a:r/a:t",
912 u"kiscica");
915 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCustomLabelText)
917 loadFromFile(u"docx/testCustomlabeltext.docx");
919 Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
920 CPPUNIT_ASSERT(xChartDoc.is());
922 // FIXME: validation error in OOXML export: Errors: 3
923 skipValidation();
925 save(u"Office Open XML Text"_ustr);
926 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
927 CPPUNIT_ASSERT(pXmlDoc);
929 assertXPath(pXmlDoc,
930 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:idx", "val",
931 u"2");
932 assertXPathContent(pXmlDoc,
933 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:tx/"
934 "c:rich/a:p/a:r[1]/a:t",
935 u"3.5");
936 assertXPathContent(pXmlDoc,
937 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:tx/"
938 "c:rich/a:p/a:r[3]/a:t",
939 u"CustomLabel 1");
941 assertXPath(pXmlDoc,
942 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[2]/c:idx", "val",
943 u"3");
944 assertXPathContent(pXmlDoc,
945 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/"
946 "c:rich/a:p/a:r[1]/a:t",
947 u"4.5");
948 assertXPathContent(pXmlDoc,
949 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/"
950 "c:rich/a:p/a:r[3]/a:t",
951 u"CustomLabel 2");
954 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testDeletedLegendEntries)
956 loadFromFile(u"xlsx/deleted_legend_entry.xlsx");
958 saveAndReload(u"Calc Office Open XML"_ustr);
959 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
960 CPPUNIT_ASSERT(xChartDoc.is());
961 Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 1));
962 CPPUNIT_ASSERT(xDataSeries.is());
963 Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
964 bool bShowLegendEntry = true;
965 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"ShowLegendEntry"_ustr)
966 >>= bShowLegendEntry);
967 CPPUNIT_ASSERT(!bShowLegendEntry);
970 loadFromFile(u"xlsx/deleted_legend_entry2.xlsx");
972 saveAndReload(u"Calc Office Open XML"_ustr);
973 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
974 CPPUNIT_ASSERT(xChartDoc.is());
975 Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
976 CPPUNIT_ASSERT(xDataSeries.is());
977 Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
978 bool bShowLegendEntry = true;
979 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"ShowLegendEntry"_ustr)
980 >>= bShowLegendEntry);
981 CPPUNIT_ASSERT(!bShowLegendEntry);
983 Reference<chart2::XChartDocument> xChartDoc2 = getChartDocFromSheet(1);
984 CPPUNIT_ASSERT(xChartDoc.is());
985 Reference<chart2::XDataSeries> xDataSeries2(getDataSeriesFromDoc(xChartDoc2, 0));
986 CPPUNIT_ASSERT(xDataSeries2.is());
987 Reference<beans::XPropertySet> xPropertySet2(xDataSeries2, uno::UNO_QUERY_THROW);
988 Sequence<sal_Int32> deletedLegendEntriesSeq;
989 CPPUNIT_ASSERT(xPropertySet2->getPropertyValue(u"DeletedLegendEntries"_ustr)
990 >>= deletedLegendEntriesSeq);
991 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), deletedLegendEntriesSeq[0]);
995 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf60316)
997 loadFromFile(u"pptx/tdf60316.pptx");
998 save(u"Impress MS PowerPoint 2007 XML"_ustr);
999 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
1000 CPPUNIT_ASSERT(pXmlDoc);
1002 // Without the fix in place, the shape would have had a solidFill background
1003 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:noFill", 1);
1004 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:solidFill", 0);
1007 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf130225)
1009 loadFromFile(u"docx/piechart_deleted_legend_entry.docx");
1010 saveAndReload(u"Office Open XML Text"_ustr);
1011 Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
1012 CPPUNIT_ASSERT(xChartDoc.is());
1013 Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
1014 CPPUNIT_ASSERT(xDataSeries.is());
1015 Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
1016 Sequence<sal_Int32> deletedLegendEntriesSeq;
1017 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"DeletedLegendEntries"_ustr)
1018 >>= deletedLegendEntriesSeq);
1019 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), deletedLegendEntriesSeq[0]);
1022 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf59857)
1024 loadFromFile(u"ods/tdf59857.ods");
1025 save(u"Calc Office Open XML"_ustr);
1026 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1027 CPPUNIT_ASSERT(pXmlDoc);
1029 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:floor/c:spPr/a:ln/a:noFill", 1);
1030 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:floor/c:spPr/a:solidFill/a:srgbClr", "val",
1031 u"cccccc");
1032 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:backWall/c:spPr/a:ln/a:noFill", 0);
1033 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:backWall/c:spPr/a:ln/a:solidFill/a:srgbClr",
1034 "val", u"b3b3b3");
1037 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf126076)
1039 loadFromFile(u"xlsx/auto_marker_excel10.xlsx");
1040 save(u"Calc Office Open XML"_ustr);
1041 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1042 CPPUNIT_ASSERT(pXmlDoc);
1044 // This was 12: all series exported with square markers
1045 assertXPath(
1046 pXmlDoc,
1047 "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:marker/c:symbol[@val='square']", 0);
1048 // instead of skipping markers
1049 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:marker", 0);
1052 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf75330)
1054 loadFromFile(u"ods/legend_overlay.ods");
1055 saveAndReload(u"calc8"_ustr);
1057 uno::Reference<chart2::XChartDocument> xChart2Doc = getChartDocFromSheet(0);
1058 uno::Reference<chart::XChartDocument> xChartDoc(xChart2Doc, uno::UNO_QUERY);
1059 uno::Reference<drawing::XShape> xLegend = xChartDoc->getLegend();
1060 Reference<beans::XPropertySet> xPropertySet(xLegend, uno::UNO_QUERY_THROW);
1061 bool bOverlay = false;
1062 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"Overlay"_ustr) >>= bOverlay);
1063 CPPUNIT_ASSERT(bOverlay);
1065 saveAndReload(u"Calc Office Open XML"_ustr);
1067 uno::Reference<chart2::XChartDocument> xChart2Doc = getChartDocFromSheet(0);
1068 uno::Reference<chart::XChartDocument> xChartDoc(xChart2Doc, uno::UNO_QUERY);
1069 uno::Reference<drawing::XShape> xLegend = xChartDoc->getLegend();
1070 Reference<beans::XPropertySet> xPropertySet(xLegend, uno::UNO_QUERY_THROW);
1071 bool bOverlay = false;
1072 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"Overlay"_ustr) >>= bOverlay);
1073 CPPUNIT_ASSERT(bOverlay);
1077 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf127792)
1079 loadFromFile(u"docx/MSO_axis_position.docx");
1080 save(u"Office Open XML Text"_ustr);
1081 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
1082 CPPUNIT_ASSERT(pXmlDoc);
1083 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val",
1084 u"between");
1086 pXmlDoc = parseExport(u"word/charts/chart2.xml"_ustr);
1087 CPPUNIT_ASSERT(pXmlDoc);
1088 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val",
1089 u"midCat");
1092 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf131979)
1094 loadFromFile(u"ods/tdf131115.ods");
1096 saveAndReload(u"calc8"_ustr);
1097 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
1098 CPPUNIT_ASSERT(xChartDoc.is());
1099 Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
1100 CPPUNIT_ASSERT(xDataSeries.is());
1101 Reference<beans::XPropertySet> xPropertySet;
1102 xPropertySet.set(xDataSeries->getDataPointByIndex(2), uno::UNO_SET_THROW);
1103 bool blinknumberformattosource = true;
1104 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT)
1105 >>= blinknumberformattosource);
1106 CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to false.",
1107 !blinknumberformattosource);
1110 loadFromFile(u"ods/tdf131979.ods");
1112 saveAndReload(u"calc8"_ustr);
1113 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
1114 CPPUNIT_ASSERT(xChartDoc.is());
1115 Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
1116 CPPUNIT_ASSERT(xDataSeries.is());
1117 Reference<beans::XPropertySet> xPropertySet;
1118 xPropertySet.set(xDataSeries->getDataPointByIndex(2), uno::UNO_SET_THROW);
1119 bool blinknumberformattosource = true;
1120 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT)
1121 >>= blinknumberformattosource);
1122 CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.",
1123 blinknumberformattosource);
1127 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf132076)
1129 // FIXME: validation error in OOXML export: Errors: 1
1130 skipValidation();
1133 loadFromFile(u"ods/tdf132076.ods");
1134 save(u"Calc Office Open XML"_ustr);
1135 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1136 CPPUNIT_ASSERT(pXmlDoc);
1137 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:numFmt", "formatCode",
1138 u"dd");
1139 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:numFmt", "sourceLinked",
1140 u"0");
1143 loadFromFile(u"xlsx/tdf132076.xlsx");
1144 save(u"Calc Office Open XML"_ustr);
1145 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1146 CPPUNIT_ASSERT(pXmlDoc);
1147 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:numFmt", "formatCode",
1148 u"dd");
1149 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:numFmt", "sourceLinked",
1150 u"0");
1154 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf125812)
1156 loadFromFile(u"odp/ellipticalGradientFill.odp");
1157 save(u"Impress MS PowerPoint 2007 XML"_ustr);
1158 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
1159 CPPUNIT_ASSERT(pXmlDoc);
1160 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path", "path",
1161 u"circle");
1162 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path/a:fillToRect",
1163 "l", u"50000");
1164 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path/a:fillToRect",
1165 "t", u"49000");
1166 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path/a:fillToRect",
1167 "r", u"50000");
1168 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path/a:fillToRect",
1169 "b", u"51000");
1172 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf133190)
1174 loadFromFile(u"xlsx/tdf133190_tdf133191.xlsx");
1176 // FIXME: validation error in OOXML export: Errors: 1
1177 skipValidation();
1179 save(u"Calc Office Open XML"_ustr);
1180 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1181 CPPUNIT_ASSERT(pXmlDoc);
1183 // Test word wrap of data point label
1184 assertXPath(
1185 pXmlDoc,
1186 "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:bodyPr",
1187 "wrap", u"none");
1188 assertXPath(
1189 pXmlDoc,
1190 "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:txPr/a:bodyPr",
1191 "wrap", u"square");
1194 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf133191)
1196 loadFromFile(u"xlsx/tdf133190_tdf133191.xlsx");
1198 // FIXME: validation error in OOXML export: Errors: 1
1199 skipValidation();
1201 save(u"Calc Office Open XML"_ustr);
1202 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1203 CPPUNIT_ASSERT(pXmlDoc);
1205 // Test rotation of data point label
1206 assertXPath(
1207 pXmlDoc,
1208 "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[3]/c:txPr/a:bodyPr",
1209 "rot", u"-4500000");
1212 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf132594)
1214 loadFromFile(u"xlsx/chart_pie2007.xlsx");
1215 save(u"Calc Office Open XML"_ustr);
1216 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1217 CPPUNIT_ASSERT(pXmlDoc);
1219 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:cat", 1);
1222 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf134255)
1224 loadFromFile(u"docx/tdf134255.docx");
1225 Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
1226 CPPUNIT_ASSERT(xChartDoc.is());
1228 // import test
1229 Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
1230 CPPUNIT_ASSERT(xDataSeries.is());
1231 Reference<beans::XPropertySet> xPropSet(xDataSeries, UNO_QUERY_THROW);
1232 bool bWrap = false;
1233 CPPUNIT_ASSERT((xPropSet->getPropertyValue(u"TextWordWrap"_ustr) >>= bWrap));
1234 CPPUNIT_ASSERT(bWrap);
1236 // FIXME: validation error in OOXML export: Errors: 11
1237 skipValidation();
1239 // export test
1240 save(u"Office Open XML Text"_ustr);
1241 xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr);
1242 CPPUNIT_ASSERT(pXmlDoc);
1244 assertXPath(pXmlDoc,
1245 "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:txPr/a:bodyPr", "wrap",
1246 u"square");
1249 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf134977)
1251 loadFromFile(u"xlsx/custom_data_label.xlsx");
1253 //import test
1254 uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
1255 CPPUNIT_ASSERT(xChartDoc.is());
1256 Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
1257 CPPUNIT_ASSERT(xDataSeries.is());
1258 uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries->getDataPointByIndex(0),
1259 uno::UNO_SET_THROW);
1260 uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields;
1261 float nFontSize;
1262 xPropertySet->getPropertyValue(u"CustomLabelFields"_ustr) >>= aFields;
1263 aFields[0]->getPropertyValue(u"CharHeight"_ustr) >>= nFontSize;
1264 CPPUNIT_ASSERT_EQUAL(static_cast<float>(9), nFontSize);
1266 // FIXME: validation error in OOXML export: Errors: 2
1267 skipValidation();
1269 //export test
1270 save(u"Calc Office Open XML"_ustr);
1271 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1272 CPPUNIT_ASSERT(pXmlDoc);
1273 assertXPath(pXmlDoc,
1274 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:tx/c:rich/a:p/"
1275 "a:r/a:rPr",
1276 "sz", u"900");
1279 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf123647)
1281 loadFromFile(u"xlsx/empty_chart.xlsx");
1282 save(u"Calc Office Open XML"_ustr);
1283 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1284 CPPUNIT_ASSERT(pXmlDoc);
1286 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart", 1);
1289 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf136267)
1291 loadFromFile(u"xlsx/tdf136267.xlsx");
1293 // FIXME: validation error in OOXML export: Errors: 2
1294 skipValidation();
1296 save(u"Calc Office Open XML"_ustr);
1297 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1298 CPPUNIT_ASSERT(pXmlDoc);
1300 assertXPathContent(
1301 pXmlDoc,
1302 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:cat/c:strRef/c:strCache/c:pt/c:v",
1303 u"John");
1306 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testDataLabelPlacementPieChart)
1308 loadFromFile(u"xlsx/tdf134978.xlsx");
1309 saveAndReload(u"calc8"_ustr);
1310 uno::Reference<chart::XChartDocument> xChartDoc(getChartCompFromSheet(0, 0), UNO_QUERY_THROW);
1311 // test the placement of the manually positioned label
1312 Reference<beans::XPropertySet> xDataPointPropSet(
1313 xChartDoc->getDiagram()->getDataPointProperties(2, 0), uno::UNO_SET_THROW);
1314 uno::Any aAny = xDataPointPropSet->getPropertyValue(u"LabelPlacement"_ustr);
1315 CPPUNIT_ASSERT(aAny.hasValue());
1316 sal_Int32 nLabelPlacement = 0;
1317 CPPUNIT_ASSERT(aAny >>= nLabelPlacement);
1318 CPPUNIT_ASSERT_EQUAL(chart::DataLabelPlacement::OUTSIDE, nLabelPlacement);
1321 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf137917)
1323 loadFromFile(u"xlsx/tdf137917.xlsx");
1325 // FIXME: validation error in OOXML export: Errors: 1
1326 skipValidation();
1328 save(u"Calc Office Open XML"_ustr);
1329 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1330 CPPUNIT_ASSERT(pXmlDoc);
1332 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:baseTimeUnit", "val",
1333 u"days");
1334 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:majorUnit", "val", u"1");
1335 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:majorTimeUnit", "val",
1336 u"months");
1337 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:minorUnit", "val", u"7");
1338 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:minorTimeUnit", "val",
1339 u"days");
1342 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf138204)
1344 loadFromFile(u"xlsx/tdf138204.xlsx");
1346 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
1347 CPPUNIT_ASSERT(xChartDoc.is());
1349 struct CustomLabelsTestData
1351 sal_Int32 nSeriesIdx;
1352 sal_Int32 nNumFields;
1353 // First field attributes.
1354 chart2::DataPointCustomLabelFieldType eFieldType;
1355 OUString aCellRange;
1356 OUString aString;
1359 const CustomLabelsTestData aTestEntries[2] = {
1361 // series id of c:ser[1] is 0.
1362 0, // nSeriesIdx
1363 1, // nNumFields
1364 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLRANGE,
1365 u"Munka1!$F$9"_ustr, // aCellRange
1366 u"67,5%"_ustr, // aString
1370 // series id of c:ser[2] is 1.
1371 1, // nSeriesIdx
1372 1, // nNumFields
1373 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLRANGE,
1374 u"Munka1!$G$9"_ustr, // aCellRange
1375 u"32,3%"_ustr, // aString
1379 for (const auto& aTestEntry : aTestEntries)
1381 uno::Reference<chart2::XDataSeries> xDataSeries(
1382 getDataSeriesFromDoc(xChartDoc, aTestEntry.nSeriesIdx));
1383 CPPUNIT_ASSERT(xDataSeries.is());
1385 uno::Reference<beans::XPropertySet> xPropertySet;
1386 uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields;
1387 xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
1388 xPropertySet->getPropertyValue(u"CustomLabelFields"_ustr) >>= aFields;
1389 CPPUNIT_ASSERT_EQUAL(aTestEntry.nNumFields, aFields.getLength());
1391 CPPUNIT_ASSERT_EQUAL(aTestEntry.eFieldType, aFields[0]->getFieldType());
1392 CPPUNIT_ASSERT_EQUAL(aTestEntry.aCellRange, aFields[0]->getCellRange());
1393 CPPUNIT_ASSERT_EQUAL(aTestEntry.aString, aFields[0]->getString());
1396 // FIXME: validation error in OOXML export: Errors: 2
1397 skipValidation();
1399 save(u"Calc Office Open XML"_ustr);
1400 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1401 CPPUNIT_ASSERT(pXmlDoc);
1403 // Check the first data label field type
1404 assertXPath(
1405 pXmlDoc,
1406 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls/c:dLbl/c:tx/c:rich/a:p/a:fld",
1407 "type", u"CELLRANGE");
1409 assertXPath(
1410 pXmlDoc,
1411 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[2]/c:dLbls/c:dLbl/c:tx/c:rich/a:p/a:fld",
1412 "type", u"CELLRANGE");
1415 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf138181)
1417 loadFromFile(u"xlsx/piechart_deleted_legendentry.xlsx");
1418 Reference<chart::XChartDocument> xChartDoc(getChartDocFromSheet(0), UNO_QUERY_THROW);
1419 Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW);
1420 Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
1421 Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), UNO_QUERY_THROW);
1422 Reference<drawing::XShape> xLegendEntry1, xLegendEntry2, xLegendEntry3;
1424 // first legend entry is visible
1425 xLegendEntry1 = getShapeByName(
1426 xShapes, u"CID/MultiClick/D=0:CS=0:CT=0:Series=0:Point=0:LegendEntry=0"_ustr);
1427 CPPUNIT_ASSERT(xLegendEntry1.is());
1429 // second legend entry is not visible
1430 xLegendEntry2 = getShapeByName(
1431 xShapes, u"CID/MultiClick/D=0:CS=0:CT=0:Series=0:Point=1:LegendEntry=0"_ustr);
1432 CPPUNIT_ASSERT(!xLegendEntry2.is());
1434 // third legend entry is visible
1435 xLegendEntry3 = getShapeByName(
1436 xShapes, u"CID/MultiClick/D=0:CS=0:CT=0:Series=0:Point=2:LegendEntry=0"_ustr);
1437 CPPUNIT_ASSERT(xLegendEntry3.is());
1440 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testCustomShapeText)
1442 loadFromFile(u"ods/tdf72776.ods");
1443 saveAndReload(u"calc8"_ustr);
1444 Reference<chart::XChartDocument> xChartDoc(getChartDocFromSheet(0), UNO_QUERY_THROW);
1445 // test that the text of custom shape exists inside the chart
1446 Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW);
1447 Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
1448 Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(1), UNO_QUERY_THROW);
1449 CPPUNIT_ASSERT(xCustomShape.is());
1451 Reference<text::XText> xRange(xCustomShape, uno::UNO_QUERY_THROW);
1452 CPPUNIT_ASSERT(!xRange->getString().isEmpty());
1455 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testuserShapesXLSX)
1457 loadFromFile(u"xlsx/tdf128621.xlsx");
1458 saveAndReload(u"Calc Office Open XML"_ustr);
1460 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
1461 CPPUNIT_ASSERT(xChartDoc.is());
1463 // test that the custom shape exists
1464 Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW);
1465 Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
1466 Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(1), UNO_QUERY_THROW);
1467 CPPUNIT_ASSERT(xCustomShape.is());
1468 // test type of shape
1469 CPPUNIT_ASSERT(xCustomShape->getShapeType().endsWith("CustomShape"));
1470 // test custom shape position
1471 awt::Point aPosition = xCustomShape->getPosition();
1472 CPPUNIT_ASSERT_DOUBLES_EQUAL(1356, aPosition.X, 300);
1473 CPPUNIT_ASSERT_DOUBLES_EQUAL(9107, aPosition.Y, 300);
1474 // test custom shape size
1475 awt::Size aSize = xCustomShape->getSize();
1476 CPPUNIT_ASSERT_DOUBLES_EQUAL(9520, aSize.Width, 300);
1477 CPPUNIT_ASSERT_DOUBLES_EQUAL(1805, aSize.Height, 300);
1478 // test custom shape text
1479 Reference<text::XText> xRange(xCustomShape, uno::UNO_QUERY_THROW);
1480 CPPUNIT_ASSERT(!xRange->getString().isEmpty());
1483 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testuserShapesDOCX)
1485 loadFromFile(u"docx/tdf143130.docx");
1486 saveAndReload(u"Office Open XML Text"_ustr);
1488 Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
1489 CPPUNIT_ASSERT(xChartDoc.is());
1491 // test that the custom shape exists
1492 Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW);
1493 Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
1494 Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(0), UNO_QUERY_THROW);
1495 CPPUNIT_ASSERT(xCustomShape.is());
1496 // test type of shape
1497 CPPUNIT_ASSERT(xCustomShape->getShapeType().endsWith("CustomShape"));
1498 // test custom shape position
1499 awt::Point aPosition = xCustomShape->getPosition();
1500 CPPUNIT_ASSERT_DOUBLES_EQUAL(9824, aPosition.X, 300);
1501 CPPUNIT_ASSERT_DOUBLES_EQUAL(547, aPosition.Y, 300);
1502 // test custom shape size
1503 awt::Size aSize = xCustomShape->getSize();
1504 CPPUNIT_ASSERT_DOUBLES_EQUAL(1848, aSize.Width, 300);
1505 CPPUNIT_ASSERT_DOUBLES_EQUAL(1003, aSize.Height, 300);
1506 // test custom shape text
1507 Reference<text::XText> xRange(xCustomShape, uno::UNO_QUERY_THROW);
1508 CPPUNIT_ASSERT(!xRange->getString().isEmpty());
1511 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testGraphicBlipXLSX)
1513 loadFromFile(u"xlsx/tdf143127.xlsx");
1514 saveAndReload(u"Calc Office Open XML"_ustr);
1516 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
1517 CPPUNIT_ASSERT(xChartDoc.is());
1519 // test that the Graphic shape exists
1520 Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW);
1521 Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
1522 Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(1), UNO_QUERY_THROW);
1523 CPPUNIT_ASSERT(xCustomShape.is());
1524 // test type of shape
1525 CPPUNIT_ASSERT(xCustomShape->getShapeType().endsWith("GraphicObjectShape"));
1526 Reference<XPropertySet> xShapeProps(xCustomShape, UNO_QUERY);
1528 uno::Reference<graphic::XGraphic> xGraphic;
1529 CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"Graphic"_ustr) >>= xGraphic);
1531 Graphic aGraphic(xGraphic);
1532 GfxLink aLink = aGraphic.GetGfxLink();
1533 std::size_t nDataSize = aLink.GetDataSize();
1535 // test the image size is bigger then 0.
1536 CPPUNIT_ASSERT_GREATER(size_t(0), nDataSize);
1539 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testNameRangeXLSX)
1541 loadFromFile(u"xlsx/chart_with_name_range.xlsx");
1542 save(u"Calc Office Open XML"_ustr);
1543 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1544 CPPUNIT_ASSERT(pXmlDoc);
1545 // test the syntax of local range name on the local sheet.
1546 assertXPathContent(pXmlDoc,
1547 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:cat/c:strRef/c:f",
1548 u"Sheet1!local_name_range");
1549 // test the syntax of a global range name.
1550 assertXPathContent(pXmlDoc,
1551 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:val/c:numRef/c:f",
1552 u"[0]!series1");
1555 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testTdf143942)
1557 loadFromFile(u"xlsx/tdf143942.xlsx");
1559 Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
1560 CPPUNIT_ASSERT(xChartDoc.is());
1562 uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
1563 CPPUNIT_ASSERT(xDataSeries.is());
1565 constexpr size_t nLabels = 4;
1566 OUString aCellRange = u"Sheet1!$A$2:$A$5"_ustr;
1567 OUString aLabels[nLabels] = {
1568 u"Test1"_ustr,
1569 u"Test2"_ustr,
1570 u"Tes3"_ustr,
1571 u"Test4"_ustr,
1574 uno::Reference<beans::XPropertySet> xPropertySet;
1575 uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields;
1576 for (size_t i = 0; i < nLabels; ++i)
1578 xPropertySet.set(xDataSeries->getDataPointByIndex(i), uno::UNO_SET_THROW);
1579 xPropertySet->getPropertyValue(u"CustomLabelFields"_ustr) >>= aFields;
1580 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aFields.getLength());
1581 CPPUNIT_ASSERT_EQUAL(
1582 chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLRANGE,
1583 aFields[0]->getFieldType());
1584 CPPUNIT_ASSERT_EQUAL(aCellRange, aFields[0]->getCellRange());
1585 CPPUNIT_ASSERT_EQUAL(aLabels[i], aFields[0]->getString());
1588 // FIXME: validation error in OOXML export: Errors: 4
1589 skipValidation();
1591 save(u"Calc Office Open XML"_ustr);
1592 xmlDocUniquePtr pXmlDoc = parseExport(u"xl/charts/chart1.xml"_ustr);
1593 CPPUNIT_ASSERT(pXmlDoc);
1595 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:extLst/c:ext",
1596 "uri", u"{02D57815-91ED-43cb-92C2-25804820EDAC}");
1597 assertXPath(pXmlDoc,
1598 "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:extLst/c:ext/"
1599 "c15:datalabelsRange/c15:dlblRangeCache/c:ptCount",
1600 "val", u"4");
1601 assertXPathContent(pXmlDoc,
1602 "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:extLst/c:ext/"
1603 "c15:datalabelsRange/c15:f",
1604 aCellRange);
1605 for (size_t i = 0; i < nLabels; ++i)
1607 assertXPath(pXmlDoc,
1608 "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:dLbls/c:dLbl["
1609 + OString::number(i + 1) + "]/c:tx/c:rich/a:p/a:fld",
1610 "type", u"CELLRANGE");
1611 assertXPath(pXmlDoc,
1612 "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:dLbls/c:dLbl["
1613 + OString::number(i + 1) + "]/c:extLst/c:ext/c15:showDataLabelsRange",
1614 "val", u"1");
1615 // Check if the actual label is stored under c15:datalabelsRange
1616 assertXPathContent(pXmlDoc,
1617 "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:extLst/"
1618 "c:ext/c15:datalabelsRange/c15:dlblRangeCache/c:pt["
1619 + OString::number(i + 1) + "]/c:v",
1620 aLabels[i]);
1624 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testDateCategoriesPPTX)
1626 loadFromFile(u"pptx/bnc889755.pptx");
1628 // FIXME: validation error in OOXML export: Errors: 1
1629 skipValidation();
1631 save(u"Impress Office Open XML"_ustr);
1632 xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr);
1633 CPPUNIT_ASSERT(pXmlDoc);
1635 constexpr size_t nCats = 16;
1636 double aDates[nCats] = {
1637 41183, 41214, 41244, 41275, 41306, 41334, 41365, 41395,
1638 41426, 41456, 41487, 41518, 41548, 41579, 41609, 41640,
1641 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat");
1642 assertXPathContent(pXmlDoc,
1643 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:numRef/"
1644 "c:numCache/c:formatCode",
1645 u"mmm\\-yy");
1646 assertXPath(
1647 pXmlDoc,
1648 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:numRef/c:numCache/c:ptCount",
1649 "val", OUString::number(nCats));
1651 for (size_t i = 0; i < nCats; ++i)
1653 assertXPath(
1654 pXmlDoc,
1655 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:numRef/c:numCache/c:pt["
1656 + OString::number(i + 1) + "]",
1657 "idx", OUString::number(i));
1658 assertXPathContent(
1659 pXmlDoc,
1660 "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:numRef/c:numCache/c:pt["
1661 + OString::number(i + 1) + "]/c:v",
1662 OUString::number(aDates[i]));
1666 CPPUNIT_TEST_FIXTURE(Chart2ExportTest2, testDataTableImportExport)
1668 loadFromFile(u"xlsx/ChartDataTable.xlsx");
1670 uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
1671 CPPUNIT_ASSERT(xChartDoc.is());
1672 auto xDiagram = xChartDoc->getFirstDiagram();
1673 CPPUNIT_ASSERT(xDiagram.is());
1674 auto xDataTable = xDiagram->getDataTable();
1675 CPPUNIT_ASSERT(xDataTable.is());
1676 uno::Reference<beans::XPropertySet> xPropertySet(xDataTable, uno::UNO_QUERY);
1677 CPPUNIT_ASSERT(xPropertySet.is());
1678 bool bHBorder;
1679 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"HBorder"_ustr) >>= bHBorder);
1680 CPPUNIT_ASSERT_EQUAL(true, bHBorder);
1681 bool bVBorder;
1682 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"VBorder"_ustr) >>= bVBorder);
1683 CPPUNIT_ASSERT_EQUAL(true, bVBorder);
1684 bool bOutline;
1685 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"Outline"_ustr) >>= bOutline);
1686 CPPUNIT_ASSERT_EQUAL(false, bOutline);
1687 bool bKeys;
1688 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"Keys"_ustr) >>= bKeys);
1689 CPPUNIT_ASSERT_EQUAL(false, bKeys);
1691 saveAndReload(u"calc8"_ustr);
1693 uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
1694 CPPUNIT_ASSERT(xChartDoc.is());
1695 auto xDiagram = xChartDoc->getFirstDiagram();
1696 CPPUNIT_ASSERT(xDiagram.is());
1697 auto xDataTable = xDiagram->getDataTable();
1698 CPPUNIT_ASSERT(xDataTable.is());
1699 uno::Reference<beans::XPropertySet> xPropertySet(xDataTable, uno::UNO_QUERY);
1700 CPPUNIT_ASSERT(xPropertySet.is());
1701 bool bHBorder;
1702 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"HBorder"_ustr) >>= bHBorder);
1703 CPPUNIT_ASSERT_EQUAL(true, bHBorder);
1704 bool bVBorder;
1705 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"VBorder"_ustr) >>= bVBorder);
1706 CPPUNIT_ASSERT_EQUAL(true, bVBorder);
1707 bool bOutline;
1708 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"Outline"_ustr) >>= bOutline);
1709 CPPUNIT_ASSERT_EQUAL(false, bOutline);
1710 bool bKeys;
1711 CPPUNIT_ASSERT(xPropertySet->getPropertyValue(u"Keys"_ustr) >>= bKeys);
1712 CPPUNIT_ASSERT_EQUAL(false, bKeys);
1716 CPPUNIT_PLUGIN_IMPLEMENT();
1718 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */