diff options
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 15 | ||||
-rw-r--r-- | chart2/qa/extras/data/docx/fdo83058_dlblPos.docx | bin | 0 -> 35931 bytes | |||
-rw-r--r-- | include/oox/export/chartexport.hxx | 1 | ||||
-rw-r--r-- | oox/source/export/chartexport.cxx | 19 |
4 files changed, 28 insertions, 7 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index fc2930537494..66f5b90a9bfc 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -79,6 +79,7 @@ public: void testDataLabelDoughnutChartDOCX(); void testDataLabelAreaChartDOCX(); void testDataLabelDefaultLineChartDOCX(); + void testFdo83058dlblPos(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(test); @@ -123,6 +124,7 @@ public: CPPUNIT_TEST(testDataLabelDoughnutChartDOCX); CPPUNIT_TEST(testDataLabelAreaChartDOCX); CPPUNIT_TEST(testDataLabelDefaultLineChartDOCX); + CPPUNIT_TEST(testFdo83058dlblPos); CPPUNIT_TEST_SUITE_END(); protected: @@ -867,7 +869,7 @@ void Chart2ExportTest::testDataLabelClusteredBarChartDOCX() 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"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls/c:dLbl[2]/c:dLblPos", "val", "outEnd"); } void Chart2ExportTest::testDataLabelRadarChartDOCX() @@ -1186,6 +1188,17 @@ void Chart2ExportTest::testLabelStringODS() CPPUNIT_ASSERT_EQUAL(OUString("\"LabelName\""), aLabelString); } +void Chart2ExportTest::testFdo83058dlblPos() +{ + load ("/chart2/qa/extras/data/docx/", "fdo83058_dlblPos.docx"); + xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + CPPUNIT_ASSERT(pXmlDoc); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls[1]/c:dLbl[2]/c:dLblPos", "val", "outEnd"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls[1]/c:dLbl[3]/c:dLblPos", "val", "outEnd"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls[1]/c:dLbl[4]/c:dLblPos", "val", "outEnd"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls[1]/c:dLbl[5]/c:dLblPos", "val", "outEnd"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/docx/fdo83058_dlblPos.docx b/chart2/qa/extras/data/docx/fdo83058_dlblPos.docx Binary files differnew file mode 100644 index 000000000000..721a717897b3 --- /dev/null +++ b/chart2/qa/extras/data/docx/fdo83058_dlblPos.docx diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx index 3d5604753c1c..b76811df6376 100644 --- a/include/oox/export/chartexport.hxx +++ b/include/oox/export/chartexport.hxx @@ -99,7 +99,6 @@ 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 727d3072fea9..743715224287 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -446,7 +446,6 @@ ChartExport::ChartExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, Reference< f , mbIs3DChart( false ) , mbStacked(false) , mbPercent(false) - , mbClustered(false) { } @@ -2656,13 +2655,15 @@ void ChartExport::exportDataLabels( aParam.mbExport = !mbIs3DChart; aParam.meDefault = rInfo.mnDefLabelPos; aParam.allowAll(); - switch (getChartType()) // diagram chart type + switch (eChartType) // diagram chart type { case chart::TYPEID_PIE: + if(getChartType() == chart::TYPEID_DOUGHNUT) + aParam.mbExport = false; + else // All pie charts support label placement. aParam.mbExport = true; break; - case chart::TYPEID_DOUGHNUT: case chart::TYPEID_AREA: case chart::TYPEID_RADARLINE: case chart::TYPEID_RADARAREA: @@ -2670,7 +2671,7 @@ void ChartExport::exportDataLabels( aParam.mbExport = false; break; case chart::TYPEID_BAR: - if (mbStacked || mbPercent || mbClustered) + if (mbStacked || mbPercent) { aParam.maAllowedValues.clear(); aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::CENTER); @@ -2678,6 +2679,15 @@ void ChartExport::exportDataLabels( aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::NEAR_ORIGIN); aParam.meDefault = css::chart::DataLabelPlacement::CENTER; } + else // Clustered bar chart + { + aParam.maAllowedValues.clear(); + aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::CENTER); + aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::INSIDE); + aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::OUTSIDE); + aParam.maAllowedValues.insert(css::chart::DataLabelPlacement::NEAR_ORIGIN); + aParam.meDefault = css::chart::DataLabelPlacement::OUTSIDE; + } break; default: ; @@ -2818,7 +2828,6 @@ void ChartExport::exportGrouping( bool isBar ) if( isBar && !isDeep3dChart() ) { grouping = "clustered"; - mbClustered = true; } else grouping = "standard"; |