summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-08-04 13:21:24 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-09 16:03:41 +0200
commit29594a1c9f9dd440c1012732d9e713f6e3db0838 (patch)
tree069a77e32bb655f5eaf7aaac0af4d26d84151615 /oox
parent1571964b4f7c38f47e47973fb06a0589d11d17b5 (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> (cherry picked from commit 70944a849dc59fa686e3f316a3983dbc8a47017f) Reviewed-on: https://gerrit.libreoffice.org/40861 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/chart/seriesconverter.hxx2
-rw-r--r--oox/source/drawingml/chart/seriesconverter.cxx20
2 files changed, 15 insertions, 7 deletions
diff --git a/oox/inc/drawingml/chart/seriesconverter.hxx b/oox/inc/drawingml/chart/seriesconverter.hxx
index 6ee20c59f147..e381cdbc2148 100644
--- a/oox/inc/drawingml/chart/seriesconverter.hxx
+++ b/oox/inc/drawingml/chart/seriesconverter.hxx
@@ -47,7 +47,7 @@ public:
/** Converts OOXML data label settings for the passed data point. */
void convertFromModel(
const css::uno::Reference< css::chart2::XDataSeries >& rxDataSeries,
- const TypeGroupConverter& rTypeGroup );
+ const TypeGroupConverter& rTypeGroup, const PropertySet& rSeriesPropSet );
};
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 );
}
}