chart2/source/controller/dialogs/ObjectNameProvider.cxx        |   15 
++++++++--
 chart2/source/controller/dialogs/Strings.src                   |    4 ++
 chart2/source/inc/Strings.hrc                                  |    3 +-
 chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx |    4 ++
 4 files changed, 23 insertions(+), 3 deletions(-)

New commits:
commit 67db0ef92f1b8e5b6db9e6d6b8b02ba993f772cf
Author: Laurent Balland-Poirier <laurent.balland-poir...@laposte.net>
Date:   Tue Dec 10 09:21:16 2013 +0100

    fdo#40315 Improve text for moving average trendline
    
    Change text in status bar for moving average trendline:
    no equation, no R²
    
    Change-Id: I0e18a72ff1f1d78e3bb28cab4d5f215c096898dc
    Reviewed-on: https://gerrit.libreoffice.org/7015
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx 
b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 73d8416..39a776f 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -563,12 +563,14 @@ OUString ObjectNameProvider::getHelpText( const OUString& 
rObjectCID, const Refe
                     {
                         Reference< chart2::XRegressionCurveCalculator > 
xCalculator( xCurve->getCalculator(), uno::UNO_QUERY_THROW );
                         sal_Int32 aDegree = 2;
+                        sal_Int32 aPeriod = 2;
                         sal_Bool aForceIntercept = false;
                         double aInterceptValue = 0.0;
                         uno::Reference< beans::XPropertySet > xProperties( 
xCurve, uno::UNO_QUERY );
                         if ( xProperties.is())
                         {
                                 xProperties->getPropertyValue( 
"PolynomialDegree") >>= aDegree;
+                                xProperties->getPropertyValue( 
"MovingAveragePeriod") >>= aPeriod;
                                 xProperties->getPropertyValue( 
"ForceIntercept") >>= aForceIntercept;
                                 if (aForceIntercept)
                                         xProperties->getPropertyValue( 
"InterceptValue") >>= aInterceptValue;
@@ -576,9 +578,18 @@ OUString ObjectNameProvider::getHelpText( const OUString& 
rObjectCID, const Refe
                         xCalculator->setRegressionProperties(aDegree, 
aForceIntercept, aInterceptValue, 2);
                         RegressionCurveHelper::initializeCurveCalculator( 
xCalculator, xSeries, xChartModel );
 
+                        // change text for Moving Average
+                        OUString aWildcard( "%PERIOD" );
+                        sal_Int32 nIndex = 
xCalculator->getRepresentation().indexOf( aWildcard );
+                        if( nIndex != -1 )
+                        {  // replace period
+                                aRet = xCalculator->getRepresentation();
+                                aRet = aRet.replaceAt( nIndex, 
aWildcard.getLength(), OUString::number(aPeriod) );
+                        }
+
                         // replace formula
-                        OUString aWildcard( "%FORMULA" );
-                        sal_Int32 nIndex = aRet.indexOf( aWildcard );
+                        aWildcard = "%FORMULA";
+                        nIndex = aRet.indexOf( aWildcard );
                         if( nIndex != -1 )
                             aRet = aRet.replaceAt( nIndex, 
aWildcard.getLength(), xCalculator->getRepresentation());
 
diff --git a/chart2/source/controller/dialogs/Strings.src 
b/chart2/source/controller/dialogs/Strings.src
index 6cea901..6904f97 100644
--- a/chart2/source/controller/dialogs/Strings.src
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -319,6 +319,10 @@ String STR_OBJECT_CURVE_WITH_PARAMETERS
 {
     Text [ en-US ] = "Trend line %FORMULA with accuracy R² = %RSQUARED";
 };
+String STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS
+{
+    Text [ en-US ] = "Moving average trend line with period = %PERIOD";
+};
 String STR_OBJECT_AVERAGE_LINE
 {
     Text [ en-US ] = "Mean Value Line";
diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc
index 685cbe9..ce32234 100644
--- a/chart2/source/inc/Strings.hrc
+++ b/chart2/source/inc/Strings.hrc
@@ -22,7 +22,7 @@
 // this includes no link dependency
 #include <svl/solar.hrc>
 
-//next free is 297
+//next free is 303
 
 //-----------------------------------------------------------------------------
 //chart types
@@ -206,6 +206,7 @@
 
 #define STR_OBJECT_CURVE_WITH_PARAMETERS    (RID_APP_START + 264)
 #define STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS (RID_APP_START + 265)
+#define STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS (RID_APP_START + 302)
 
 #define STR_OBJECT_CURVE_EQUATION           (RID_APP_START + 268)
 #define STR_OBJECT_SHAPE                    (RID_APP_START + 290)
diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx 
b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
index 10eeaa5..55193f1 100644
--- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
@@ -19,6 +19,8 @@
 
 #include "MovingAverageRegressionCurveCalculator.hxx"
 #include "RegressionCalculationHelper.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
 #include "macros.hxx"
 
 #include <rtl/math.hxx>
@@ -103,6 +105,8 @@ OUString 
MovingAverageRegressionCurveCalculator::ImplGetRepresentation(
 {
     OUStringBuffer aBuf( "f(x) = N/A");
 
+    aBuf = SCH_RESSTR( STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS );
+
     return aBuf.makeStringAndClear();
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to