Kaydet (Commit) a05ad6dd authored tarafından Rohit Deshmukh's avatar Rohit Deshmukh Kaydeden (comit) Markus Mohrhard

fdo#74137: Fix for courruption of Pie chart after roundtrip.

Problem:
  - Pie chart with data labels files gets corrupt because of label position is
    bestFit in original file.
  - But after round trip, data labels position gets changes to top, left and right.
    For some data labels postion value is missing.
Implementaion:
  - In LO, while converting data label from model, the position gets changed.
    So we are ignoring this hack for Pie chart.

Conflicts:
	chart2/qa/extras/chart2export.cxx

Change-Id: Ic51845cd6f39bc905439eea8971e878607d25dac
üst a357ef45
...@@ -47,6 +47,7 @@ public: ...@@ -47,6 +47,7 @@ public:
void testFdo74115WallBitmapFill(); void testFdo74115WallBitmapFill();
void testBarChartRotation(); void testBarChartRotation();
void testShapeFollowedByChart(); void testShapeFollowedByChart();
void testPieChartDataLabels();
CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(test); CPPUNIT_TEST(test);
...@@ -66,6 +67,7 @@ public: ...@@ -66,6 +67,7 @@ public:
CPPUNIT_TEST(testFdo74115WallBitmapFill); CPPUNIT_TEST(testFdo74115WallBitmapFill);
CPPUNIT_TEST(testBarChartRotation); CPPUNIT_TEST(testBarChartRotation);
CPPUNIT_TEST(testShapeFollowedByChart); CPPUNIT_TEST(testShapeFollowedByChart);
CPPUNIT_TEST(testPieChartDataLabels);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
protected: protected:
...@@ -598,7 +600,14 @@ void Chart2ExportTest::testShapeFollowedByChart() ...@@ -598,7 +600,14 @@ void Chart2ExportTest::testShapeFollowedByChart()
OUString aValueOfFirstDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:drawing[1]/wp:inline[1]/wp:docPr[1]", "id"); OUString aValueOfFirstDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:drawing[1]/wp:inline[1]/wp:docPr[1]", "id");
OUString aValueOfSecondDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1]", "id"); OUString aValueOfSecondDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:docPr[1]", "id");
CPPUNIT_ASSERT( aValueOfFirstDocPR != aValueOfSecondDocPR ); CPPUNIT_ASSERT( aValueOfFirstDocPR != aValueOfSecondDocPR );
}
void Chart2ExportTest::testPieChartDataLabels()
{
load("/chart2/qa/extras/data/docx/", "PieChartDataLabels.docx");
xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser[1]/c:dLbls/c:dLbl[1]/c:dLblPos", "val", "bestFit");
} }
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
......
...@@ -185,8 +185,9 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat ...@@ -185,8 +185,9 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat
{ {
PropertySet aPropSet( rxDataSeries->getDataPointByIndex( mrModel.mnIndex ) ); PropertySet aPropSet( rxDataSeries->getDataPointByIndex( mrModel.mnIndex ) );
lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false ); lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false );
const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo();
if( mrModel.mxLayout && !mrModel.mxLayout->mbAutoLayout ) bool bIsPie = rTypeInfo.meTypeCategory == TYPECATEGORY_PIE;
if( mrModel.mxLayout && !mrModel.mxLayout->mbAutoLayout && !bIsPie )
{ {
// bnc#694340 - nasty hack - chart2 cannot individually // bnc#694340 - nasty hack - chart2 cannot individually
// place data labels, let's try to find a useful // place data labels, let's try to find a useful
......
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