summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-02-18 02:22:07 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-18 02:25:45 +0100
commit53146f93ad0697a7af8b312bfbe424c1066207a1 (patch)
tree3097da8dc787758827cbfaa112b1df9bd25c623b /oox
parentdd0c9e64835b825771d961b7a8f21f4d6c077fc7 (diff)
prevent invalid OOXML files with trendlines, related #i88825#
Change-Id: I503b24233060400cf4bbb40701bec0a3e101512a
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index b42786891553..7fea8e36bb30 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2801,6 +2801,21 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries )
Reference< XPropertySet > xProperties( xRegCurve , uno::UNO_QUERY );
+ OUString aService;
+ Reference< lang::XServiceName > xServiceName( xProperties, UNO_QUERY );
+ if( !xServiceName.is() )
+ continue;
+
+ aService = xServiceName->getServiceName();
+
+ if(aService != "com.sun.star.chart2.LinearRegressionCurve" &&
+ aService != "com.sun.star.chart2.ExponentialRegressionCurve" &&
+ aService != "com.sun.star.chart2.LogarithmicRegressionCurve" &&
+ aService != "com.sun.star.chart2.PotentialRegressionCurve" &&
+ aService != "com.sun.star.chart2.PolynomialRegressionCurve" &&
+ aService != "com.sun.star.chart2.MovingAverageRegressionCurve")
+ continue;
+
pFS->startElement( FSNS( XML_c, XML_trendline ), FSEND );
OUString aName;
@@ -2814,12 +2829,6 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries )
exportShapeProps( xProperties );
- OUString aService;
- Reference< lang::XServiceName > xServiceName( xProperties, UNO_QUERY );
- if( !xServiceName.is() )
- continue;
- aService = xServiceName->getServiceName();
-
if( aService == "com.sun.star.chart2.LinearRegressionCurve" )
{
pFS->singleElement( FSNS( XML_c, XML_trendlineType ),
@@ -2871,7 +2880,9 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries )
}
else
{
- continue;
+ // should never happen
+ // This would produce invalid OOXML files so we check earlier for the type
+ assert(false);
}
double aExtrapolateForward = 0.0;