Kaydet (Commit) bae42fd6 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, Convert chart2::RegressionEquation service to new style

The service already existed, it just needed an IDL file

Change-Id: I56b7079b098a7615dfb24598d15fe7d57691f317
üst b12dab7b
...@@ -81,6 +81,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/chart2,\ ...@@ -81,6 +81,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/chart2,\
FormattedString \ FormattedString \
PolarCoordinateSystem2d \ PolarCoordinateSystem2d \
PolarCoordinateSystem3d \ PolarCoordinateSystem3d \
RegressionEquation \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/chart2/data,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/chart2/data,\
DatabaseDataProvider \ DatabaseDataProvider \
......
/* -*- 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: */
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp> #include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/ChartErrorCategory.hpp> #include <com/sun/star/chart/ChartErrorCategory.hpp>
#include <com/sun/star/chart/ChartErrorIndicatorType.hpp> #include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
...@@ -47,14 +46,13 @@ ...@@ -47,14 +46,13 @@
#include <com/sun/star/chart/X3DDisplay.hpp> #include <com/sun/star/chart/X3DDisplay.hpp>
#include <com/sun/star/chart/XStatisticDisplay.hpp> #include <com/sun/star/chart/XStatisticDisplay.hpp>
#include <com/sun/star/chart/XDiagramPositioning.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/XDataSink.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
#include <com/sun/star/chart2/data/LabeledDataSequence.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/CameraGeometry.hpp>
#include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
...@@ -1316,42 +1314,36 @@ void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttri ...@@ -1316,42 +1314,36 @@ void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttri
if( !sAutoStyleName.isEmpty() || bShowEquation || bShowRSquare ) if( !sAutoStyleName.isEmpty() || bShowEquation || bShowRSquare )
{ {
uno::Reference< beans::XPropertySet > xEqProp; uno::Reference< beans::XPropertySet > xEqProp = chart2::RegressionEquation::create( comphelper::getProcessComponentContext() );
uno::Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
if( xFact.is()) if( !sAutoStyleName.isEmpty() )
xEqProp.set( xFact->createInstance(
OUString( "com.sun.star.chart2.RegressionEquation" )), uno::UNO_QUERY );
if( xEqProp.is())
{ {
if( !sAutoStyleName.isEmpty() ) const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
if( pStylesCtxt )
{ {
const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext(); const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
if( pStylesCtxt ) mrImportHelper.GetChartFamilyID(), sAutoStyleName );
{ // note: SvXMLStyleContext::FillPropertySet is not const
const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext( XMLPropStyleContext * pPropStyleContext =
mrImportHelper.GetChartFamilyID(), sAutoStyleName ); const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
// note: SvXMLStyleContext::FillPropertySet is not const
XMLPropStyleContext * pPropStyleContext =
const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
if( pPropStyleContext ) if( pPropStyleContext )
pPropStyleContext->FillPropertySet( xEqProp ); 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 ) if( bHasXPos && bHasYPos )
{ {
chart2::RelativePosition aRelPos; chart2::RelativePosition aRelPos;
aRelPos.Primary = static_cast< double >( aPosition.X ) / static_cast< double >( maChartSize.Width ); aRelPos.Primary = static_cast< double >( aPosition.X ) / static_cast< double >( maChartSize.Width );
aRelPos.Secondary = static_cast< double >( aPosition.Y ) / static_cast< double >( maChartSize.Height ); aRelPos.Secondary = static_cast< double >( aPosition.Y ) / static_cast< double >( maChartSize.Height );
xEqProp->setPropertyValue( OUString( "RelativePosition" ), xEqProp->setPropertyValue( OUString( "RelativePosition" ),
uno::makeAny( aRelPos )); uno::makeAny( aRelPos ));
}
SAL_WARN_IF( mrRegressionStyle.meType != DataRowPointStyle::REGRESSION, "xmloff.chart", "mrRegressionStyle.meType != DataRowPointStyle::REGRESSION" );
mrRegressionStyle.m_xEquationProperties.set( xEqProp );
} }
SAL_WARN_IF( mrRegressionStyle.meType != DataRowPointStyle::REGRESSION, "xmloff.chart", "mrRegressionStyle.meType != DataRowPointStyle::REGRESSION" );
mrRegressionStyle.m_xEquationProperties.set( xEqProp );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment