[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - chart2/qa oox/source
GülÅah Köse (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 22 08:35:51 UTC 2020
chart2/qa/extras/chart2export.cxx | 17 +++++++++
chart2/qa/extras/data/xlsx/data_labels_fill_color.xlsx |binary
oox/source/export/chartexport.cxx | 31 +++++++++++++----
3 files changed, 42 insertions(+), 6 deletions(-)
New commits:
commit 39a479b63abf2917abab8e1e431a9be1fc163b8e
Author: Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Fri Sep 18 13:20:30 2020 +0300
Commit: Gülşah Köse <gulsah.kose at collabora.com>
CommitDate: Tue Sep 22 10:35:16 2020 +0200
tdf#136247 OOXML export data label background color.
Change-Id: Ie3e00e8195239e6570bfe76c2451bae11c209145
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102999
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
(cherry picked from commit a11bb74d4f464e9639ddb5b8d87dc4770663fea8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103045
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index b1441268b31a..449ad70c0cb1 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -101,6 +101,7 @@ public:
void testAxisNumberFormatXLSX();
void testDataPointLabelNumberFormatXLSX();
void testDataLabelDefaultValuesXLSX();
+ void testDataLabelFillColor();
void testTitleOverlayXLSX();
void testInvertIfNegativeXLSX();
void testBubble3DXLSX();
@@ -216,6 +217,7 @@ public:
CPPUNIT_TEST(testAxisNumberFormatXLSX);
CPPUNIT_TEST(testDataPointLabelNumberFormatXLSX);
CPPUNIT_TEST(testDataLabelDefaultValuesXLSX);
+ CPPUNIT_TEST(testDataLabelFillColor);
CPPUNIT_TEST(testTitleOverlayXLSX);
CPPUNIT_TEST(testInvertIfNegativeXLSX);
CPPUNIT_TEST(testBubble3DXLSX);
@@ -1633,6 +1635,21 @@ void Chart2ExportTest::testDataLabelDefaultValuesXLSX()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLblPos", "val", "outEnd");
}
+void Chart2ExportTest::testDataLabelFillColor()
+{
+ load("/chart2/qa/extras/data/xlsx/", "data_labels_fill_color.xlsx");
+ Reference< chart2::XChartDocument> xDoc = getChartDocFromSheet(0, mxComponent);
+ Reference<chart2::XDataSeries> xSeries = getDataSeriesFromDoc(xDoc, 0);
+ Reference<beans::XPropertySet> xPropSet(xSeries, uno::UNO_QUERY_THROW);
+ uno::Any aAny = xPropSet->getPropertyValue("LabelFillColor");
+ sal_Int32 nLabelFillColor;
+ CPPUNIT_ASSERT(aAny >>= nLabelFillColor);
+
+ xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+ CPPUNIT_ASSERT(pXmlDoc);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:spPr/a:solidFill/a:srgbClr", "val", "F79646");
+}
+
void Chart2ExportTest::testTitleOverlayXLSX()
{
load("/chart2/qa/extras/data/xlsx/", "chart_title.xlsx");
diff --git a/chart2/qa/extras/data/xlsx/data_labels_fill_color.xlsx b/chart2/qa/extras/data/xlsx/data_labels_fill_color.xlsx
new file mode 100644
index 000000000000..1a55f5b86836
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/data_labels_fill_color.xlsx differ
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 623a03b8ac97..4c0ef9d202f3 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3189,27 +3189,46 @@ void writeLabelProperties( const FSHelperPtr& pFS, ChartExport* pChartExport,
Sequence<Reference<chart2::XDataPointCustomLabelField>> aCustomLabelFields;
sal_Int32 nLabelBorderWidth = 0;
sal_Int32 nLabelBorderColor = 0x00FFFFFF;
+ sal_Int32 nLabelFillColor = -1;
xPropSet->getPropertyValue("Label") >>= aLabel;
xPropSet->getPropertyValue("CustomLabelFields") >>= aCustomLabelFields;
xPropSet->getPropertyValue("LabelBorderWidth") >>= nLabelBorderWidth;
xPropSet->getPropertyValue("LabelBorderColor") >>= nLabelBorderColor;
+ xPropSet->getPropertyValue("LabelFillColor") >>= nLabelFillColor;
- if (nLabelBorderWidth > 0)
+ if (nLabelBorderWidth > 0 || nLabelFillColor != -1)
{
pFS->startElement(FSNS(XML_c, XML_spPr));
- pFS->startElement(FSNS(XML_a, XML_ln), XML_w,
- OString::number(convertHmmToEmu(nLabelBorderWidth)));
- if (nLabelBorderColor != -1)
+
+ if (nLabelFillColor != -1)
{
pFS->startElement(FSNS(XML_a, XML_solidFill));
- OString aStr = OString::number(nLabelBorderColor, 16).toAsciiUpperCase();
+ OString aStr = OString::number(nLabelFillColor, 16).toAsciiUpperCase();
pFS->singleElement(FSNS(XML_a, XML_srgbClr), XML_val, aStr);
pFS->endElement(FSNS(XML_a, XML_solidFill));
}
- pFS->endElement(FSNS(XML_a, XML_ln));
+
+ if (nLabelBorderWidth > 0)
+ {
+ pFS->startElement(FSNS(XML_a, XML_ln), XML_w,
+ OString::number(convertHmmToEmu(nLabelBorderWidth)));
+
+ if (nLabelBorderColor != -1)
+ {
+ pFS->startElement(FSNS(XML_a, XML_solidFill));
+
+ OString aStr = OString::number(nLabelBorderColor, 16).toAsciiUpperCase();
+ pFS->singleElement(FSNS(XML_a, XML_srgbClr), XML_val, aStr);
+
+ pFS->endElement(FSNS(XML_a, XML_solidFill));
+ }
+
+ pFS->endElement(FSNS(XML_a, XML_ln));
+ }
+
pFS->endElement(FSNS(XML_c, XML_spPr));
}
More information about the Libreoffice-commits
mailing list