diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-18 14:08:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-19 11:01:18 +0200 |
commit | 9df2821e61979dab32390d5c64dd49bee868adbb (patch) | |
tree | 5b827e29e73ac2300c164b0a389a784a358956e6 /chart2/source/controller/main/UndoCommandDispatch.cxx | |
parent | 8b0a69498b025e13d9772689e9e4fa3d6b05e609 (diff) |
loplugin:flatten in chart2
Change-Id: Iadc4da6515a7d82e7a92b33d74d589b61fa2c64f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92480
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/controller/main/UndoCommandDispatch.cxx')
-rw-r--r-- | chart2/source/controller/main/UndoCommandDispatch.cxx | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/chart2/source/controller/main/UndoCommandDispatch.cxx b/chart2/source/controller/main/UndoCommandDispatch.cxx index afa76424abd8..6cb42ff88f61 100644 --- a/chart2/source/controller/main/UndoCommandDispatch.cxx +++ b/chart2/source/controller/main/UndoCommandDispatch.cxx @@ -61,27 +61,27 @@ void UndoCommandDispatch::fireStatusEvent( const OUString & rURL, const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ ) { - if( m_xUndoManager.is() ) - { - const bool bFireAll = rURL.isEmpty(); - uno::Any aUndoState, aRedoState, aUndoStrings, aRedoStrings; - if( m_xUndoManager->isUndoPossible()) - aUndoState <<= SvtResId( STR_UNDO ) + m_xUndoManager->getCurrentUndoActionTitle(); - if( m_xUndoManager->isRedoPossible()) - aRedoState <<= SvtResId( STR_REDO ) + m_xUndoManager->getCurrentRedoActionTitle(); - - aUndoStrings <<= m_xUndoManager->getAllUndoActionTitles(); - aRedoStrings <<= m_xUndoManager->getAllRedoActionTitles(); - - if( bFireAll || rURL == ".uno:Undo" ) - fireStatusEventForURL( ".uno:Undo", aUndoState, m_xUndoManager->isUndoPossible(), xSingleListener ); - if( bFireAll || rURL == ".uno:Redo" ) - fireStatusEventForURL( ".uno:Redo", aRedoState, m_xUndoManager->isRedoPossible(), xSingleListener ); - if( bFireAll || rURL == ".uno:GetUndoStrings" ) - fireStatusEventForURL( ".uno:GetUndoStrings", aUndoStrings, true, xSingleListener ); - if( bFireAll || rURL == ".uno:GetRedoStrings" ) - fireStatusEventForURL( ".uno:GetRedoStrings", aRedoStrings, true, xSingleListener ); - } + if( !m_xUndoManager.is() ) + return; + + const bool bFireAll = rURL.isEmpty(); + uno::Any aUndoState, aRedoState, aUndoStrings, aRedoStrings; + if( m_xUndoManager->isUndoPossible()) + aUndoState <<= SvtResId( STR_UNDO ) + m_xUndoManager->getCurrentUndoActionTitle(); + if( m_xUndoManager->isRedoPossible()) + aRedoState <<= SvtResId( STR_REDO ) + m_xUndoManager->getCurrentRedoActionTitle(); + + aUndoStrings <<= m_xUndoManager->getAllUndoActionTitles(); + aRedoStrings <<= m_xUndoManager->getAllRedoActionTitles(); + + if( bFireAll || rURL == ".uno:Undo" ) + fireStatusEventForURL( ".uno:Undo", aUndoState, m_xUndoManager->isUndoPossible(), xSingleListener ); + if( bFireAll || rURL == ".uno:Redo" ) + fireStatusEventForURL( ".uno:Redo", aRedoState, m_xUndoManager->isRedoPossible(), xSingleListener ); + if( bFireAll || rURL == ".uno:GetUndoStrings" ) + fireStatusEventForURL( ".uno:GetUndoStrings", aUndoStrings, true, xSingleListener ); + if( bFireAll || rURL == ".uno:GetRedoStrings" ) + fireStatusEventForURL( ".uno:GetRedoStrings", aRedoStrings, true, xSingleListener ); } // ____ XDispatch ____ @@ -89,34 +89,34 @@ void SAL_CALL UndoCommandDispatch::dispatch( const util::URL& URL, const Sequence< beans::PropertyValue >& Arguments ) { - if( m_xUndoManager.is() ) + if( !m_xUndoManager.is() ) + return; + + // why is it necessary to lock the solar mutex here? + SolarMutexGuard aSolarGuard; + try { - // why is it necessary to lock the solar mutex here? - SolarMutexGuard aSolarGuard; - try - { - sal_Int16 nCount( 1 ); - if ( Arguments.hasElements() && Arguments[0].Name == URL.Path ) - Arguments[0].Value >>= nCount; - - while ( nCount-- ) - { - if ( URL.Path == "Undo" ) - m_xUndoManager->undo(); - else - m_xUndoManager->redo(); - } - } - catch( const document::UndoFailedException& ) - { - // silently ignore - } - catch( const uno::Exception& ) + sal_Int16 nCount( 1 ); + if ( Arguments.hasElements() && Arguments[0].Name == URL.Path ) + Arguments[0].Value >>= nCount; + + while ( nCount-- ) { - DBG_UNHANDLED_EXCEPTION("chart2"); + if ( URL.Path == "Undo" ) + m_xUndoManager->undo(); + else + m_xUndoManager->redo(); } - // \-- } + catch( const document::UndoFailedException& ) + { + // silently ignore + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION("chart2"); + } + // \-- } // ____ WeakComponentImplHelperBase ____ |