diff options
author | PriyankaGaikwad <priyanka.gaikwad@synerzip.com> | 2014-08-27 19:28:44 +0530 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2015-01-03 00:53:47 +0000 |
commit | a7052b906dfd1d749f7da9ea64a3479d7c1cc2c9 (patch) | |
tree | 2aa4b932432043a1aaab81de694af1bc35bb3468 /oox | |
parent | 31e82d9f6f07335a2526bd44956eebfcaf0a289d (diff) |
fdo#83058 File corrupt due to data label position is invalid in chart.xml
- File getting corrupted after RT due to data label position is invalid in chart.xml
- LO must not export invalid label position property if chart type doesn't support that positioning in MS Office.
- For clusterd bar chart XML Difference
chart1.xml
Original file
<c:barChart>
<c:grouping val="clustered" />
<c:ser>
<c:dLbls>
...
<c:dLbl>
<c:dLblPos val="outEnd" />
</c:dLbl>
...
</c:dLbls>
</c:ser>
</c:barChart>
Roundtrip file
<c:barChart>
<c:grouping val="clustered" />
<c:ser>
<c:dLbls>
...
<c:dLbl>
<c:dLblPos val="r" />
</c:dLbl>
...
</c:dLbls>
</c:ser>
</c:barChart>
Change-Id: I9cae11b8d198aaa70fb05cb3bf329cd898519170
Reviewed-on: https://gerrit.libreoffice.org/11141
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Tested-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/chartexport.cxx | 19 |
1 files changed, 14 insertions, 5 deletions
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"; |