[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - oox/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Tue Feb 18 14:48:34 CET 2014


 oox/source/export/chartexport.cxx |   25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 2c85dc645fdecb85ca88bc4a0a34b255ff30d6b2
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue Feb 18 02:22:07 2014 +0100

    prevent invalid OOXML files with trendlines, related #i88825#
    
    Change-Id: I503b24233060400cf4bbb40701bec0a3e101512a
    Reviewed-on: https://gerrit.libreoffice.org/8095
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 659252b..b13867e 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2527,6 +2527,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;
@@ -2540,12 +2555,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 ),
@@ -2597,7 +2606,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;


More information about the Libreoffice-commits mailing list