diff options
-rw-r--r-- | include/xmloff/xmltoken.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 42 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 2 |
3 files changed, 46 insertions, 0 deletions
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 39a6dc9e6422..83d766dac944 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -3212,6 +3212,8 @@ namespace xmloff { namespace token { XML_MARGIN, // #i117001# + XML_PROPERTY_MAPPING, + // regina, ODF1.2 additional symbols in charts XML_STAR, XML_ASTERISK, diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index fd0b08c65998..6c369acc9683 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -207,6 +207,11 @@ public: const ::com::sun::star::awt::Size & rPageSize, sal_Bool bExportContent, sal_Bool bHasTwoYAxes ); + + void exportPropertyMapping( + const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataSource > & xSource, + Sequence< OUString >& rSupportedMappings ); + void exportCandleStickSeries( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< @@ -2874,6 +2879,13 @@ void SchXMLExportHelper_Impl::exportSeries( uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ), nSeriesLength, xNewDiagram, bExportContent ); + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( bExportContent && nCurrentODFVersion > SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older + { + Sequence< OUString > aSupportedMappings = aCTSeq[nCTIdx]->getSupportedPropertyRoles(); + exportPropertyMapping( xSource, aSupportedMappings ); + } + // close series element delete pSeries; } @@ -2883,6 +2895,36 @@ void SchXMLExportHelper_Impl::exportSeries( } } +void SchXMLExportHelper_Impl::exportPropertyMapping( + const Reference< chart2::data::XDataSource > & xSource, Sequence< OUString >& rSupportedMappings ) +{ + Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY ); + Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt( + xSource->getDataSequences()); + + for(sal_Int32 i = 0, n = rSupportedMappings.getLength(); i < n; ++i) + { + Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, rSupportedMappings[i] ) ); + if(xSequence.is()) + { + Reference< chart2::data::XDataSequence > xValues( xSequence->getValues() ); + if( xValues.is()) + { + mrExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_PROPERTY, rSupportedMappings[i]); + mrExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_CELL_RANGE_ADDRESS, + lcl_ConvertRange( + xValues->getSourceRangeRepresentation(), + xNewDoc )); + SvXMLElementExport( mrExport, XML_NAMESPACE_LO_EXT, XML_PROPERTY_MAPPING, sal_True, sal_True ); + + // register range for data table export + m_aDataSequencesToExport.push_back( tLabelValuesDataPair( + (uno::Reference< chart2::data::XDataSequence >)0, xValues )); + } + } + } +} + void SchXMLExportHelper_Impl::exportRegressionCurve( const Reference< chart2::XDataSeries >& xSeries, const awt::Size& rPageSize, diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 56148dc5d094..47c871a19ef4 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3212,6 +3212,8 @@ namespace xmloff { namespace token { TOKEN( "margin", XML_MARGIN), + TOKEN( "propertry-mapping", XML_PROPERTY_MAPPING), + // regina, ODF1.2 additional symbols in charts TOKEN( "star", XML_STAR ), TOKEN( "asterisk", XML_ASTERISK ), |