diff options
-rw-r--r-- | include/xmloff/xmltoken.hxx | 1 | ||||
-rw-r--r-- | xmloff/inc/SchXMLImport.hxx | 3 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 13 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLImport.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLSeries2Context.cxx | 32 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 1 | ||||
-rw-r--r-- | xmloff/source/token/tokens.txt | 1 |
7 files changed, 40 insertions, 14 deletions
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 815d84c599f9..2d1906016039 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -969,6 +969,7 @@ namespace xmloff { namespace token { XML_HIDDEN_PARAGRAPH, XML_HIDDEN_TEXT, XML_HIDE, + XML_HIDE_LEGEND, XML_HIDE_SHAPE, XML_HIDE_TEXT, XML_HIGHLIGHTED_RANGE, diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx index 5b9db7bdac34..e8ca86cd589a 100644 --- a/xmloff/inc/SchXMLImport.hxx +++ b/xmloff/inc/SchXMLImport.hxx @@ -136,7 +136,8 @@ enum SchXMLSeriesAttrMap XML_TOK_SERIES_LABEL_STRING, XML_TOK_SERIES_ATTACHED_AXIS, XML_TOK_SERIES_STYLE_NAME, - XML_TOK_SERIES_CHART_CLASS + XML_TOK_SERIES_CHART_CLASS, + XML_TOK_SERIES_HIDE_LEGEND }; enum SchXMLRegEquationAttrMap diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index f4185d8692b9..8a8e94265dc1 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -2669,6 +2669,19 @@ void SchXMLExportHelper_Impl::exportSeries( // #i75297# allow empty series, export empty range to have all ranges on import mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, OUString()); + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 ) + { + if (xPropSet.is()) + { + Any aAny = xPropSet->getPropertyValue("ShowLegendEntry"); + if (!aAny.get<bool>()) + { + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_HIDE_LEGEND, OUString::boolean(true)); + } + } + } + if (xLabelSeq.is()) { // Check if the label is direct string value rather than a reference. diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index 57b2a8c73b12..12aa351d8fcb 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -319,10 +319,11 @@ const SvXMLTokenMap& SchXMLImportHelper::GetSeriesAttrTokenMap() { { XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, XML_TOK_SERIES_CELL_RANGE }, { XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS, XML_TOK_SERIES_LABEL_ADDRESS }, - { XML_NAMESPACE_LO_EXT, XML_LABEL_STRING, XML_TOK_SERIES_LABEL_STRING }, + { XML_NAMESPACE_LO_EXT, XML_LABEL_STRING, XML_TOK_SERIES_LABEL_STRING }, { XML_NAMESPACE_CHART, XML_ATTACHED_AXIS, XML_TOK_SERIES_ATTACHED_AXIS }, { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_SERIES_STYLE_NAME }, { XML_NAMESPACE_CHART, XML_CLASS, XML_TOK_SERIES_CHART_CLASS }, + { XML_NAMESPACE_LO_EXT, XML_HIDE_LEGEND, XML_TOK_SERIES_HIDE_LEGEND }, XML_TOKEN_MAP_END }; diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index c1c3c46a4b56..03d00181ff0e 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -297,6 +297,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib bool bHasRange = false; OUString aSeriesLabelRange; OUString aSeriesLabelString; + bool bHideLegend = false; for( sal_Int16 i = 0; i < nAttrCount; i++ ) { @@ -346,6 +347,9 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib maSeriesChartTypeName = aClassName; } break; + case XML_TOK_SERIES_HIDE_LEGEND: + bHideLegend = aValue.toBoolean(); + break; } } @@ -390,21 +394,25 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib SchXMLImportHelper::GetNewDataSeries( mxNewDoc, nCoordinateSystemIndex, maSeriesChartTypeName, ! mrGlobalChartTypeUsedBySeries )); Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( SchXMLTools::GetNewLabeledDataSequence(), uno::UNO_QUERY_THROW ); - if( bIsCandleStick ) + Reference< beans::XPropertySet > xSeriesProp( m_xSeries, uno::UNO_QUERY ); + if (xSeriesProp.is()) { - // set default color for range-line to black (before applying styles) - Reference< beans::XPropertySet > xSeriesProp( m_xSeries, uno::UNO_QUERY ); - if( xSeriesProp.is()) + if (bHideLegend) + xSeriesProp->setPropertyValue("ShowLegendEntry", uno::makeAny(false)); + + if( bIsCandleStick ) + { + // set default color for range-line to black (before applying styles) xSeriesProp->setPropertyValue("Color", - uno::makeAny( sal_Int32( 0x000000 ))); // black - } - else if ( maSeriesChartTypeName == "com.sun.star.chart2.PieChartType" ) - { - //@todo: this property should be saved - Reference< beans::XPropertySet > xSeriesProp( m_xSeries, uno::UNO_QUERY ); - if( xSeriesProp.is()) + uno::makeAny( sal_Int32( 0x000000 ))); // black + } + else if ( maSeriesChartTypeName == "com.sun.star.chart2.PieChartType" ) + { + //@todo: this property should be saved xSeriesProp->setPropertyValue("VaryColorsByPoint", - uno::makeAny( true )); + uno::makeAny( true )); + } + } Reference<chart2::data::XDataProvider> xDataProvider(mxNewDoc->getDataProvider()); diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 8a40bdc11fc9..dc546397523c 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -969,6 +969,7 @@ namespace xmloff { namespace token { TOKEN( "hidden-paragraph", XML_HIDDEN_PARAGRAPH ), TOKEN( "hidden-text", XML_HIDDEN_TEXT ), TOKEN( "hide", XML_HIDE ), + TOKEN( "hide-legend", XML_HIDE_LEGEND ), TOKEN( "hide-shape", XML_HIDE_SHAPE ), TOKEN( "hide-text", XML_HIDE_TEXT ), TOKEN( "highlighted-range", XML_HIGHLIGHTED_RANGE ), diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index c57d2b646ddc..baef6b3a31a1 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -892,6 +892,7 @@ hidden-and-protected hidden-paragraph hidden-text hide +hide-legend hide-shape hide-text highlighted-range |