Kaydet (Commit) 7d42654a authored tarafından Rafael Dominguez's avatar Rafael Dominguez Kaydeden (comit) Markus Mohrhard

Merge InsertMenu_YErrorBar and InsertYErrorBar commands in chart controller.

üst 68e482e9
...@@ -1112,7 +1112,7 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) ...@@ -1112,7 +1112,7 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand )
else if( aCommand.equals("InsertMenuMeanValues")) else if( aCommand.equals("InsertMenuMeanValues"))
this->executeDispatch_InsertMenu_MeanValues(); this->executeDispatch_InsertMenu_MeanValues();
else if( aCommand.equals("InsertMenuYErrorBars")) else if( aCommand.equals("InsertMenuYErrorBars"))
this->executeDispatch_InsertMenu_YErrorBars(); this->executeDispatch_InsertYErrorBars();
else if( aCommand.equals("InsertSymbol")) else if( aCommand.equals("InsertSymbol"))
this->executeDispatch_InsertSpecialCharacter(); this->executeDispatch_InsertSpecialCharacter();
else if( aCommand.equals("InsertTrendline")) else if( aCommand.equals("InsertTrendline"))
......
...@@ -623,7 +623,6 @@ private: ...@@ -623,7 +623,6 @@ private:
void executeDispatch_InsertGrid(); void executeDispatch_InsertGrid();
void executeDispatch_InsertMenu_DataLabels(); void executeDispatch_InsertMenu_DataLabels();
void executeDispatch_InsertMenu_YErrorBars();
void executeDispatch_InsertMenu_Trendlines(); void executeDispatch_InsertMenu_Trendlines();
void executeDispatch_InsertMenu_MeanValues(); void executeDispatch_InsertMenu_MeanValues();
......
...@@ -338,58 +338,6 @@ void ChartController::executeDispatch_InsertMenu_DataLabels() ...@@ -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() void ChartController::executeDispatch_InsertMeanValue()
{ {
UndoGuard aUndoGuard( UndoGuard aUndoGuard(
...@@ -526,8 +474,10 @@ void ChartController::executeDispatch_InsertTrendline() ...@@ -526,8 +474,10 @@ void ChartController::executeDispatch_InsertTrendline()
void ChartController::executeDispatch_InsertYErrorBars() void ChartController::executeDispatch_InsertYErrorBars()
{ {
//if a series is selected insert error bars for that series only:
uno::Reference< chart2::XDataSeries > xSeries( uno::Reference< chart2::XDataSeries > xSeries(
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
if( xSeries.is()) if( xSeries.is())
{ {
UndoLiveUpdateGuard aUndoGuard( UndoLiveUpdateGuard aUndoGuard(
...@@ -557,7 +507,8 @@ void ChartController::executeDispatch_InsertYErrorBars() ...@@ -557,7 +507,8 @@ void ChartController::executeDispatch_InsertYErrorBars()
SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider, SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY )); uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ));
aDlg.SetAxisMinorStepWidthForErrorBarDecimals( 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 // note: when a user pressed "OK" but didn't change any settings in the
// dialog, the SfxTabDialog returns "Cancel" // dialog, the SfxTabDialog returns "Cancel"
...@@ -572,6 +523,49 @@ void ChartController::executeDispatch_InsertYErrorBars() ...@@ -572,6 +523,49 @@ void ChartController::executeDispatch_InsertYErrorBars()
aUndoGuard.commit(); 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 ) void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 )
......
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