chart2/source/tools/_serviceregistration_tools.cxx | 16 +++++ offapi/UnoApi_offapi.mk | 2 offapi/com/sun/star/chart2/MovingAverageRegressionCurve.idl | 38 ++++++++++++ offapi/com/sun/star/chart2/PolynomialRegressionCurve.idl | 38 ++++++++++++ sc/source/filter/excel/xechart.cxx | 25 +++++++ sc/source/filter/excel/xichart.cxx | 15 ++++ sc/source/filter/inc/xlchart.hxx | 4 + 7 files changed, 137 insertions(+), 1 deletion(-)
New commits: commit d68ebbf542e70b386e50002c2e5499a3f36f036b Author: Tomaž Vajngerl <qui...@gmail.com> Date: Tue May 28 22:12:58 2013 +0200 Import/export of polynomial and moving average for old MS XP/2003 format Also make new services work, so they can be used in filters. Change-Id: If4ebd86b2b7bc4fc43d36109f05d06d42c531dab diff --git a/chart2/source/tools/_serviceregistration_tools.cxx b/chart2/source/tools/_serviceregistration_tools.cxx index 0aa3aa535..80d5205 100644 --- a/chart2/source/tools/_serviceregistration_tools.cxx +++ b/chart2/source/tools/_serviceregistration_tools.cxx @@ -145,6 +145,22 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_tools[] = , 0 } ,{ + ::chart::PolynomialRegressionCurve::create + , ::chart::PolynomialRegressionCurve::getImplementationName_Static + , ::chart::PolynomialRegressionCurve::getSupportedServiceNames_Static + , ::cppu::createSingleComponentFactory + , 0 + , 0 + } + ,{ + ::chart::MovingAverageRegressionCurve::create + , ::chart::MovingAverageRegressionCurve::getImplementationName_Static + , ::chart::MovingAverageRegressionCurve::getSupportedServiceNames_Static + , ::cppu::createSingleComponentFactory + , 0 + , 0 + } + ,{ ::chart::RegressionEquation::create , ::chart::RegressionEquation::getImplementationName_Static , ::chart::RegressionEquation::getSupportedServiceNames_Static diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index dcaf757..b536a88 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -85,8 +85,10 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/chart2,\ LogarithmicScaling \ LinearRegressionCurve \ LinearScaling \ + MovingAverageRegressionCurve \ PolarCoordinateSystem2d \ PolarCoordinateSystem3d \ + PolynomialRegressionCurve \ PotentialRegressionCurve \ PowerScaling \ RegressionEquation \ diff --git a/offapi/com/sun/star/chart2/MovingAverageRegressionCurve.idl b/offapi/com/sun/star/chart2/MovingAverageRegressionCurve.idl new file mode 100644 index 0000000..d2a6d89 --- /dev/null +++ b/offapi/com/sun/star/chart2/MovingAverageRegressionCurve.idl @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef com_sun_star_chart2_MovingAverageRegressionCurve_idl +#define com_sun_star_chart2_MovingAverageRegressionCurve_idl + +#include <com/sun/star/chart2/XRegressionCurve.idl> + + +module com { module sun { module star { module chart2 { + + +/** + @since LibreOffice 4.1 +*/ +service MovingAverageRegressionCurve : com::sun::star::chart2::XRegressionCurve; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/chart2/PolynomialRegressionCurve.idl b/offapi/com/sun/star/chart2/PolynomialRegressionCurve.idl new file mode 100644 index 0000000..a7684e8 --- /dev/null +++ b/offapi/com/sun/star/chart2/PolynomialRegressionCurve.idl @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef com_sun_star_chart2_PolynomialRegressionCurve_idl +#define com_sun_star_chart2_PolynomialRegressionCurve_idl + +#include <com/sun/star/chart2/XRegressionCurve.idl> + + +module com { module sun { module star { module chart2 { + + +/** + @since LibreOffice 4.1 +*/ +service PolynomialRegressionCurve : com::sun::star::chart2::XRegressionCurve; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index e8f8828..4138ec8 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -1698,13 +1698,38 @@ bool XclExpChSerTrendLine::Convert( Reference< XRegressionCurve > xRegCurve, sal maData.mnOrder = 1; } else if( aService == "com.sun.star.chart2.ExponentialRegressionCurve" ) + { maData.mnLineType = EXC_CHSERTREND_EXPONENTIAL; + } else if( aService == "com.sun.star.chart2.LogarithmicRegressionCurve" ) + { maData.mnLineType = EXC_CHSERTREND_LOGARITHMIC; + } else if( aService == "com.sun.star.chart2.PotentialRegressionCurve" ) + { maData.mnLineType = EXC_CHSERTREND_POWER; + } + else if( aService == "com.sun.star.chart2.PolynomialRegressionCurve" ) + { + maData.mnLineType = EXC_CHSERTREND_POLYNOMIAL; + sal_Int32 aDegree; + aCurveProp.GetProperty(aDegree, EXC_CHPROP_POLYNOMIAL_DEGREE); + maData.mnOrder = static_cast<sal_uInt8> (aDegree); + } + else if( aService == "com.sun.star.chart2.MovingAverageRegressionCurve" ) + { + maData.mnLineType = EXC_CHSERTREND_MOVING_AVG; + sal_Int32 aPeriod; + aCurveProp.GetProperty(aPeriod, EXC_CHPROP_MOVING_AVERAGE_PERIOD); + maData.mnOrder = static_cast<sal_uInt8> (aPeriod); + } else + { return false; + } + + aCurveProp.GetProperty(maData.mfForecastFor, EXC_CHPROP_EXTRAPOLATE_FORWARD); + aCurveProp.GetProperty(maData.mfForecastBack, EXC_CHPROP_EXTRAPOLATE_BACKWARD); // line formatting XclChDataPointPos aPointPos( nSeriesIdx ); diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 83f73a9..6ae9237 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -44,6 +44,8 @@ #include <com/sun/star/chart2/ExponentialRegressionCurve.hpp> #include <com/sun/star/chart2/LogarithmicRegressionCurve.hpp> #include <com/sun/star/chart2/PotentialRegressionCurve.hpp> +#include <com/sun/star/chart2/PolynomialRegressionCurve.hpp> +#include <com/sun/star/chart2/MovingAverageRegressionCurve.hpp> #include <com/sun/star/chart2/CartesianCoordinateSystem2d.hpp> #include <com/sun/star/chart2/CartesianCoordinateSystem3d.hpp> #include <com/sun/star/chart2/FormattedString.hpp> @@ -1616,9 +1618,12 @@ Reference< XRegressionCurve > XclImpChSerTrendLine::CreateRegressionCurve() cons switch( maData.mnLineType ) { case EXC_CHSERTREND_POLYNOMIAL: - // TODO: only linear trend lines are supported by OOChart (#i20819#) if( maData.mnOrder == 1 ) + { xRegCurve = LinearRegressionCurve::create( comphelper::getProcessComponentContext() ); + } else { + xRegCurve = PolynomialRegressionCurve::create( comphelper::getProcessComponentContext() ); + } break; case EXC_CHSERTREND_EXPONENTIAL: xRegCurve = ExponentialRegressionCurve::create( comphelper::getProcessComponentContext() ); @@ -1629,6 +1634,9 @@ Reference< XRegressionCurve > XclImpChSerTrendLine::CreateRegressionCurve() cons case EXC_CHSERTREND_POWER: xRegCurve = PotentialRegressionCurve::create( comphelper::getProcessComponentContext() ); break; + case EXC_CHSERTREND_MOVING_AVG: + xRegCurve = MovingAverageRegressionCurve::create( comphelper::getProcessComponentContext() ); + break; } // trend line formatting @@ -1637,6 +1645,11 @@ Reference< XRegressionCurve > XclImpChSerTrendLine::CreateRegressionCurve() cons ScfPropertySet aPropSet( xRegCurve ); mxDataFmt->ConvertLine( aPropSet, EXC_CHOBJTYPE_TRENDLINE ); + aPropSet.SetProperty(EXC_CHPROP_POLYNOMIAL_DEGREE, static_cast<sal_Int32> (maData.mnOrder) ); + aPropSet.SetProperty(EXC_CHPROP_MOVING_AVERAGE_PERIOD, static_cast<sal_Int32> (maData.mnOrder) ); + aPropSet.SetProperty(EXC_CHPROP_EXTRAPOLATE_FORWARD, maData.mfForecastFor); + aPropSet.SetProperty(EXC_CHPROP_EXTRAPOLATE_BACKWARD, maData.mfForecastBack); + // #i83100# show equation and correlation coefficient ScfPropertySet aLabelProp( xRegCurve->getEquationProperties() ); aLabelProp.SetBoolProperty( EXC_CHPROP_SHOWEQUATION, maData.mnShowEquation != 0 ); diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx index dff5c22..b13d932 100644 --- a/sc/source/filter/inc/xlchart.hxx +++ b/sc/source/filter/inc/xlchart.hxx @@ -83,6 +83,8 @@ class XclRoot; #define EXC_CHPROP_ERRORBARY "ErrorBarY" #define EXC_CHPROP_EXPANSION "Expansion" #define EXC_CHPROP_EXPTIMEINCREMENT "ExplicitTimeIncrement" +#define EXC_CHPROP_EXTRAPOLATE_FORWARD "ExtrapolateForward" +#define EXC_CHPROP_EXTRAPOLATE_BACKWARD "ExtrapolateBackward" #define EXC_CHPROP_FILLBITMAPMODE "FillBitmapMode" #define EXC_CHPROP_FILLSTYLE "FillStyle" #define EXC_CHPROP_GAPWIDTHSEQ "GapwidthSequence" @@ -98,6 +100,7 @@ class XclRoot; #define EXC_CHPROP_MARKPOSITION "MarkPosition" #define EXC_CHPROP_MINORTICKS "MinorTickmarks" #define EXC_CHPROP_MISSINGVALUETREATMENT "MissingValueTreatment" +#define EXC_CHPROP_MOVING_AVERAGE_PERIOD "MovingAveragePeriod" #define EXC_CHPROP_NEGATIVEERROR "NegativeError" #define EXC_CHPROP_NUMBERFORMAT "NumberFormat" #define EXC_CHPROP_OFFSET "Offset" @@ -106,6 +109,7 @@ class XclRoot; #define EXC_CHPROP_PERCENTDIAGONAL "PercentDiagonal" #define EXC_CHPROP_PERSPECTIVE "Perspective" #define EXC_CHPROP_POSITIVEERROR "PositiveError" +#define EXC_CHPROP_POLYNOMIAL_DEGREE "PolynomialDegree" #define EXC_CHPROP_RELATIVEPOSITION "RelativePosition" #define EXC_CHPROP_RELATIVESIZE "RelativeSize" #define EXC_CHPROP_RIGHTANGLEDAXES "RightAngledAxes"
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits