Kaydet (Commit) ba37fb02 authored tarafından Miklos Vajna's avatar Miklos Vajna

Ensure we export correct label placement value for clustered bar charts

This is similar to 7b807390 (Ensure we
export correct labal placement value for percent/stacked charts.,
2014-08-07), in case a clustered bar chart has a top placement ("t" in
OOXML), then MSO complains as well.

Change-Id: Iffd991127784e0e732f6ae55de956a328a3a53e5
üst 721f1eca
......@@ -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");
......
......@@ -102,6 +102,7 @@ private:
bool mbIs3DChart;
bool mbStacked;
bool mbPercent;
bool mbClustered;
private:
sal_Int32 getChartType();
......
......@@ -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";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment