summaryrefslogtreecommitdiff
path: root/svl/source/undo/undo.cxx
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-11-02 13:19:49 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-11-02 13:19:49 +0100
commit861471d1dabd0ba3dfbabe2204a0c37def5dd9ff (patch)
tree5e72c852caaf3851e9162d33485d7f5ce220f469 /svl/source/undo/undo.cxx
parentd2e595727b951c56e41a5872423a8ef95c95e489 (diff)
undoapi: allow retrieving the count/comments of Undo/Redo actions both on the current and the top level
Diffstat (limited to 'svl/source/undo/undo.cxx')
-rw-r--r--svl/source/undo/undo.cxx32
1 files changed, 17 insertions, 15 deletions
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 201e69b49c7a..5c0a4a1d816c 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -399,25 +399,25 @@ void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerge )
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetUndoActionCount() const
+USHORT SfxUndoManager::GetUndoActionCount( bool const i_currentLevel ) const
{
- return m_pData->pActUndoArray->nCurUndoAction;
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
+ return pUndoArray->nCurUndoAction;
}
//------------------------------------------------------------------------
-XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const
+XubString SfxUndoManager::GetUndoActionComment( USHORT nNo, bool const i_currentLevel ) const
{
- DBG_ASSERT( nNo < m_pData->pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoActionComment(), illegal id!" );
- if( nNo < m_pData->pActUndoArray->nCurUndoAction )
- {
- return m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction-1-nNo]->GetComment(); //!
- }
- else
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
+
+ String sComment;
+ DBG_ASSERT( nNo < pUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoActionComment: illegal index!" );
+ if( nNo < pUndoArray->nCurUndoAction )
{
- XubString aEmpty;
- return aEmpty;
+ sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction - 1 - nNo ]->GetComment();
}
+ return sComment;
}
//------------------------------------------------------------------------
@@ -534,16 +534,18 @@ BOOL SfxUndoManager::Undo()
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetRedoActionCount() const
+USHORT SfxUndoManager::GetRedoActionCount( bool const i_currentLevel ) const
{
- return m_pData->pActUndoArray->aUndoActions.Count() - m_pData->pActUndoArray->nCurUndoAction; //!
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
+ return pUndoArray->aUndoActions.Count() - pUndoArray->nCurUndoAction;
}
//------------------------------------------------------------------------
-XubString SfxUndoManager::GetRedoActionComment( USHORT nNo ) const
+XubString SfxUndoManager::GetRedoActionComment( USHORT nNo, bool const i_currentLevel ) const
{
- return m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction+nNo]->GetComment(); //!
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
+ return pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ]->GetComment();
}
//------------------------------------------------------------------------