related tdf#51671, store new "hide legend" feature also in ODF
Change-Id: Ibf55f02eccdcadb2d42f5aff8d72bff20ada3b3a Reviewed-on: https://gerrit.libreoffice.org/64792 Tested-by: Jenkins Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
@@ -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,
|
||||
|
@@ -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
|
||||
|
@@ -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.
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
|
@@ -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());
|
||||
|
@@ -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 ),
|
||||
|
@@ -892,6 +892,7 @@ hidden-and-protected
|
||||
hidden-paragraph
|
||||
hidden-text
|
||||
hide
|
||||
hide-legend
|
||||
hide-shape
|
||||
hide-text
|
||||
highlighted-range
|
||||
|
Reference in New Issue
Block a user