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

2013-05-28 Thread Tomaž Vajngerl
 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 
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
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-05-31 Thread Markus Mohrhard
 oox/source/export/chartexport.cxx |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 901a7cad5921207d66a86b0684e1399128ec84e3
Author: Markus Mohrhard 
Date:   Sat Jun 1 07:35:09 2013 +0200

fix element order in OOXML export

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 8fdcf58..ede6cec 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1521,7 +1521,6 @@ void ChartExport::exportSeries( Reference< 
chart2::XChartType > xChartType, sal_
 case chart::TYPEID_SCATTER:
 {
 exportMarker( );
-exportTrendlines( aSeriesSeq[nSeriesIdx] );
 exportSmooth( );
 break;
 }
@@ -1541,6 +1540,9 @@ void ChartExport::exportSeries( Reference< 
chart2::XChartType > xChartType, sal_
 if( eChartType != chart::TYPEID_SCATTER && eChartType != 
chart::TYPEID_BAR )
 exportDataLabels( uno::Reference< beans::XPropertySet 
>( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ), nSeriesLength );
 
+if( eChartType == chart::TYPEID_SCATTER )
+exportTrendlines( aSeriesSeq[nSeriesIdx] );
+
 //export error bars here
 Reference< XPropertySet > xSeriesPropSet( xSource, 
uno::UNO_QUERY );
 Reference< XPropertySet > xErrorBarYProps;
@@ -2491,6 +2493,8 @@ void ChartExport::exportTrendlines( Reference< 
chart2::XDataSeries > xSeries )
 
 Reference< XPropertySet > xProperties( xRegCurve , uno::UNO_QUERY 
);
 
+exportShapeProps( xProperties );
+
 OUString aService;
 
 Reference< lang::XServiceName > xServiceName( xProperties, 
UNO_QUERY );
@@ -2566,8 +2570,6 @@ void ChartExport::exportTrendlines( Reference< 
chart2::XDataSeries > xSeries )
 XML_val, OString::number(aExtrapolateBackward).getStr(),
 FSEND );
 
-exportShapeProps( xProperties );
-
 // Equation properties
 Reference< XPropertySet > xEquationProperties( 
xRegCurve->getEquationProperties() );
 
@@ -2575,10 +2577,6 @@ void ChartExport::exportTrendlines( Reference< 
chart2::XDataSeries > xSeries )
 sal_Bool aShowEquation = false;
 xEquationProperties->getPropertyValue( "ShowEquation" ) >>= 
aShowEquation;
 
-pFS->singleElement( FSNS( XML_c, XML_dispEq ),
-XML_val, aShowEquation ? "1" : "0",
-FSEND );
-
 // Show R^2
 sal_Bool aShowCorrelationCoefficient = false;
 xEquationProperties->getPropertyValue( 
"ShowCorrelationCoefficient" ) >>= aShowCorrelationCoefficient;
@@ -2587,6 +2585,10 @@ void ChartExport::exportTrendlines( Reference< 
chart2::XDataSeries > xSeries )
 XML_val, aShowCorrelationCoefficient ? "1" : "0",
 FSEND );
 
+pFS->singleElement( FSNS( XML_c, XML_dispEq ),
+XML_val, aShowEquation ? "1" : "0",
+FSEND );
+
 pFS->endElement( FSNS( XML_c, XML_trendline ) );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits