diff options
author | Laurent Balland <laurent.balland@mailo.fr> | 2023-06-12 21:48:13 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-06-18 13:31:09 +0200 |
commit | dc03f59374d4fc74dd44ddedc903bb9c00a74bb7 (patch) | |
tree | f19a7444015280df7f813010db50d2e55f16133a /chart2 | |
parent | a2d7cabe0d7b28334fb6b9742082b3ad58ce519e (diff) |
tdf#155526 Add Period to trend line equation
Insert Period value earlier to have it ready for representation
Allow Moving average equation in dialog UI
Change-Id: I1d20572c39462e60b60ab7eec1f174a3cf934d4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153094
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'chart2')
3 files changed, 11 insertions, 16 deletions
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index e4ec234362bc..41eae9e7f1a8 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -601,18 +601,9 @@ OUString ObjectNameProvider::getHelpText( std::u16string_view rObjectCID, const xCalculator->setXYNames ( aXName, aYName ); 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 - aWildcard = "%FORMULA"; - nIndex = aRet.indexOf( aWildcard ); + OUString aWildcard = "%FORMULA"; + sal_Int32 nIndex = aRet.indexOf( aWildcard ); if( nIndex != -1 ) { OUString aFormula ( xCalculator->getRepresentation() ); diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx index 647c071b1040..58ef6497a538 100644 --- a/chart2/source/controller/dialogs/res_Trendline.cxx +++ b/chart2/source/controller/dialogs/res_Trendline.cxx @@ -372,10 +372,8 @@ void TrendlineResources::UpdateControlStates() m_xFmtFld_InterceptValue->set_sensitive( bInterceptAvailable ); if( bMovingAverage ) { - m_xCB_ShowEquation->set_state(TRISTATE_FALSE); m_xCB_ShowCorrelationCoeff->set_state(TRISTATE_FALSE); } - m_xCB_ShowEquation->set_sensitive( !bMovingAverage ); m_xCB_ShowCorrelationCoeff->set_sensitive( !bMovingAverage ); m_xCB_RegressionMovingType->set_sensitive(bMovingAverage); m_xNF_Period->set_sensitive(bMovingAverage); @@ -428,8 +426,6 @@ void TrendlineResources::SetNbPoints( sal_Int32 nNbPoints ) IMPL_LINK_NOARG(TrendlineResources, ShowEquation, weld::Toggleable&, void) { - m_xEE_XName->set_sensitive(m_xCB_ShowEquation->get_active()); - m_xEE_YName->set_sensitive(m_xCB_ShowEquation->get_active()); UpdateControlStates(); } diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx index 6726d9d78b36..f71262f738b9 100644 --- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx +++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx @@ -157,7 +157,15 @@ OUString MovingAverageRegressionCurveCalculator::ImplGetRepresentation( const uno::Reference< util::XNumberFormatter >& /*xNumFormatter*/, sal_Int32 /*nNumberFormatKey*/, sal_Int32* /*pFormulaLength = nullptr */ ) const { - return SchResId( STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS ); + OUString aRet = SchResId( STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS ); + // change text for Moving Average + OUString aWildcard( "%PERIOD" ); + sal_Int32 nIndex = aRet.indexOf( aWildcard ); + if( nIndex != -1 ) + { // replace period + aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), OUString::number(mPeriod) ); + } + return aRet; } } // namespace chart |