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@googlemail.com>
This commit is contained in:
@@ -57,6 +57,12 @@ void DataSeriesProperties::AddPropertiesToVector(
|
|||||||
| beans::PropertyAttribute::MAYBEVOID
|
| beans::PropertyAttribute::MAYBEVOID
|
||||||
| beans::PropertyAttribute::MAYBEDEFAULT );
|
| 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
|
// add properties of service DataPointProperties
|
||||||
DataPointProperties::AddPropertiesToVector( rOutProperties );
|
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_STACKING_DIRECTION, chart2::StackingDirection_NO_STACKING );
|
||||||
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_VARY_COLORS_BY_POINT, false );
|
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_VARY_COLORS_BY_POINT, false );
|
||||||
PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATASERIES_ATTACHED_AXIS_INDEX, 0 );
|
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
|
// PROP_DATASERIES_ATTRIBUTED_DATA_POINTS has no default
|
||||||
|
|
||||||
|
@@ -36,7 +36,8 @@ namespace DataSeriesProperties
|
|||||||
PROP_DATASERIES_ATTRIBUTED_DATA_POINTS = FAST_PROPERTY_ID_START_DATA_SERIES,
|
PROP_DATASERIES_ATTRIBUTED_DATA_POINTS = FAST_PROPERTY_ID_START_DATA_SERIES,
|
||||||
PROP_DATASERIES_STACKING_DIRECTION,
|
PROP_DATASERIES_STACKING_DIRECTION,
|
||||||
PROP_DATASERIES_VARY_COLORS_BY_POINT,
|
PROP_DATASERIES_VARY_COLORS_BY_POINT,
|
||||||
PROP_DATASERIES_ATTACHED_AXIS_INDEX
|
PROP_DATASERIES_ATTACHED_AXIS_INDEX,
|
||||||
|
PROP_DATASERIES_SHOW_LEGEND_ENTRY
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddPropertiesToVector(
|
void AddPropertiesToVector(
|
||||||
|
@@ -2208,6 +2208,11 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
|
|||||||
if (!pSeries)
|
if (!pSeries)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!pSeries->getPropertiesOfSeries()->getPropertyValue("ShowLegendEntry").get<sal_Bool>())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<ViewLegendEntry> aSeriesEntries(
|
std::vector<ViewLegendEntry> aSeriesEntries(
|
||||||
createLegendEntriesForSeries(
|
createLegendEntriesForSeries(
|
||||||
rEntryKeyAspectRatio, *pSeries, xTextProperties,
|
rEntryKeyAspectRatio, *pSeries, xTextProperties,
|
||||||
|
@@ -173,6 +173,13 @@ service DataSeries
|
|||||||
this series there.</p>
|
this series there.</p>
|
||||||
*/
|
*/
|
||||||
[optional, property] long AttachedAxisIndex;
|
[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
|
} ; // chart2
|
||||||
|
@@ -1778,7 +1778,8 @@ XclImpChSeries::XclImpChSeries( const XclImpChRoot& rRoot, sal_uInt16 nSeriesIdx
|
|||||||
XclImpChRoot( rRoot ),
|
XclImpChRoot( rRoot ),
|
||||||
mnGroupIdx( EXC_CHSERGROUP_NONE ),
|
mnGroupIdx( EXC_CHSERGROUP_NONE ),
|
||||||
mnSeriesIdx( nSeriesIdx ),
|
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:
|
case EXC_ID_CHSERERRORBAR:
|
||||||
ReadChSerErrorBar( rStrm );
|
ReadChSerErrorBar( rStrm );
|
||||||
break;
|
break;
|
||||||
|
case EXC_ID_CHLEGENDEXCEPTION:
|
||||||
|
ReadChLegendException( rStrm );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2054,6 +2058,9 @@ Reference< XDataSeries > XclImpChSeries::CreateDataSeries() const
|
|||||||
if( mxSeriesFmt )
|
if( mxSeriesFmt )
|
||||||
mxSeriesFmt->Convert( aSeriesProp, rTypeInfo );
|
mxSeriesFmt->Convert( aSeriesProp, rTypeInfo );
|
||||||
|
|
||||||
|
if (mbLabelDeleted)
|
||||||
|
aSeriesProp.SetProperty(EXC_CHPROP_SHOWLEGENDENTRY, false);
|
||||||
|
|
||||||
// trend lines
|
// trend lines
|
||||||
ConvertTrendLines( xDataSeries );
|
ConvertTrendLines( xDataSeries );
|
||||||
|
|
||||||
@@ -2185,6 +2192,13 @@ Reference< XPropertySet > XclImpChSeries::CreateErrorBar( sal_uInt8 nPosBarId, s
|
|||||||
return XclImpChSerErrorBar::CreateErrorBar(itrPosBar->second.get(), itrNegBar->second.get());
|
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 ==========================================================
|
// Chart type groups ==========================================================
|
||||||
|
|
||||||
XclImpChType::XclImpChType( const XclImpChRoot& rRoot ) :
|
XclImpChType::XclImpChType( const XclImpChRoot& rRoot ) :
|
||||||
|
@@ -822,6 +822,7 @@ private:
|
|||||||
/** Reads a CHSERERRORBAR record containing error bar settings. */
|
/** Reads a CHSERERRORBAR record containing error bar settings. */
|
||||||
void ReadChSerErrorBar( XclImpStream& rStrm );
|
void ReadChSerErrorBar( XclImpStream& rStrm );
|
||||||
|
|
||||||
|
void ReadChLegendException( XclImpStream& rStrm );
|
||||||
/** Creates a new CHDATAFORMAT group with the specified point index. */
|
/** Creates a new CHDATAFORMAT group with the specified point index. */
|
||||||
XclImpChDataFormatRef CreateDataFormat( sal_uInt16 nPointIdx, sal_uInt16 nFormatIdx );
|
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 mnGroupIdx; /// Chart type group (CHTYPEGROUP group) this series is assigned to.
|
||||||
sal_uInt16 mnSeriesIdx; /// 0-based series index.
|
sal_uInt16 mnSeriesIdx; /// 0-based series index.
|
||||||
sal_uInt16 mnParentIdx; /// 0-based index of parent series (trend lines and error bars).
|
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;
|
typedef std::shared_ptr< XclImpChSeries > XclImpChSeriesRef;
|
||||||
|
@@ -89,6 +89,7 @@ class XclRoot;
|
|||||||
#define EXC_CHPROP_LABELPLACEMENT "LabelPlacement"
|
#define EXC_CHPROP_LABELPLACEMENT "LabelPlacement"
|
||||||
#define EXC_CHPROP_LABELPOSITION "LabelPosition"
|
#define EXC_CHPROP_LABELPOSITION "LabelPosition"
|
||||||
#define EXC_CHPROP_LABELSEPARATOR "LabelSeparator"
|
#define EXC_CHPROP_LABELSEPARATOR "LabelSeparator"
|
||||||
|
#define EXC_CHPROP_SHOWLEGENDENTRY "ShowLegendEntry"
|
||||||
#define EXC_CHPROP_MAJORTICKS "MajorTickmarks"
|
#define EXC_CHPROP_MAJORTICKS "MajorTickmarks"
|
||||||
#define EXC_CHPROP_MARKPOSITION "MarkPosition"
|
#define EXC_CHPROP_MARKPOSITION "MarkPosition"
|
||||||
#define EXC_CHPROP_MINORTICKS "MinorTickmarks"
|
#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_SECONDARY = 1;
|
||||||
const sal_uInt16 EXC_CHAXESSET_NONE = 0xFFFF; /// For internal use.
|
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 ------------------------------------------------------
|
// (0x1044) CHPROPERTIES ------------------------------------------------------
|
||||||
|
|
||||||
const sal_uInt16 EXC_ID_CHPROPERTIES = 0x1044;
|
const sal_uInt16 EXC_ID_CHPROPERTIES = 0x1044;
|
||||||
|
Reference in New Issue
Block a user