summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorRohit Deshmukh <rohit.deshmukh@synerzip.com>2013-09-30 16:06:09 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-10-12 01:16:36 +0200
commitf7ff594a9c879ea3ae437e0f7602ef26642e6fc7 (patch)
tree1ac49efe8b1bfa6238f3d858134020b0997a5a5e /oox
parentc196ea4df329ca39ffd1b26282a0f92567cf64d9 (diff)
Fix for Corruption of chart due to Data Lables in Writer, Impress and Calc
Chart file gets corrupted, if we save file in Libreoffice and open in MS office. MS Office gives error, file is Corrupt. Following charts get fixed 1. Radar chart 2. Area chart without data labels 3. Line chart 4. Bubble chart Area chart with data label file gets courrputed after roundtrip in Libreoffice. Change-Id: Ib03ad49aae268b53aa18bdc21c723e2a7777eb45
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx80
1 files changed, 57 insertions, 23 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 7e563053554f..2dc837b1f746 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2275,6 +2275,11 @@ void ChartExport::exportDataLabels(
pFS->startElement( FSNS( XML_c, XML_dLbls ),
FSEND );
+ bool showLegendSymbol = false;
+ bool showNumber = false;
+ bool showCategoryName = false;
+ bool showNumberInPercent = false;
+
sal_Int32 nElem;
for( nElem = 0; nElem < nSeriesLength; ++nElem)
{
@@ -2319,34 +2324,63 @@ void ChartExport::exportDataLabels(
case csscd::AVOID_OVERLAP: aPlacement = "bestFit"; break;
}
- pFS->startElement( FSNS( XML_c, XML_dLbl ), FSEND);
- pFS->singleElement( FSNS( XML_c, XML_idx), XML_val, I32S(nElem), FSEND);
- pFS->singleElement( FSNS( XML_c, XML_dLblPos), XML_val, aPlacement, FSEND);
-
- pFS->singleElement( FSNS( XML_c, XML_showLegendKey), XML_val,
- aLabel.ShowLegendSymbol ? "1" : "0", FSEND);
- pFS->singleElement( FSNS( XML_c, XML_showVal), XML_val,
- aLabel.ShowNumber ? "1" : "0", FSEND);
- pFS->singleElement( FSNS( XML_c, XML_showCatName), XML_val,
- aLabel.ShowCategoryName ? "1" : "0", FSEND);
- // MSO somehow assumes series name to be on (=displayed) by default.
- // Let's put false here and switch it off then, since we have no UI means
- // in LibO to toggle it on anyway
- pFS->singleElement( FSNS( XML_c, XML_showSerName), XML_val, "0", FSEND);
- pFS->singleElement( FSNS( XML_c, XML_showPercent), XML_val,
- aLabel.ShowNumberInPercent ? "1" : "0", FSEND);
-
- if (GetProperty( xPropSet, "LabelSeparator"))
+ if(aLabel.ShowLegendSymbol || aLabel.ShowNumber || aLabel.ShowCategoryName || aLabel.ShowNumberInPercent)
{
- mAny >>= aSep;
- pFS->startElement( FSNS( XML_c, XML_separator), FSEND);
- pFS->writeEscaped(aSep);
- pFS->endElement( FSNS( XML_c, XML_separator) );
+ pFS->startElement( FSNS( XML_c, XML_dLbl ), FSEND);
+ pFS->singleElement( FSNS( XML_c, XML_idx), XML_val, I32S(nElem), FSEND);
+ pFS->singleElement( FSNS( XML_c, XML_dLblPos), XML_val, aPlacement, FSEND);
+
+ pFS->singleElement( FSNS( XML_c, XML_showLegendKey), XML_val, aLabel.ShowLegendSymbol ? "1": "0", FSEND);
+ if (aLabel.ShowLegendSymbol)
+ {
+ showLegendSymbol = true;
+ }
+
+ pFS->singleElement( FSNS( XML_c, XML_showVal), XML_val,aLabel.ShowNumber ? "1": "0", FSEND);
+ if(aLabel.ShowNumber)
+ {
+ showNumber = true;
+ }
+
+ pFS->singleElement( FSNS( XML_c, XML_showCatName), XML_val, aLabel.ShowCategoryName ? "1": "0", FSEND);
+ if(aLabel.ShowCategoryName)
+ {
+ showCategoryName = true;
+ }
+
+ // MSO somehow assumes series name to be on (=displayed) by default.
+ // Let's put false here and switch it off then, since we have no UI means
+ // in LibO to toggle it on anyway
+ pFS->singleElement( FSNS( XML_c, XML_showSerName), XML_val, "0", FSEND);
+
+ pFS->singleElement( FSNS( XML_c, XML_showPercent), XML_val,aLabel.ShowNumberInPercent ? "1": "0", FSEND);
+ if(aLabel.ShowNumberInPercent)
+ {
+ showNumberInPercent = true;
+ }
+
+ if (GetProperty( xPropSet, "LabelSeparator"))
+ {
+ mAny >>= aSep;
+ pFS->startElement( FSNS( XML_c, XML_separator), FSEND);
+ pFS->writeEscaped(aSep);
+ pFS->endElement( FSNS( XML_c, XML_separator) );
+ }
+ pFS->endElement( FSNS( XML_c, XML_dLbl ));
}
- pFS->endElement( FSNS( XML_c, XML_dLbl ));
+
}
}
}
+
+ pFS->singleElement( FSNS( XML_c, XML_showLegendKey), XML_val, showLegendSymbol ? "1": "0", FSEND);
+ pFS->singleElement( FSNS( XML_c, XML_showVal), XML_val, showNumber ? "1": "0", FSEND);
+ pFS->singleElement( FSNS( XML_c, XML_showCatName), XML_val, showCategoryName ? "1": "0", FSEND);
+
+ pFS->singleElement( FSNS( XML_c, XML_showSerName), XML_val, "0", FSEND);
+
+ pFS->singleElement( FSNS( XML_c, XML_showPercent), XML_val, showNumberInPercent ? "1": "0", FSEND);
+
pFS->endElement( FSNS( XML_c, XML_dLbls ) );
}
}