summaryrefslogtreecommitdiff
path: root/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-06-28 19:49:25 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-07-03 21:46:43 +0200
commit6085bd15740eb38de5f4c1079d11e8dd38fc166c (patch)
treedbb41f82e02f3e70988b4cf055095e7b0d66f81a /chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
parentdd5c0b2db451ff4d6fac7a72770758513583d468 (diff)
Force intercept for polynomial regression & dialog improvements
Change-Id: I2f712d8b95b5fdeb05b93b5247aab9772a00cc70
Diffstat (limited to 'chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx')
-rw-r--r--chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx72
1 files changed, 72 insertions, 0 deletions
diff --git a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
index 3ea1c0dd4363..011853ff1561 100644
--- a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
@@ -261,11 +261,49 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
case SCHATTR_REGRESSION_SET_INTERCEPT:
{
+ if( xCurve.is())
+ {
+ sal_Bool bNewValue = static_cast< sal_Bool >(
+ static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue());
+
+ uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
+ OSL_ASSERT( xProperties.is());
+ sal_Bool bOldValue = false;
+ if( xProperties.is() )
+ {
+ xProperties->getPropertyValue( "ForceIntercept" ) >>= bOldValue;
+ if (bOldValue != bNewValue)
+ {
+ xProperties->setPropertyValue( "ForceIntercept" , uno::makeAny( bNewValue ));
+ bChanged = true;
+ }
+ }
+ }
}
break;
case SCHATTR_REGRESSION_INTERCEPT_VALUE:
{
+ if( xCurve.is())
+ {
+ double aValue = static_cast< double >(
+ static_cast< const SvxDoubleItem & >(
+ rItemSet.Get( nWhichId )).GetValue());
+
+ uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
+ OSL_ASSERT( xProperties.is());
+ double aOldValue = 0.0;
+ if( xProperties.is() )
+ {
+ xProperties->getPropertyValue( "InterceptValue" ) >>= aOldValue;
+ if (aOldValue != aValue)
+ {
+ xProperties->setPropertyValue( "InterceptValue" , uno::makeAny( aValue ));
+ bChanged = true;
+ }
+ }
+ }
}
break;
@@ -407,6 +445,40 @@ void RegressionCurveItemConverter::FillSpecialItem(
}
break;
+ case SCHATTR_REGRESSION_SET_INTERCEPT:
+ {
+ OSL_ASSERT( xCurve.is());
+ if( xCurve.is())
+ {
+ uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
+ OSL_ASSERT( xProperties.is());
+ sal_Bool bForceIntercept = false;
+ if( xProperties.is() &&
+ (xProperties->getPropertyValue( "ForceIntercept" ) >>= bForceIntercept))
+ {
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bForceIntercept ));
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_REGRESSION_INTERCEPT_VALUE:
+ {
+ OSL_ASSERT( xCurve.is());
+ if( xCurve.is())
+ {
+ uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
+ OSL_ASSERT( xProperties.is());
+ double aValue = 0.0;
+ if( xProperties.is() &&
+ (xProperties->getPropertyValue( "InterceptValue" ) >>= aValue))
+ {
+ rOutItemSet.Put( SvxDoubleItem( aValue, nWhichId ));
+ }
+ }
+ }
+ break;
+
case SCHATTR_REGRESSION_SHOW_EQUATION:
{
OSL_ASSERT( xCurve.is());