[Libreoffice-commits] core.git: chart2/source offapi/com sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Dec 5 14:43:52 UTC 2018
chart2/source/model/main/DataSeriesProperties.cxx | 7 +++++++
chart2/source/model/main/DataSeriesProperties.hxx | 3 ++-
chart2/source/view/charttypes/VSeriesPlotter.cxx | 5 +++++
offapi/com/sun/star/chart2/DataSeries.idl | 7 +++++++
sc/source/filter/excel/xichart.cxx | 16 +++++++++++++++-
sc/source/filter/inc/xichart.hxx | 2 ++
sc/source/filter/inc/xlchart.hxx | 8 ++++++++
7 files changed, 46 insertions(+), 2 deletions(-)
New commits:
commit c32a4c2fac32b766a05473d037d73cbcd972dadd
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Wed Dec 5 03:45:17 2018 +0100
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Wed Dec 5 15:43:28 2018 +0100
tdf#51671, implement feature to disable legend entry for series
No UI and no ODF or OOXML support yet.
Change-Id: I839c195e9c42f074838ff6592331f7cdd13b6cd2
Reviewed-on: https://gerrit.libreoffice.org/64583
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/chart2/source/model/main/DataSeriesProperties.cxx b/chart2/source/model/main/DataSeriesProperties.cxx
index 6c7e38d7e038..375e6c441c2a 100644
--- a/chart2/source/model/main/DataSeriesProperties.cxx
+++ b/chart2/source/model/main/DataSeriesProperties.cxx
@@ -57,6 +57,12 @@ void DataSeriesProperties::AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID
| beans::PropertyAttribute::MAYBEDEFAULT );
+ rOutProperties.emplace_back( "ShowLegendEntry",
+ PROP_DATASERIES_SHOW_LEGEND_ENTRY,
+ cppu::UnoType<sal_Bool>::get(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT );
+
// add properties of service DataPointProperties
DataPointProperties::AddPropertiesToVector( rOutProperties );
}
@@ -67,6 +73,7 @@ void DataSeriesProperties::AddDefaultsToMap(
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_STACKING_DIRECTION, chart2::StackingDirection_NO_STACKING );
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_VARY_COLORS_BY_POINT, false );
PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATASERIES_ATTACHED_AXIS_INDEX, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_SHOW_LEGEND_ENTRY, true );
// PROP_DATASERIES_ATTRIBUTED_DATA_POINTS has no default
diff --git a/chart2/source/model/main/DataSeriesProperties.hxx b/chart2/source/model/main/DataSeriesProperties.hxx
index e27b9acd44f2..6791078d5678 100644
--- a/chart2/source/model/main/DataSeriesProperties.hxx
+++ b/chart2/source/model/main/DataSeriesProperties.hxx
@@ -36,7 +36,8 @@ namespace DataSeriesProperties
PROP_DATASERIES_ATTRIBUTED_DATA_POINTS = FAST_PROPERTY_ID_START_DATA_SERIES,
PROP_DATASERIES_STACKING_DIRECTION,
PROP_DATASERIES_VARY_COLORS_BY_POINT,
- PROP_DATASERIES_ATTACHED_AXIS_INDEX
+ PROP_DATASERIES_ATTACHED_AXIS_INDEX,
+ PROP_DATASERIES_SHOW_LEGEND_ENTRY
};
void AddPropertiesToVector(
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index ff09606cda5c..ee76f7351d93 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2208,6 +2208,11 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
if (!pSeries)
continue;
+ if (!pSeries->getPropertiesOfSeries()->getPropertyValue("ShowLegendEntry").get<sal_Bool>())
+ {
+ continue;
+ }
+
std::vector<ViewLegendEntry> aSeriesEntries(
createLegendEntriesForSeries(
rEntryKeyAspectRatio, *pSeries, xTextProperties,
diff --git a/offapi/com/sun/star/chart2/DataSeries.idl b/offapi/com/sun/star/chart2/DataSeries.idl
index 0d43ee6adf56..357ec4fcd097 100644
--- a/offapi/com/sun/star/chart2/DataSeries.idl
+++ b/offapi/com/sun/star/chart2/DataSeries.idl
@@ -173,6 +173,13 @@ service DataSeries
this series there.</p>
*/
[optional, property] long AttachedAxisIndex;
+
+ /** This property describes whether the legend entry for the
+ the data series should be shown.
+
+ @since LibreOffice 6.3
+ */
+ [optional, property] boolean ShowLegendEntry;
};
} ; // chart2
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 6ff977f9d7a6..b8d32f81a4d7 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -1778,7 +1778,8 @@ XclImpChSeries::XclImpChSeries( const XclImpChRoot& rRoot, sal_uInt16 nSeriesIdx
XclImpChRoot( rRoot ),
mnGroupIdx( EXC_CHSERGROUP_NONE ),
mnSeriesIdx( nSeriesIdx ),
- mnParentIdx( EXC_CHSERIES_INVALID )
+ mnParentIdx( EXC_CHSERIES_INVALID ),
+ mbLabelDeleted( false )
{
}
@@ -1817,6 +1818,9 @@ void XclImpChSeries::ReadSubRecord( XclImpStream& rStrm )
case EXC_ID_CHSERERRORBAR:
ReadChSerErrorBar( rStrm );
break;
+ case EXC_ID_CHLEGENDEXCEPTION:
+ ReadChLegendException( rStrm );
+ break;
}
}
@@ -2054,6 +2058,9 @@ Reference< XDataSeries > XclImpChSeries::CreateDataSeries() const
if( mxSeriesFmt )
mxSeriesFmt->Convert( aSeriesProp, rTypeInfo );
+ if (mbLabelDeleted)
+ aSeriesProp.SetProperty(EXC_CHPROP_SHOWLEGENDENTRY, false);
+
// trend lines
ConvertTrendLines( xDataSeries );
@@ -2185,6 +2192,13 @@ Reference< XPropertySet > XclImpChSeries::CreateErrorBar( sal_uInt8 nPosBarId, s
return XclImpChSerErrorBar::CreateErrorBar(itrPosBar->second.get(), itrNegBar->second.get());
}
+void XclImpChSeries::ReadChLegendException(XclImpStream& rStrm)
+{
+ rStrm.Ignore(2);
+ sal_uInt16 nFlags = rStrm.ReaduInt16();
+ mbLabelDeleted = (nFlags & EXC_CHLEGENDEXCEPTION_DELETED);
+}
+
// Chart type groups ==========================================================
XclImpChType::XclImpChType( const XclImpChRoot& rRoot ) :
diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx
index ec033e5b4d3e..5a686ca4e7e9 100644
--- a/sc/source/filter/inc/xichart.hxx
+++ b/sc/source/filter/inc/xichart.hxx
@@ -822,6 +822,7 @@ private:
/** Reads a CHSERERRORBAR record containing error bar settings. */
void ReadChSerErrorBar( XclImpStream& rStrm );
+ void ReadChLegendException( XclImpStream& rStrm );
/** Creates a new CHDATAFORMAT group with the specified point index. */
XclImpChDataFormatRef CreateDataFormat( sal_uInt16 nPointIdx, sal_uInt16 nFormatIdx );
@@ -849,6 +850,7 @@ private:
sal_uInt16 mnGroupIdx; /// Chart type group (CHTYPEGROUP group) this series is assigned to.
sal_uInt16 mnSeriesIdx; /// 0-based series index.
sal_uInt16 mnParentIdx; /// 0-based index of parent series (trend lines and error bars).
+ bool mbLabelDeleted; /// Legend label deleted
};
typedef std::shared_ptr< XclImpChSeries > XclImpChSeriesRef;
diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx
index e14979461f4d..8ba2219b96fe 100644
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -89,6 +89,7 @@ class XclRoot;
#define EXC_CHPROP_LABELPLACEMENT "LabelPlacement"
#define EXC_CHPROP_LABELPOSITION "LabelPosition"
#define EXC_CHPROP_LABELSEPARATOR "LabelSeparator"
+#define EXC_CHPROP_SHOWLEGENDENTRY "ShowLegendEntry"
#define EXC_CHPROP_MAJORTICKS "MajorTickmarks"
#define EXC_CHPROP_MARKPOSITION "MarkPosition"
#define EXC_CHPROP_MINORTICKS "MinorTickmarks"
@@ -583,6 +584,13 @@ const sal_uInt16 EXC_CHAXESSET_PRIMARY = 0;
const sal_uInt16 EXC_CHAXESSET_SECONDARY = 1;
const sal_uInt16 EXC_CHAXESSET_NONE = 0xFFFF; /// For internal use.
+// (0x1043) LEGENDEXCEPTION
+
+const sal_uInt16 EXC_ID_CHLEGENDEXCEPTION = 0x1043;
+
+const sal_uInt16 EXC_CHLEGENDEXCEPTION_DELETED = 0x0001;
+const sal_uInt16 EXC_CHLEGENDEXCEPTION_LABEL = 0x0002;
+
// (0x1044) CHPROPERTIES ------------------------------------------------------
const sal_uInt16 EXC_ID_CHPROPERTIES = 0x1044;
More information about the Libreoffice-commits
mailing list