diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-03-11 12:39:12 +0000 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-03-23 02:55:29 +0100 |
commit | 7d42654aa4e00b02940d2fcf60c2d803fc371556 (patch) | |
tree | b3df8056281b4272e57dc645bb46e6f11051ba79 /chart2/source/controller | |
parent | Create respective error bars in areachart when creating shapes. (diff) | |
download | core-7d42654aa4e00b02940d2fcf60c2d803fc371556.tar.gz core-7d42654aa4e00b02940d2fcf60c2d803fc371556.zip |
Merge InsertMenu_YErrorBar and InsertYErrorBar commands in chart controller.
Diffstat (limited to 'chart2/source/controller')
-rw-r--r-- | chart2/source/controller/main/ChartController.cxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController.hxx | 1 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Insert.cxx | 100 |
3 files changed, 48 insertions, 55 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index e9b4aba3f5ac..3a18968f6243 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -1112,7 +1112,7 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) else if( aCommand.equals("InsertMenuMeanValues")) this->executeDispatch_InsertMenu_MeanValues(); else if( aCommand.equals("InsertMenuYErrorBars")) - this->executeDispatch_InsertMenu_YErrorBars(); + this->executeDispatch_InsertYErrorBars(); else if( aCommand.equals("InsertSymbol")) this->executeDispatch_InsertSpecialCharacter(); else if( aCommand.equals("InsertTrendline")) diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index 72e13fac33ad..a1b80bd4e221 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -623,7 +623,6 @@ private: void executeDispatch_InsertGrid(); void executeDispatch_InsertMenu_DataLabels(); - void executeDispatch_InsertMenu_YErrorBars(); void executeDispatch_InsertMenu_Trendlines(); void executeDispatch_InsertMenu_MeanValues(); diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 0a2b674ce034..a30d6d44146d 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -338,58 +338,6 @@ void ChartController::executeDispatch_InsertMenu_DataLabels() } } -void ChartController::executeDispatch_InsertMenu_YErrorBars() -{ - //if a series is selected insert error bars for that series only: - uno::Reference< chart2::XDataSeries > xSeries( - ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); - if( xSeries.is()) - { - executeDispatch_InsertYErrorBars(); - return; - } - - //if no series is selected insert error bars for all series - UndoGuard aUndoGuard( - ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) ), - m_xUndoManager ); - - try - { - wrapper::AllSeriesStatisticsConverter aItemConverter( - getModel(), m_pDrawModelWrapper->GetItemPool() ); - SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet(); - aItemConverter.FillItemSet( aItemSet ); - - //prepare and open dialog - SolarMutexGuard aGuard; - InsertErrorBarsDialog aDlg( - m_pChartWindow, aItemSet, - uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ), - ErrorBarResources::ERROR_BAR_Y); - - aDlg.SetAxisMinorStepWidthForErrorBarDecimals( - InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, rtl::OUString() ) ); - - if( aDlg.Execute() == RET_OK ) - { - SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet(); - aDlg.FillItemSet( aOutItemSet ); - - // 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 ); - } -} - void ChartController::executeDispatch_InsertMeanValue() { UndoGuard aUndoGuard( @@ -526,8 +474,10 @@ void ChartController::executeDispatch_InsertTrendline() void ChartController::executeDispatch_InsertYErrorBars() { + //if a series is selected insert error bars for that series only: uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); + if( xSeries.is()) { UndoLiveUpdateGuard aUndoGuard( @@ -557,7 +507,8 @@ void ChartController::executeDispatch_InsertYErrorBars() SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider, uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY )); aDlg.SetAxisMinorStepWidthForErrorBarDecimals( - InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, m_aSelection.getSelectedCID())); + InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), + m_xChartView, m_aSelection.getSelectedCID())); // note: when a user pressed "OK" but didn't change any settings in the // dialog, the SfxTabDialog returns "Cancel" @@ -572,6 +523,49 @@ void ChartController::executeDispatch_InsertYErrorBars() aUndoGuard.commit(); } } + else + { + //if no series is selected insert error bars for all series + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::INSERT, + ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) ), + m_xUndoManager ); + + try + { + wrapper::AllSeriesStatisticsConverter aItemConverter( + getModel(), m_pDrawModelWrapper->GetItemPool() ); + SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet(); + aItemConverter.FillItemSet( aItemSet ); + + //prepare and open dialog + SolarMutexGuard aGuard; + InsertErrorBarsDialog aDlg( + m_pChartWindow, aItemSet, + uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ), + ErrorBarResources::ERROR_BAR_Y); + + aDlg.SetAxisMinorStepWidthForErrorBarDecimals( + InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, rtl::OUString() ) ); + + if( aDlg.Execute() == RET_OK ) + { + SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet(); + aDlg.FillItemSet( aOutItemSet ); + + // 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 ); + } + } } void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 ) |