diff options
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/undo/undo.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index dac5dc3d37dc..d27de22e266e 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -830,11 +830,30 @@ size_t SfxUndoManager::ImplGetRedoActionCount_Lock( bool const i_currentLevel ) //------------------------------------------------------------------------ +SfxUndoAction* SfxUndoManager::GetRedoAction( size_t nNo, bool const i_currentLevel ) const +{ + UndoManagerGuard aGuard( *m_pData ); + + const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray; + if ( (pUndoArray->nCurUndoAction + nNo) > pUndoArray->aUndoActions.size() ) + { + return NULL; + } + return pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction; +} + +//------------------------------------------------------------------------ + OUString SfxUndoManager::GetRedoActionComment( size_t nNo, bool const i_currentLevel ) const { + String sComment; UndoManagerGuard aGuard( *m_pData ); const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray; - return pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction->GetComment(); + if ( (pUndoArray->nCurUndoAction + nNo) < pUndoArray->aUndoActions.size() ) + { + sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction->GetComment(); + } + return sComment; } //------------------------------------------------------------------------ |