diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2007-11-23 11:07:50 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2007-11-23 11:07:50 +0000 |
commit | 1598ef73d3ada11972ad24f78dec83336cc26bbf (patch) | |
tree | 2a2eadc8bd264f0d0a38af198cfda025eeffb01d /chart2/source/tools/RegressionCurveModel.cxx | |
parent | 729b1162717ddf8eb1750ff140a2ac9e72e20023 (diff) |
INTEGRATION: CWS chart17 (1.6.32); FILE MERGED
2007/10/29 16:53:17 bm 1.6.32.2: #i7998# set hairline line width as hard attribute to get a new default that works with old implementations
2007/10/12 12:35:09 bm 1.6.32.1: #i7998# equations for regression curves
Diffstat (limited to 'chart2/source/tools/RegressionCurveModel.cxx')
-rw-r--r-- | chart2/source/tools/RegressionCurveModel.cxx | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/chart2/source/tools/RegressionCurveModel.cxx b/chart2/source/tools/RegressionCurveModel.cxx index b14b99e5ca08..dfa4849ff6fb 100644 --- a/chart2/source/tools/RegressionCurveModel.cxx +++ b/chart2/source/tools/RegressionCurveModel.cxx @@ -4,9 +4,9 @@ * * $RCSfile: RegressionCurveModel.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: rt $ $Date: 2007-07-25 09:00:15 $ + * last change: $Author: ihi $ $Date: 2007-11-23 12:07:50 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -40,7 +40,9 @@ #include "LineProperties.hxx" #include "RegressionCurveHelper.hxx" #include "RegressionCalculationHelper.hxx" +#include "RegressionEquation.hxx" #include "ContainerHelper.hxx" +#include "CloneHelper.hxx" #ifndef CHART_PROPERTYHELPER_HXX #include "PropertyHelper.hxx" @@ -76,6 +78,9 @@ static const OUString lcl_aImplementationName_Exponential( static const OUString lcl_aImplementationName_Potential( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.PotentialRegressionCurve" )); +static const OUString lcl_aServiceName( + RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.RegressionCurve" )); + const uno::Sequence< Property > & lcl_GetPropertySequence() { static uno::Sequence< Property > aPropSeq; @@ -119,8 +124,14 @@ RegressionCurveModel::RegressionCurveModel( ::property::OPropertySet( m_aMutex ), m_xContext( xContext ), m_eRegressionCurveType( eCurveType ), - m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder( m_aMutex )) + m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder( m_aMutex )), + m_xEquationProperties( new RegressionEquation( xContext )) { + // set 0 line width (default) hard, so that it is always written to XML, + // because the old implementation uses different defaults + setFastPropertyValue_NoBroadcast( + LineProperties::PROP_LINE_WIDTH, uno::makeAny( sal_Int32( 0 ))); + ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder ); } RegressionCurveModel::RegressionCurveModel( const RegressionCurveModel & rOther ) : @@ -130,7 +141,10 @@ RegressionCurveModel::RegressionCurveModel( const RegressionCurveModel & rOther m_xContext( rOther.m_xContext ), m_eRegressionCurveType( rOther.m_eRegressionCurveType ), m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder( m_aMutex )) -{} +{ + m_xEquationProperties.set( CloneHelper::CreateRefClone< uno::Reference< beans::XPropertySet > >()( rOther.m_xEquationProperties )); + ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder ); +} RegressionCurveModel::~RegressionCurveModel() {} @@ -143,6 +157,26 @@ uno::Reference< chart2::XRegressionCurveCalculator > SAL_CALL return RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( getServiceName()); } +uno::Reference< beans::XPropertySet > SAL_CALL RegressionCurveModel::getEquationProperties() + throw (uno::RuntimeException) +{ + return m_xEquationProperties; +} + +void SAL_CALL RegressionCurveModel::setEquationProperties( const uno::Reference< beans::XPropertySet >& xEquationProperties ) + throw (uno::RuntimeException) +{ + if( xEquationProperties.is()) + { + if( m_xEquationProperties.is()) + ModifyListenerHelper::removeListener( m_xEquationProperties, m_xModifyEventForwarder ); + + m_xEquationProperties.set( xEquationProperties ); + ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder ); + fireModifyEvent(); + } +} + // ____ XServiceName ____ ::rtl::OUString SAL_CALL RegressionCurveModel::getServiceName() throw (uno::RuntimeException) @@ -296,7 +330,7 @@ MeanValueRegressionCurve::~MeanValueRegressionCurve() uno::Sequence< ::rtl::OUString > MeanValueRegressionCurve::getSupportedServiceNames_Static() { uno::Sequence< ::rtl::OUString > aServices( 2 ); - aServices[ 0 ] = C2U( "com.sun.star.chart2.RegressionCurve" ); + aServices[ 0 ] = lcl_aServiceName; aServices[ 1 ] = C2U( "com.sun.star.chart2.MeanValueRegressionCurve" ); return aServices; } @@ -324,7 +358,7 @@ LinearRegressionCurve::~LinearRegressionCurve() uno::Sequence< ::rtl::OUString > LinearRegressionCurve::getSupportedServiceNames_Static() { uno::Sequence< ::rtl::OUString > aServices( 2 ); - aServices[ 0 ] = C2U( "com.sun.star.chart2.RegressionCurve" ); + aServices[ 0 ] = lcl_aServiceName; aServices[ 1 ] = C2U( "com.sun.star.chart2.LinearRegressionCurve" ); return aServices; } @@ -352,7 +386,7 @@ LogarithmicRegressionCurve::~LogarithmicRegressionCurve() uno::Sequence< ::rtl::OUString > LogarithmicRegressionCurve::getSupportedServiceNames_Static() { uno::Sequence< ::rtl::OUString > aServices( 2 ); - aServices[ 0 ] = C2U( "com.sun.star.chart2.RegressionCurve" ); + aServices[ 0 ] = lcl_aServiceName; aServices[ 1 ] = C2U( "com.sun.star.chart2.LogarithmicRegressionCurve" ); return aServices; } @@ -380,7 +414,7 @@ ExponentialRegressionCurve::~ExponentialRegressionCurve() uno::Sequence< ::rtl::OUString > ExponentialRegressionCurve::getSupportedServiceNames_Static() { uno::Sequence< ::rtl::OUString > aServices( 2 ); - aServices[ 0 ] = C2U( "com.sun.star.chart2.RegressionCurve" ); + aServices[ 0 ] = lcl_aServiceName; aServices[ 1 ] = C2U( "com.sun.star.chart2.ExponentialRegressionCurve" ); return aServices; } @@ -408,7 +442,7 @@ PotentialRegressionCurve::~PotentialRegressionCurve() uno::Sequence< ::rtl::OUString > PotentialRegressionCurve::getSupportedServiceNames_Static() { uno::Sequence< ::rtl::OUString > aServices( 2 ); - aServices[ 0 ] = C2U( "com.sun.star.chart2.RegressionCurve" ); + aServices[ 0 ] = lcl_aServiceName; aServices[ 1 ] = C2U( "com.sun.star.chart2.PotentialRegressionCurve" ); return aServices; } |