diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-14 14:09:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-15 08:25:37 +0200 |
commit | bae42fd6dac1d6fa8330eeede66ec22cddb82311 (patch) | |
tree | 6e7913f79fda69dd3e496793ca255894cd920bbd /xmloff | |
parent | fdo#46808, Convert some XMultiServiceFactory to XComponentContext (diff) | |
download | core-bae42fd6dac1d6fa8330eeede66ec22cddb82311.tar.gz core-bae42fd6dac1d6fa8330eeede66ec22cddb82311.zip |
fdo#46808, Convert chart2::RegressionEquation service to new style
The service already existed, it just needed an IDL file
Change-Id: I56b7079b098a7615dfb24598d15fe7d57691f317
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLPlotAreaContext.cxx | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index a8663f5437a4..d8b56b2cb44b 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -39,7 +39,6 @@ #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> - #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/ChartErrorCategory.hpp> #include <com/sun/star/chart/ChartErrorIndicatorType.hpp> @@ -47,14 +46,13 @@ #include <com/sun/star/chart/X3DDisplay.hpp> #include <com/sun/star/chart/XStatisticDisplay.hpp> #include <com/sun/star/chart/XDiagramPositioning.hpp> - +#include <com/sun/star/chart2/RegressionEquation.hpp> +#include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/chart2/XChartTypeContainer.hpp> +#include <com/sun/star/chart2/XDataSeriesContainer.hpp> #include <com/sun/star/chart2/data/XDataSink.hpp> #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> #include <com/sun/star/chart2/data/LabeledDataSequence.hpp> -#include <com/sun/star/chart2/XChartTypeContainer.hpp> -#include <com/sun/star/chart2/XDataSeriesContainer.hpp> -#include <com/sun/star/chart2/RelativePosition.hpp> - #include <com/sun/star/drawing/CameraGeometry.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -1316,42 +1314,36 @@ void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttri if( !sAutoStyleName.isEmpty() || bShowEquation || bShowRSquare ) { - uno::Reference< beans::XPropertySet > xEqProp; - uno::Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY ); - if( xFact.is()) - xEqProp.set( xFact->createInstance( - OUString( "com.sun.star.chart2.RegressionEquation" )), uno::UNO_QUERY ); - if( xEqProp.is()) + uno::Reference< beans::XPropertySet > xEqProp = chart2::RegressionEquation::create( comphelper::getProcessComponentContext() ); + + if( !sAutoStyleName.isEmpty() ) { - if( !sAutoStyleName.isEmpty() ) + const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext(); + if( pStylesCtxt ) { - const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext(); - if( pStylesCtxt ) - { - const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext( - mrImportHelper.GetChartFamilyID(), sAutoStyleName ); - // note: SvXMLStyleContext::FillPropertySet is not const - XMLPropStyleContext * pPropStyleContext = - const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle )); + const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext( + mrImportHelper.GetChartFamilyID(), sAutoStyleName ); + // note: SvXMLStyleContext::FillPropertySet is not const + XMLPropStyleContext * pPropStyleContext = + const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle )); - if( pPropStyleContext ) - pPropStyleContext->FillPropertySet( xEqProp ); - } + if( pPropStyleContext ) + pPropStyleContext->FillPropertySet( xEqProp ); } - xEqProp->setPropertyValue( OUString( "ShowEquation"), uno::makeAny( bShowEquation )); - xEqProp->setPropertyValue( OUString( "ShowCorrelationCoefficient"), uno::makeAny( bShowRSquare )); + } + xEqProp->setPropertyValue( OUString( "ShowEquation"), uno::makeAny( bShowEquation )); + xEqProp->setPropertyValue( OUString( "ShowCorrelationCoefficient"), uno::makeAny( bShowRSquare )); - if( bHasXPos && bHasYPos ) - { - chart2::RelativePosition aRelPos; - aRelPos.Primary = static_cast< double >( aPosition.X ) / static_cast< double >( maChartSize.Width ); - aRelPos.Secondary = static_cast< double >( aPosition.Y ) / static_cast< double >( maChartSize.Height ); - xEqProp->setPropertyValue( OUString( "RelativePosition" ), - uno::makeAny( aRelPos )); - } - SAL_WARN_IF( mrRegressionStyle.meType != DataRowPointStyle::REGRESSION, "xmloff.chart", "mrRegressionStyle.meType != DataRowPointStyle::REGRESSION" ); - mrRegressionStyle.m_xEquationProperties.set( xEqProp ); + if( bHasXPos && bHasYPos ) + { + chart2::RelativePosition aRelPos; + aRelPos.Primary = static_cast< double >( aPosition.X ) / static_cast< double >( maChartSize.Width ); + aRelPos.Secondary = static_cast< double >( aPosition.Y ) / static_cast< double >( maChartSize.Height ); + xEqProp->setPropertyValue( OUString( "RelativePosition" ), + uno::makeAny( aRelPos )); } + SAL_WARN_IF( mrRegressionStyle.meType != DataRowPointStyle::REGRESSION, "xmloff.chart", "mrRegressionStyle.meType != DataRowPointStyle::REGRESSION" ); + mrRegressionStyle.m_xEquationProperties.set( xEqProp ); } } |