diff options
Diffstat (limited to 'chart2/source/controller/main/ChartController_Insert.cxx')
-rw-r--r-- | chart2/source/controller/main/ChartController_Insert.cxx | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 86123f808fff..9b882dbacadd 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -363,48 +363,15 @@ void ChartController::executeDispatch_InsertMenu_MeanValues() void ChartController::executeDispatch_InsertMenu_Trendlines() { - //if a series is selected insert only for that series: - uno::Reference< chart2::XDataSeries > xSeries( - ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); - if( xSeries.is()) - { - executeDispatch_InsertTrendline(); - return; - } - - UndoGuard aUndoGuard( - ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) ), - m_xUndoManager ); - - try - { - wrapper::AllSeriesStatisticsConverter aItemConverter( - getModel(), m_pDrawModelWrapper->GetItemPool() ); - SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet(); - aItemConverter.FillItemSet( aItemSet ); + OUString aCID = m_aSelection.getSelectedCID(); - //prepare and open dialog - SolarMutexGuard aGuard; - InsertTrendlineDialog aDialog( m_pChartWindow, aItemSet ); - aDialog.adjustSize(); + uno::Reference< chart2::XDataSeries > xSeries( + ObjectIdentifier::getDataSeriesForCID( aCID, getModel() ), uno::UNO_QUERY ); - if( aDialog.Execute() == RET_OK ) - { - SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet(); - aDialog.FillItemSet( aOutItemSet ); + if( !xSeries.is() ) + return; - // lock controllers till end of block - ControllerLockGuard aCLGuard( getModel() ); - bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now - if( bChanged ) - aUndoGuard.commit(); - } - } - catch(const uno::RuntimeException& e) - { - ASSERT_EXCEPTION( e ); - } + executeDispatch_InsertTrendline(); } void ChartController::executeDispatch_InsertTrendline() @@ -420,14 +387,12 @@ void ChartController::executeDispatch_InsertTrendline() ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE ))), m_xUndoManager ); - // add a linear curve uno::Reference< chart2::XRegressionCurve > xCurve = RegressionCurveHelper::addRegressionCurve( RegressionCurveHelper::REGRESSION_TYPE_LINEAR, xRegressionCurveContainer, m_xCC ); - // get an appropriate item converter uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY ); if( !xProperties.is()) |