summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/qa/extras/chart2export.cxx16
-rw-r--r--chart2/qa/extras/data/docx/clustered-bar-chart-labels.docxbin0 -> 22977 bytes
-rw-r--r--include/oox/export/chartexport.hxx1
-rw-r--r--oox/source/export/chartexport.cxx6
4 files changed, 22 insertions, 1 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 280d2fc88e5b..38bd92fb3df8 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -72,6 +72,7 @@ public:
void testDataLabelBordersDOCX();
void testDataLabel3DChartDOCX();
void testDataLabelBarChartDOCX();
+ void testDataLabelClusteredBarChartDOCX();
void testDataLabelRadarChartDOCX();
void testDataLabelDoughnutChartDOCX();
void testDataLabelAreaChartDOCX();
@@ -113,6 +114,7 @@ public:
CPPUNIT_TEST(testDataLabelBordersDOCX);
CPPUNIT_TEST(testDataLabel3DChartDOCX);
CPPUNIT_TEST(testDataLabelBarChartDOCX);
+ CPPUNIT_TEST(testDataLabelClusteredBarChartDOCX);
CPPUNIT_TEST(testDataLabelRadarChartDOCX);
CPPUNIT_TEST(testDataLabelDoughnutChartDOCX);
CPPUNIT_TEST(testDataLabelAreaChartDOCX);
@@ -845,6 +847,20 @@ void Chart2ExportTest::testDataLabelBarChartDOCX()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[3]/c:dLbls/c:dLblPos", "val", "inBase");
}
+void Chart2ExportTest::testDataLabelClusteredBarChartDOCX()
+{
+ load("/chart2/qa/extras/data/docx/", "clustered-bar-chart-labels.docx");
+
+ Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text");
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // This was "t", should be one of the allowed values.
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls/c:dLbl[2]/c:dLblPos", "val", "ctr");
+}
+
void Chart2ExportTest::testDataLabelRadarChartDOCX()
{
load("/chart2/qa/extras/data/docx/", "radar-chart-labels.docx");
diff --git a/chart2/qa/extras/data/docx/clustered-bar-chart-labels.docx b/chart2/qa/extras/data/docx/clustered-bar-chart-labels.docx
new file mode 100644
index 000000000000..3b9941cc1ef2
--- /dev/null
+++ b/chart2/qa/extras/data/docx/clustered-bar-chart-labels.docx
Binary files differ
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index 8f86aa9d6824..02ee8f19bba4 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -102,6 +102,7 @@ private:
bool mbIs3DChart;
bool mbStacked;
bool mbPercent;
+ bool mbClustered;
private:
sal_Int32 getChartType();
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 8fe0a8736e42..46290053755c 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -446,6 +446,7 @@ ChartExport::ChartExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, Reference< f
, mbIs3DChart( false )
, mbStacked(false)
, mbPercent(false)
+ , mbClustered(false)
{
}
@@ -2670,7 +2671,7 @@ void ChartExport::exportDataLabels(
aParam.mbExport = false;
break;
case chart::TYPEID_BAR:
- if (mbStacked || mbPercent)
+ if (mbStacked || mbPercent || mbClustered)
{
aParam.maAllowedValues.clear();
aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::CENTER);
@@ -2816,7 +2817,10 @@ void ChartExport::exportGrouping( bool isBar )
else
{
if( isBar && !isDeep3dChart() )
+ {
grouping = "clustered";
+ mbClustered = true;
+ }
else
grouping = "standard";
}