diff options
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmlprop.hxx | 1 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLChartContext.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLChartContext.hxx | 1 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 37 |
4 files changed, 45 insertions, 3 deletions
diff --git a/xmloff/inc/xmlprop.hxx b/xmloff/inc/xmlprop.hxx index 8f47e328ff44..dd48cb11ff63 100644 --- a/xmloff/inc/xmlprop.hxx +++ b/xmloff/inc/xmlprop.hxx @@ -595,6 +595,7 @@ inline constexpr OUString PROP_Speed = u"Speed"_ustr; inline constexpr OUString PROP_SplineOrder = u"SplineOrder"_ustr; inline constexpr OUString PROP_SplineResolution = u"SplineResolution"_ustr; inline constexpr OUString PROP_SplineType = u"SplineType"_ustr; +inline constexpr OUString PROP_SplitPos = u"SplitPos"_ustr; inline constexpr OUString PROP_Stacked = u"Stacked"_ustr; inline constexpr OUString PROP_StackedBarsConnected = u"StackedBarsConnected"_ustr; inline constexpr OUString PROP_StackedText = u"StackedText"_ustr; diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index c79071dac166..a6cd20a3d54f 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -232,7 +232,8 @@ SchXMLChartContext::SchXMLChartContext( SchXMLImportHelper& rImpHelper, mbRowHasLabels( false ), meDataRowSource( chart::ChartDataRowSource_COLUMNS ), mbIsStockChart( false ), - mPieSubType(css::chart2::PieChartSubType_NONE) + mPieSubType(css::chart2::PieChartSubType_NONE), + mfPieSplitPos(2.0) { } @@ -400,6 +401,9 @@ void SchXMLChartContext::startFastElement( sal_Int32 /*nElement*/, mPieSubType = css::chart2::PieChartSubType_PIE; } break; + case XML_ELEMENT(LO_EXT, XML_SPLIT_POSITION): + mfPieSplitPos = aIter.toDouble(); + break; default: XMLOFF_WARN_UNKNOWN("xmloff", aIter); } @@ -748,12 +752,13 @@ void SchXMLChartContext::endFastElement(sal_Int32 ) // cleanup: remove empty chart type groups lcl_removeEmptyChartTypeGroups( xNewDoc ); - // Handle sub-pie type. Is this the right place to do this? + // Handle of-pie paramters. Is this the right place to do this? if (maChartTypeServiceName == "com.sun.star.chart2.PieChartType") { Reference< chart2::XDiagram> xDia(xNewDoc->getFirstDiagram()); uno::Reference< beans::XPropertySet > xDiaProp( xDia, uno::UNO_QUERY ); if( xDiaProp.is()) { xDiaProp->setPropertyValue(u"SubPieType"_ustr, uno::Any(mPieSubType)); + xDiaProp->setPropertyValue(u"SplitPos"_ustr, uno::Any(mfPieSplitPos)); } } diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx index b7f94fa6c986..563ae2ebe8e1 100644 --- a/xmloff/source/chart/SchXMLChartContext.hxx +++ b/xmloff/source/chart/SchXMLChartContext.hxx @@ -101,6 +101,7 @@ private: css::chart::ChartDataRowSource meDataRowSource; bool mbIsStockChart; css::chart2::PieChartSubType mPieSubType; + double mfPieSplitPos; OUString msCategoriesAddress; OUString msChartAddress; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 4e3fa02b7651..f58904997ce6 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -114,7 +114,6 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::std::vector; - namespace { /** @@ -1287,11 +1286,47 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > XML_NAMESPACE_CHART, GetXMLToken(eXMLChartType )) ); } + bool bIsOfPie = false; // Handle subtype for of-pie charts if (sChartType == u"com.sun.star.chart.BarOfPieDiagram") { mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_SUB_BAR, OUString::boolean(true)); + bIsOfPie = true; } else if (sChartType == u"com.sun.star.chart.PieOfPieDiagram") { mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_SUB_PIE, OUString::boolean(true)); + bIsOfPie = true; + } + + if (bIsOfPie) { + + // Find the split position. We have to dig deep into the + // structure tree to get it, which is awkward. Part of the + // problem is that the split position is sort of a series-level + // parameter, but is generally handled at the chart level since + // of-pie charts have only a single series. + double fSplitPos = 2.0; + + Reference< chart2::XCoordinateSystemContainer > xBCooSysCnt( xNewDiagram, uno::UNO_QUERY ); + if (xBCooSysCnt.is()) { + const Sequence< Reference< chart2::XCoordinateSystem > > + aCooSysSeq( xBCooSysCnt->getCoordinateSystems()); + for (const auto& rCooSys : aCooSysSeq ) { + Reference< chart2::XChartTypeContainer > xCTCnt( rCooSys, uno::UNO_QUERY ); + if( ! xCTCnt.is()) + continue; + const Sequence< Reference< chart2::XChartType > > aCTSeq( xCTCnt->getChartTypes()); + for (const auto& rChartType : aCTSeq ) { + Reference< beans::XPropertySet > xCTProp( rChartType, uno::UNO_QUERY ); + + if (xCTProp.is()) { + xCTProp->getPropertyValue(u"SplitPos"_ustr) >>= fSplitPos; + } + } + } + } + + // Insert split position for of-pie chart + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_SPLIT_POSITION, + OUString::number(fSplitPos)); } //column-mapping or row-mapping |