fdo#78290 : The File gets corrupted when saved in LO
Problem Description: Docx file containing a chart (line chart / scatter chart)which has used a builtin marker'x' gets corrupted when we save it in LO.The reason was that while exporting LO was writing the marker information 'x' as 'X' which MS Word doesn't recognize.‒<c:marker><c:symbol val="X" />. Also the size of the marker was coming 1 less than the actual value. Ex: if size is 7 then it was being written as 6. Solution: During export I have made changes so that now LO writes 'x' in the tag information ‒<c:marker> <c:symbol val="x" />. Now the size of the marker is also being correctly exported. Change-Id: I26b747f9576625bf3acb941322ae418a0bbc6b64 Reviewed-on: https://gerrit.libreoffice.org/9273 Tested-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
committed by
Markus Mohrhard
parent
23e9f36a21
commit
ee0bb265c9
@@ -57,6 +57,9 @@ public:
|
||||
void testGapWidthXLSX();
|
||||
void testSmoothedLines();
|
||||
void testLabelStringODS();
|
||||
void testfdo78290_Line_Chart_Marker_x();
|
||||
void testfdo78290_Scatter_Chart_Marker_x();
|
||||
void testfdo78290_Combination_Chart_Marker_x();
|
||||
|
||||
CPPUNIT_TEST_SUITE(Chart2ExportTest);
|
||||
CPPUNIT_TEST(test);
|
||||
@@ -86,6 +89,9 @@ public:
|
||||
CPPUNIT_TEST(testGapWidthXLSX);
|
||||
CPPUNIT_TEST(testSmoothedLines);
|
||||
CPPUNIT_TEST(testLabelStringODS);
|
||||
CPPUNIT_TEST(testfdo78290_Line_Chart_Marker_x);
|
||||
CPPUNIT_TEST(testfdo78290_Scatter_Chart_Marker_x);
|
||||
CPPUNIT_TEST(testfdo78290_Combination_Chart_Marker_x);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
protected:
|
||||
@@ -629,6 +635,40 @@ void Chart2ExportTest::testFdo74115WallBitmapFill()
|
||||
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:blipFill");
|
||||
}
|
||||
|
||||
//The below test case tests the built in marker 'x' for Office 2010 in Line charts
|
||||
|
||||
void Chart2ExportTest::testfdo78290_Line_Chart_Marker_x()
|
||||
{
|
||||
load("/chart2/qa/extras/data/docx/", "fdo78290_Line_Chart_Marker_x.docx");
|
||||
xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
|
||||
CPPUNIT_ASSERT(pXmlDoc);
|
||||
assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:symbol[1]","val","x");
|
||||
assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:size[1]","val","7");
|
||||
}
|
||||
|
||||
// We can also use the built in marker 'x' in scatter chart, hence writing the test case for the same.
|
||||
|
||||
void Chart2ExportTest::testfdo78290_Scatter_Chart_Marker_x()
|
||||
{
|
||||
load("/chart2/qa/extras/data/docx/", "fdo78290_Scatter_Chart_Marker_x.docx");
|
||||
xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
|
||||
CPPUNIT_ASSERT(pXmlDoc);
|
||||
assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:scatterChart[1]/c:ser[1]/c:marker[1]/c:symbol[1]","val","x");
|
||||
assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:scatterChart[1]/c:ser[1]/c:marker[1]/c:size[1]","val","7");
|
||||
}
|
||||
|
||||
// Also in a combination of charts like a column chart and line chart, we can use the built in marker 'x'
|
||||
// for the line chart too. hence put a test case for the combination chart also.
|
||||
|
||||
void Chart2ExportTest::testfdo78290_Combination_Chart_Marker_x()
|
||||
{
|
||||
load("/chart2/qa/extras/data/docx/", "fdo78290_Combination_Chart_Marker_x.docx");
|
||||
xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
|
||||
CPPUNIT_ASSERT(pXmlDoc);
|
||||
assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:symbol[1]","val","x");
|
||||
assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:size[1]","val","7");
|
||||
}
|
||||
|
||||
void Chart2ExportTest::testBarChartRotation()
|
||||
{
|
||||
load ("/chart2/qa/extras/data/docx/", "barChartRotation.docx");
|
||||
|
Binary file not shown.
BIN
chart2/qa/extras/data/docx/fdo78290_Line_Chart_Marker_x.docx
Normal file
BIN
chart2/qa/extras/data/docx/fdo78290_Line_Chart_Marker_x.docx
Normal file
Binary file not shown.
BIN
chart2/qa/extras/data/docx/fdo78290_Scatter_Chart_Marker_x.docx
Normal file
BIN
chart2/qa/extras/data/docx/fdo78290_Scatter_Chart_Marker_x.docx
Normal file
Binary file not shown.
@@ -3000,7 +3000,7 @@ void ChartExport::exportMarker(Reference< chart2::XDataSeries > xSeries)
|
||||
pSymbolType = "star";
|
||||
break;
|
||||
case 10:
|
||||
pSymbolType = "X";
|
||||
pSymbolType = "x"; // in MS office 2010 built in symbol marker 'X' is represented as 'x'
|
||||
break;
|
||||
case 11:
|
||||
pSymbolType = "plus";
|
||||
@@ -3023,7 +3023,8 @@ void ChartExport::exportMarker(Reference< chart2::XDataSeries > xSeries)
|
||||
awt::Size aSymbolSize = aSymbol.Size;
|
||||
sal_Int32 nSize = std::max( aSymbolSize.Width, aSymbolSize.Height );
|
||||
|
||||
nSize = nSize/250.0*7.0; // just guessed based on some test cases
|
||||
nSize = nSize/250.0*7.0 + 1; // just guessed based on some test cases,
|
||||
//the value is always 1 less than the actual value.
|
||||
nSize = std::min<sal_Int32>( 72, std::max<sal_Int32>( 2, nSize ) );
|
||||
pFS->singleElement( FSNS( XML_c, XML_size),
|
||||
XML_val, I32S(nSize),
|
||||
|
Reference in New Issue
Block a user