summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorRajashri <rajashri.udhoji@synerzip.com>2013-12-06 16:20:54 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-01-16 14:46:37 +0100
commitc7cfe0876d7ca3d861cc6d8c1f84970f9f71def9 (patch)
tree1ed91a101fff11832875e5e5923c6038ddfc86ac /oox
parentbcf116b7734d5111833189a4ce1cc1d3867fd492 (diff)
fdo#72217 : Fix for corruption area chart with data labels after Round Trip.
For labels under one series, there were child tags created for every data label individually. for example, if under one series there are five labels, then under <dLbls> there were 5 <dLbl> tags created separately. This issue is resolved now. Conflicts: chart2/qa/extras/chart2export.cxx Change-Id: I7ae214f413bc27728df8a3d4cb8f4d703cba2f77
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx73
1 files changed, 51 insertions, 22 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 8bbf222ed5c6..a795aacda9ff 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2410,15 +2410,38 @@ void ChartExport::exportDataLabels(
bool showCategoryName = false;
bool showNumberInPercent = false;
- sal_Int32 nElem;
- for( nElem = 0; nElem < nSeriesLength; ++nElem)
+ sal_Int32 nElem = 0;
+
+
+ uno::Reference< beans::XPropertySet > xPropSet;
+ if(nSeriesLength != 0)
{
- uno::Reference< beans::XPropertySet > xPropSet;
+ try
+ {
+ xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
+ xSeries, nElem, getModel() );
+ }
+ catch( const uno::Exception & rEx )
+ {
+ SAL_WARN("oox", "Exception caught during Export of data label: " << rEx.Message );
+ }
+ }
+ namespace cssc2 = ::com::sun::star::chart2;
+ cssc2::DataPointLabel aTempLabel;
+ if( xPropSet.is() )
+ {
+ if (GetProperty( xPropSet, "Label"))
+ mAny >>= aTempLabel;
+
+
+
+ for( nElem = 1; nElem < nSeriesLength; ++nElem)
+ {
try
{
xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet(
- xSeries, nElem, getModel() );
+ xSeries, nElem, getModel() );
}
catch( const uno::Exception & rEx )
{
@@ -2454,39 +2477,45 @@ void ChartExport::exportDataLabels(
case csscd::AVOID_OVERLAP: aPlacement = "bestFit"; break;
}
- if(aLabel.ShowLegendSymbol || aLabel.ShowNumber || aLabel.ShowCategoryName || aLabel.ShowNumberInPercent)
- {
+ if (aLabel.ShowLegendSymbol)
+ showLegendSymbol = true;
+ if(aLabel.ShowNumber)
+ showNumber = true;
+ if(aLabel.ShowCategoryName)
+ showCategoryName = true;
+ if(aLabel.ShowNumberInPercent)
+ showNumberInPercent = true;
+
+ if(aTempLabel.ShowLegendSymbol != aLabel.ShowLegendSymbol || aTempLabel.ShowNumber!= aLabel.ShowNumber ||
+ aTempLabel.ShowCategoryName != aLabel.ShowCategoryName || aTempLabel.ShowNumberInPercent != aLabel.ShowNumberInPercent)
+ {
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)
+ if(aTempLabel.ShowLegendSymbol != aLabel.ShowLegendSymbol)
{
- showLegendSymbol = true;
+ 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);
- if(aLabel.ShowNumber)
+ if (aTempLabel.ShowNumber!= aLabel.ShowNumber)
{
- showNumber = true;
+ 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);
- if(aLabel.ShowCategoryName)
+
+ if(aTempLabel.ShowCategoryName != aLabel.ShowCategoryName)
{
- showCategoryName = true;
+ 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(aLabel.ShowNumberInPercent)
+ if(aTempLabel.ShowNumberInPercent != aLabel.ShowNumberInPercent)
{
- showNumberInPercent = true;
+ pFS->singleElement( FSNS( XML_c, XML_showPercent), XML_val,aLabel.ShowNumberInPercent ? "1": "0", FSEND);
}
if (GetProperty( xPropSet, "LabelSeparator"))
@@ -2497,9 +2526,8 @@ void ChartExport::exportDataLabels(
pFS->endElement( FSNS( XML_c, XML_separator) );
}
pFS->endElement( FSNS( XML_c, XML_dLbl ));
- }
-
- }
+ }
+ }
}
}
@@ -2513,6 +2541,7 @@ void ChartExport::exportDataLabels(
pFS->endElement( FSNS( XML_c, XML_dLbls ) );
}
+ }
}
void ChartExport::exportDataPoints(