summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/chart2/RegressionEquation.idl35
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx64
3 files changed, 64 insertions, 36 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 90a54dea5a10..79130aa8eea0 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/chart2,\
FormattedString \
PolarCoordinateSystem2d \
PolarCoordinateSystem3d \
+ RegressionEquation \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/chart2/data,\
DatabaseDataProvider \
diff --git a/offapi/com/sun/star/chart2/RegressionEquation.idl b/offapi/com/sun/star/chart2/RegressionEquation.idl
new file mode 100644
index 000000000000..9fc7ac9204f2
--- /dev/null
+++ b/offapi/com/sun/star/chart2/RegressionEquation.idl
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef com_sun_star_chart2_RegressionCurveEquation_idl
+#define com_sun_star_chart2_RegressionCurveEquation_idl
+
+#include <com/sun/star/beans/XPropertySet.idl>
+
+module com { module sun { module star { module chart2 {
+
+/**
+ @since LibreOffice 4.1
+*/
+service RegressionEquation : com::sun::star::beans::XPropertySet;
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 );
}
}