diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-03-10 01:01:24 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-03-10 14:57:05 +0100 |
commit | 37b437dcd686de72e6c78703f351a56e23aef073 (patch) | |
tree | 1957730eceee44c55b99a1c9ef0781c0ff237345 /xmloff | |
parent | b595df2012d897f0dce4c203a6231a0d8402b068 (diff) |
support export of property mapping
Change-Id: I9529eedb9c9c002bfc2fee638938082cef59f185
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 42 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 2 |
2 files changed, 44 insertions, 0 deletions
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 ), |