[Libreoffice-commits] core.git: Branch 'feature/polynomialregression' - oox/source

Tomaž Vajngerl quikee at gmail.com
Tue May 28 13:37:29 PDT 2013


 oox/source/drawingml/chart/seriesconverter.cxx |   35 ++++++++++++++++++++-----
 oox/source/token/properties.txt                |    6 +++-
 2 files changed, 33 insertions(+), 8 deletions(-)

New commits:
commit 222832146bdfbd88bc5393d53540cc168a009158
Author: Tomaž Vajngerl <quikee at gmail.com>
Date:   Tue May 28 22:34:10 2013 +0200

    Import polynomial and moving average for OOXML.
    
    Change-Id: Ie6501ed3b3431e187f8f0b83654e84438566ccd5

diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 9ef1f3f..a02e52a 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -407,19 +407,40 @@ void TrendlineConverter::convertFromModel( const Reference< XDataSeries >& rxDat
         OUString aServiceName;
         switch( mrModel.mnTypeId )
         {
-            case XML_exp:       aServiceName = "com.sun.star.chart2.ExponentialRegressionCurve"; break;
-            case XML_linear:    aServiceName = "com.sun.star.chart2.LinearRegressionCurve";      break;
-            case XML_log:       aServiceName = "com.sun.star.chart2.LogarithmicRegressionCurve"; break;
-            case XML_movingAvg: /* #i66819# moving average trendlines not supported */                              break;
-            case XML_poly:      /* #i20819# polynomial trendlines not supported */                                  break;
-            case XML_power:     aServiceName = "com.sun.star.chart2.PotentialRegressionCurve";   break;
-            default:            OSL_FAIL( "TrendlineConverter::convertFromModel - unknown trendline type" );
+            case XML_exp:
+                aServiceName = "com.sun.star.chart2.ExponentialRegressionCurve";
+            break;
+            case XML_linear:
+                aServiceName = "com.sun.star.chart2.LinearRegressionCurve";
+            break;
+            case XML_log:
+                aServiceName = "com.sun.star.chart2.LogarithmicRegressionCurve";
+            break;
+            case XML_movingAvg:
+                aServiceName = "com.sun.star.chart2.MovingAverageRegressionCurve";
+            break;
+            case XML_poly:
+                aServiceName = "com.sun.star.chart2.PolynomialRegressionCurve";
+            break;
+            case XML_power:
+                aServiceName = "com.sun.star.chart2.PotentialRegressionCurve";
+            break;
+            default:
+                OSL_FAIL( "TrendlineConverter::convertFromModel - unknown trendline type" );
         }
         if( !aServiceName.isEmpty() )
         {
             Reference< XRegressionCurve > xRegCurve( createInstance( aServiceName ), UNO_QUERY_THROW );
             PropertySet aPropSet( xRegCurve );
 
+            aPropSet.setProperty( PROP_PolynomialDegree, mrModel.mnOrder );
+            aPropSet.setProperty( PROP_MovingAveragePeriod, mrModel.mnPeriod );
+
+            if (mrModel.mfForward.has())
+                aPropSet.setProperty( PROP_ExtrapolateForward, mrModel.mfForward.get() );
+            if (mrModel.mfBackward.has())
+                aPropSet.setProperty( PROP_ExtrapolateBackward, mrModel.mfBackward.get() );
+
             // trendline formatting
             getFormatter().convertFrameFormatting( aPropSet, mrModel.mxShapeProp, OBJECTTYPE_TRENDLINE );
 
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index bd8f5ee..e292d14 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -147,6 +147,8 @@ ErrorTitle
 Expansion
 ExternalDocLinks
 ExternalLinks
+ExtrapolateForward
+ExtrapolateBackward
 FileFormat
 FillBitmapMode
 FillBitmapName
@@ -304,6 +306,7 @@ MoveProtect
 MultiLine
 MultiPageValue
 MultiSelection
+MovingAveragePeriod
 Name
 NamedRanges
 NegativeError
@@ -338,9 +341,10 @@ Path
 PercentageNumberFormat
 PersistName
 Perspective
+PolygonKind
+PolynomialDegree
 PolyPolygon
 PolyPolygonBezier
-PolygonKind
 Position
 PositionBottom
 PositionLeft


More information about the Libreoffice-commits mailing list