summaryrefslogtreecommitdiff
path: root/oox/source/drawingml
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-08-04 13:21:24 +0530
committerDennis Francis <dennis.francis@collabora.co.uk>2017-08-08 08:31:22 +0200
commit70944a849dc59fa686e3f316a3983dbc8a47017f (patch)
tree9a803d30955593bcd0bf8c1e7c141f1f8e058f5d /oox/source/drawingml
parenta209172669e7a2de6065486e385e4e3007b74bd2 (diff)
tdf#109858: Override default point label placement setting...
with series label placement setting if available while importing xlsx chart. Adds unit test in chart2import.cxx that asserts one of the point label setting in the bugzilla xlsx document. Change-Id: I8bc04fd569f94a19633666ffdc51b61ac719e8a9 Reviewed-on: https://gerrit.libreoffice.org/40860 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Dennis Francis <dennis.francis@collabora.co.uk>
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r--oox/source/drawingml/chart/seriesconverter.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 7233d67f009b..a1f2cb737c7f 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -99,7 +99,8 @@ Reference< XLabeledDataSequence > lclCreateLabeledDataSequence(
}
void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatter,
- const DataLabelModelBase& rDataLabel, const TypeGroupConverter& rTypeGroup, bool bDataSeriesLabel, bool bMSO2007Doc )
+ const DataLabelModelBase& rDataLabel, const TypeGroupConverter& rTypeGroup,
+ bool bDataSeriesLabel, bool bMSO2007Doc, const PropertySet* pSeriesPropSet )
{
const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo();
@@ -170,6 +171,12 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt
case XML_r: nPlacement = csscd::RIGHT; break;
case XML_bestFit: nPlacement = csscd::AVOID_OVERLAP; break;
}
+
+ sal_Int32 nGlobalPlacement = 0;
+ if ( !bDataSeriesLabel && nPlacement == rTypeInfo.mnDefLabelPos && pSeriesPropSet &&
+ pSeriesPropSet->getProperty( nGlobalPlacement, PROP_LabelPlacement ) )
+ nPlacement = nGlobalPlacement;
+
rPropSet.setProperty( PROP_LabelPlacement, nPlacement );
}
}
@@ -204,7 +211,8 @@ DataLabelConverter::~DataLabelConverter()
{
}
-void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDataSeries, const TypeGroupConverter& rTypeGroup )
+void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDataSeries, const TypeGroupConverter& rTypeGroup,
+ const PropertySet& rSeriesPropSet )
{
if (!rxDataSeries.is())
return;
@@ -213,7 +221,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat
{
bool bMSO2007Doc = getFilter().isMSO2007Document();
PropertySet aPropSet( rxDataSeries->getDataPointByIndex( mrModel.mnIndex ) );
- lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false, bMSO2007Doc );
+ lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false, bMSO2007Doc, &rSeriesPropSet );
const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo();
bool bIsPie = rTypeInfo.meTypeCategory == TYPECATEGORY_PIE;
if( mrModel.mxLayout && !mrModel.mxLayout->mbAutoLayout && !bIsPie )
@@ -256,11 +264,11 @@ DataLabelsConverter::~DataLabelsConverter()
void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDataSeries, const TypeGroupConverter& rTypeGroup )
{
+ PropertySet aPropSet( rxDataSeries );
if( !mrModel.mbDeleted )
{
bool bMSO2007Doc = getFilter().isMSO2007Document();
- PropertySet aPropSet( rxDataSeries );
- lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, true, bMSO2007Doc );
+ lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, true, bMSO2007Doc, nullptr );
if (mrModel.mxShapeProp)
// Import baseline border properties for these data labels.
@@ -274,7 +282,7 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa
(*aIt)->maNumberFormat = mrModel.maNumberFormat;
DataLabelConverter aLabelConv( *this, **aIt );
- aLabelConv.convertFromModel( rxDataSeries, rTypeGroup );
+ aLabelConv.convertFromModel( rxDataSeries, rTypeGroup, aPropSet );
}
}