diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2008-02-18 14:56:43 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2008-02-18 14:56:43 +0000 |
commit | 8b00642418bc388a6043fd4558d8bcc765ed5c76 (patch) | |
tree | b0b49506d4cbb780cae7db77aa315c7b4dbbae38 /chart2/source/controller/itemsetwrapper | |
parent | 65752baea12a5d54a36717c7a64725d6b0b005d5 (diff) |
INTEGRATION: CWS chart19 (1.18.8); FILE MERGED
2008/01/11 15:58:42 bm 1.18.8.1: #i44768# make it easier to add and modify trendlines
Diffstat (limited to 'chart2/source/controller/itemsetwrapper')
-rw-r--r-- | chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx | 99 |
1 files changed, 97 insertions, 2 deletions
diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx index 86af143f0f9e..71e9bfe44b77 100644 --- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx @@ -4,9 +4,9 @@ * * $RCSfile: StatisticsItemConverter.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: ihi $ $Date: 2007-11-23 11:52:56 $ + * last change: $Author: rt $ $Date: 2008-02-18 15:56:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -162,6 +162,37 @@ void lcl_getErrorIndicatorValues( } } +uno::Reference< beans::XPropertySet > lcl_getEquationProperties( + const uno::Reference< beans::XPropertySet > & xSeriesPropSet, const SfxItemSet * pItemSet ) +{ + bool bEquationExists = true; + + // ensure that a trendline is on + if( pItemSet ) + { + SvxChartRegress eRegress = CHREGRESS_NONE; + const SfxPoolItem *pPoolItem = NULL; + if( pItemSet->GetItemState( SCHATTR_STAT_REGRESSTYPE, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + { + eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue(); + bEquationExists = ( eRegress != CHREGRESS_NONE ); + } + } + + if( bEquationExists ) + { + uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropSet, uno::UNO_QUERY ); + uno::Reference< chart2::XRegressionCurve > xCurve( + ::chart::RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt )); + if( xCurve.is()) + { + return xCurve->getEquationProperties(); + } + } + + return uno::Reference< beans::XPropertySet >(); +} + } // anonymous namespace namespace chart @@ -388,6 +419,42 @@ bool StatisticsItemConverter::ApplySpecialItem( } break; + case SCHATTR_REGRESSION_SHOW_EQUATION: + { + uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), &rItemSet )); + if( xEqProp.is()) + { + bool bShowEq = false; + xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq; + bool bNewShowEq = + static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue(); + if( bShowEq != bNewShowEq ) + { + xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( bNewShowEq )); + bChanged = true; + } + } + } + break; + + case SCHATTR_REGRESSION_SHOW_COEFF: + { + uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), &rItemSet )); + if( xEqProp.is()) + { + bool bShowCoeff = false; + xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff; + bool bNewShowCoeff = + static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue(); + if( bShowCoeff != bNewShowCoeff ) + { + xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bNewShowCoeff )); + bChanged = true; + } + } + } + break; + case SCHATTR_STAT_INDICATE: { uno::Reference< beans::XPropertySet > xOldErrorBarProp( @@ -533,6 +600,34 @@ void StatisticsItemConverter::FillSpecialItem( } break; + case SCHATTR_REGRESSION_SHOW_EQUATION: + { + uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 )); + if( xEqProp.is()) + { + bool bShowEq = false; + if( xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq ) + rOutItemSet.Put( SfxBoolItem( nWhichId, bShowEq )); + } + else + rOutItemSet.InvalidateItem( nWhichId ); + } + break; + + case SCHATTR_REGRESSION_SHOW_COEFF: + { + uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 )); + if( xEqProp.is()) + { + bool bShowCoeff = false; + if( xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff ) + rOutItemSet.Put( SfxBoolItem( nWhichId, bShowCoeff )); + } + else + rOutItemSet.InvalidateItem( nWhichId ); + } + break; + case SCHATTR_STAT_INDICATE: { uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet())); |