summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svl/inc/svl/undo.hxx68
-rw-r--r--svl/source/undo/undo.cxx64
2 files changed, 66 insertions, 66 deletions
diff --git a/svl/inc/svl/undo.hxx b/svl/inc/svl/undo.hxx
index f5c530195b07..cfa3e6155862 100644
--- a/svl/inc/svl/undo.hxx
+++ b/svl/inc/svl/undo.hxx
@@ -128,7 +128,7 @@ public:
m_aActions.erase( m_aActions.begin() + i_pos, m_aActions.begin() + i_pos + i_count );
}
- void Insert( SfxUndoAction* i_action, USHORT i_pos )
+ void Insert( SfxUndoAction* i_action, size_t i_pos )
{
m_aActions.insert( m_aActions.begin() + i_pos, MarkedUndoAction( i_action ) );
}
@@ -141,10 +141,10 @@ public:
struct SVL_DLLPUBLIC SfxUndoArray
{
SfxUndoActions aUndoActions;
- USHORT nMaxUndoActions;
- USHORT nCurUndoAction;
+ size_t nMaxUndoActions;
+ size_t nCurUndoAction;
SfxUndoArray *pFatherUndoArray;
- SfxUndoArray(USHORT nMax=0):
+ SfxUndoArray(size_t nMax=0):
nMaxUndoActions(nMax), nCurUndoAction(0),
pFatherUndoArray(0) {}
~SfxUndoArray();
@@ -181,8 +181,8 @@ class SVL_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArra
virtual BOOL Merge( SfxUndoAction *pNextAction );
- virtual UniString GetComment() const;
- virtual UniString GetRepeatComment(SfxRepeatTarget&) const;
+ virtual UniString GetComment() const;
+ virtual UniString GetRepeatComment(SfxRepeatTarget&) const;
virtual USHORT GetId() const;
void SetComment( const UniString& rComment );
@@ -230,18 +230,18 @@ namespace svl
virtual ~IUndoManager() { };
- virtual void SetMaxUndoActionCount( USHORT nMaxUndoActionCount ) = 0;
- virtual USHORT GetMaxUndoActionCount() const = 0;
+ virtual void SetMaxUndoActionCount( size_t nMaxUndoActionCount ) = 0;
+ virtual size_t GetMaxUndoActionCount() const = 0;
virtual void AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg=FALSE ) = 0;
- virtual USHORT GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const = 0;
virtual USHORT GetUndoActionId() const = 0;
- virtual UniString GetUndoActionComment( USHORT nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
- virtual SfxUndoAction* GetUndoAction( USHORT nNo=0 ) const = 0;
+ virtual UniString GetUndoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual SfxUndoAction* GetUndoAction( size_t nNo=0 ) const = 0;
- virtual USHORT GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const = 0;
- virtual UniString GetRedoActionComment( USHORT nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual size_t GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual UniString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
virtual BOOL Undo() = 0;
virtual BOOL Redo() = 0;
@@ -271,7 +271,7 @@ namespace svl
*/
virtual bool IsDoing() const = 0;
- virtual USHORT GetRepeatActionCount() const = 0;
+ virtual size_t GetRepeatActionCount() const = 0;
virtual UniString GetRepeatActionComment( SfxRepeatTarget &rTarget) const = 0;
virtual BOOL Repeat( SfxRepeatTarget &rTarget ) = 0;
virtual BOOL CanRepeat( SfxRepeatTarget &rTarget ) const = 0;
@@ -282,7 +282,7 @@ namespace svl
@return the number of the sub actions in the list which has just been left. Note that in case no such
actions exist, the list action does not contribute to the Undo stack, but is silently removed.
*/
- virtual USHORT LeaveListAction() = 0;
+ virtual size_t LeaveListAction() = 0;
/** leaves the list action entered with EnterListAction, and forcefully merges the previous
action on the stack into the newly created list action.
@@ -299,13 +299,13 @@ namespace svl
@return the number of the sub actions in the list which has just been left. Note that in case no such
actions exist, the list action does not contribute to the Undo stack, but is silently removed.
*/
- virtual USHORT LeaveAndMergeListAction() = 0;
+ virtual size_t LeaveAndMergeListAction() = 0;
/// determines whether we're within a ListAction context, i.e. a LeaveListAction/LeaveAndMergeListAction call is pending
virtual bool IsInListAction() const = 0;
/// determines how many nested list actions are currently open
- virtual USHORT GetListActionDepth() const = 0;
+ virtual size_t GetListActionDepth() const = 0;
/** clears the redo stack and removes the top undo action */
virtual void RemoveLastUndoAction() = 0;
@@ -342,34 +342,34 @@ class SVL_DLLPUBLIC SfxUndoManager : public ::svl::IUndoManager
::boost::scoped_ptr< SfxUndoManager_Data >
m_pData;
public:
- SfxUndoManager( USHORT nMaxUndoActionCount = 20 );
+ SfxUndoManager( size_t nMaxUndoActionCount = 20 );
virtual ~SfxUndoManager();
// IUndoManager overridables
- virtual void SetMaxUndoActionCount( USHORT nMaxUndoActionCount );
- virtual USHORT GetMaxUndoActionCount() const;
+ virtual void SetMaxUndoActionCount( size_t nMaxUndoActionCount );
+ virtual size_t GetMaxUndoActionCount() const;
virtual void AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg=FALSE );
- virtual USHORT GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const;
+ virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const;
virtual USHORT GetUndoActionId() const;
- virtual UniString GetUndoActionComment( USHORT nNo=0, bool const i_currentLevel = CurrentLevel ) const;
- virtual SfxUndoAction* GetUndoAction( USHORT nNo=0 ) const;
- virtual USHORT GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const;
- virtual UniString GetRedoActionComment( USHORT nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ virtual UniString GetUndoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ virtual SfxUndoAction* GetUndoAction( size_t nNo=0 ) const;
+ virtual size_t GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const;
+ virtual UniString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
virtual BOOL Undo();
virtual BOOL Redo();
virtual void Clear();
virtual void ClearRedo();
virtual void Reset();
virtual bool IsDoing() const;
- virtual USHORT GetRepeatActionCount() const;
+ virtual size_t GetRepeatActionCount() const;
virtual UniString GetRepeatActionComment( SfxRepeatTarget &rTarget) const;
virtual BOOL Repeat( SfxRepeatTarget &rTarget );
virtual BOOL CanRepeat( SfxRepeatTarget &rTarget ) const;
virtual void EnterListAction(const UniString &rComment, const UniString& rRepeatComment, USHORT nId=0);
- virtual USHORT LeaveListAction();
- virtual USHORT LeaveAndMergeListAction();
+ virtual size_t LeaveListAction();
+ virtual size_t LeaveAndMergeListAction();
virtual bool IsInListAction() const;
- virtual USHORT GetListActionDepth() const;
+ virtual size_t GetListActionDepth() const;
virtual void RemoveLastUndoAction();
virtual void EnableUndo( bool bEnable );
virtual bool IsUndoEnabled() const;
@@ -392,7 +392,7 @@ public:
/** removes the oldest Undo actions from the stack
*/
- void RemoveOldestUndoActions( USHORT const i_count );
+ void RemoveOldestUndoActions( size_t const i_count );
protected:
BOOL UndoWithContext( SfxUndoContext& i_context );
@@ -401,12 +401,12 @@ protected:
void ImplClearRedo_NoLock( bool const i_currentLevel );
private:
- USHORT ImplLeaveListAction( const bool i_merge, ::svl::undo::impl::UndoManagerGuard& i_guard );
+ size_t ImplLeaveListAction( const bool i_merge, ::svl::undo::impl::UndoManagerGuard& i_guard );
bool ImplAddUndoAction_NoNotify( SfxUndoAction* pAction, bool bTryMerge, bool bClearRedo, ::svl::undo::impl::UndoManagerGuard& i_guard );
void ImplClearRedo( ::svl::undo::impl::UndoManagerGuard& i_guard, bool const i_currentLevel );
void ImplClearUndo( ::svl::undo::impl::UndoManagerGuard& i_guard );
void ImplClear( ::svl::undo::impl::UndoManagerGuard& i_guard );
- USHORT ImplGetRedoActionCount_Lock( bool const i_currentLevel = CurrentLevel ) const;
+ size_t ImplGetRedoActionCount_Lock( bool const i_currentLevel = CurrentLevel ) const;
bool ImplIsUndoEnabled_Lock() const;
bool ImplIsInListAction_Lock() const;
void ImplEnableUndo_Lock( bool const i_enable );
@@ -447,8 +447,8 @@ public:
virtual void Repeat(SfxRepeatTarget&r);
- virtual UniString GetComment() const;
- virtual UniString GetRepeatComment(SfxRepeatTarget&r) const;
+ virtual UniString GetComment() const;
+ virtual UniString GetRepeatComment(SfxRepeatTarget&r) const;
virtual USHORT GetId() const;
SfxUndoAction* GetAction() const { return pAction; }
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 33cc63035fad..6c527a928ac6 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -193,7 +193,7 @@ struct SVL_DLLPRIVATE SfxUndoManager_Data
UndoListeners aListeners;
- SfxUndoManager_Data( USHORT i_nMaxUndoActionCount )
+ SfxUndoManager_Data( size_t i_nMaxUndoActionCount )
:pUndoArray( new SfxUndoArray( i_nMaxUndoActionCount ) )
,pActUndoArray( NULL )
,pFatherUndoArray( NULL )
@@ -388,7 +388,7 @@ using namespace ::svl::undo::impl;
//========================================================================
-SfxUndoManager::SfxUndoManager( USHORT nMaxUndoActionCount )
+SfxUndoManager::SfxUndoManager( size_t nMaxUndoActionCount )
:m_pData( new SfxUndoManager_Data( nMaxUndoActionCount ) )
{
}
@@ -447,7 +447,7 @@ bool SfxUndoManager::ImplIsUndoEnabled_Lock() const
//------------------------------------------------------------------------
-void SfxUndoManager::SetMaxUndoActionCount( USHORT nMaxUndoActionCount )
+void SfxUndoManager::SetMaxUndoActionCount( size_t nMaxUndoActionCount )
{
UndoManagerGuard aGuard( *m_pData );
@@ -492,7 +492,7 @@ void SfxUndoManager::SetMaxUndoActionCount( USHORT nMaxUndoActionCount )
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetMaxUndoActionCount() const
+size_t SfxUndoManager::GetMaxUndoActionCount() const
{
UndoManagerGuard aGuard( *m_pData );
return m_pData->pActUndoArray->nMaxUndoActions;
@@ -661,7 +661,7 @@ void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerge )
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetUndoActionCount( bool const i_currentLevel ) const
+size_t SfxUndoManager::GetUndoActionCount( bool const i_currentLevel ) const
{
UndoManagerGuard aGuard( *m_pData );
const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
@@ -670,7 +670,7 @@ USHORT SfxUndoManager::GetUndoActionCount( bool const i_currentLevel ) const
//------------------------------------------------------------------------
-XubString SfxUndoManager::GetUndoActionComment( USHORT nNo, bool const i_currentLevel ) const
+XubString SfxUndoManager::GetUndoActionComment( size_t nNo, bool const i_currentLevel ) const
{
UndoManagerGuard aGuard( *m_pData );
@@ -698,7 +698,7 @@ USHORT SfxUndoManager::GetUndoActionId() const
//------------------------------------------------------------------------
-SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const
+SfxUndoAction* SfxUndoManager::GetUndoAction( size_t nNo ) const
{
UndoManagerGuard aGuard( *m_pData );
@@ -793,7 +793,7 @@ BOOL SfxUndoManager::ImplUndo( SfxUndoContext* i_contextOrNull )
// in theory, somebody might have tampered with all of *m_pData while the mutex was unlocked. So, see if
// we still find pAction in our current Undo array
- USHORT nCurAction = 0;
+ size_t nCurAction = 0;
while ( nCurAction < m_pData->pActUndoArray->aUndoActions.size() )
{
if ( m_pData->pActUndoArray->aUndoActions[ nCurAction++ ].pAction == pAction )
@@ -815,7 +815,7 @@ BOOL SfxUndoManager::ImplUndo( SfxUndoContext* i_contextOrNull )
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetRedoActionCount( bool const i_currentLevel ) const
+size_t SfxUndoManager::GetRedoActionCount( bool const i_currentLevel ) const
{
UndoManagerGuard aGuard( *m_pData );
return ImplGetRedoActionCount_Lock( i_currentLevel );
@@ -823,15 +823,15 @@ USHORT SfxUndoManager::GetRedoActionCount( bool const i_currentLevel ) const
//------------------------------------------------------------------------
-USHORT SfxUndoManager::ImplGetRedoActionCount_Lock( bool const i_currentLevel ) const
+size_t SfxUndoManager::ImplGetRedoActionCount_Lock( bool const i_currentLevel ) const
{
const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
- return USHORT( pUndoArray->aUndoActions.size() - pUndoArray->nCurUndoAction );
+ return pUndoArray->aUndoActions.size() - pUndoArray->nCurUndoAction;
}
//------------------------------------------------------------------------
-XubString SfxUndoManager::GetRedoActionComment( USHORT nNo, bool const i_currentLevel ) const
+XubString SfxUndoManager::GetRedoActionComment( size_t nNo, bool const i_currentLevel ) const
{
UndoManagerGuard aGuard( *m_pData );
const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
@@ -893,7 +893,7 @@ BOOL SfxUndoManager::ImplRedo( SfxUndoContext* i_contextOrNull )
// in theory, somebody might have tampered with all of *m_pData while the mutex was unlocked. So, see if
// we still find pAction in our current Undo array
- USHORT nCurAction = 0;
+ size_t nCurAction = 0;
while ( nCurAction < m_pData->pActUndoArray->aUndoActions.size() )
{
if ( m_pData->pActUndoArray->aUndoActions[ nCurAction ].pAction == pAction )
@@ -916,10 +916,10 @@ BOOL SfxUndoManager::ImplRedo( SfxUndoContext* i_contextOrNull )
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetRepeatActionCount() const
+size_t SfxUndoManager::GetRepeatActionCount() const
{
UndoManagerGuard aGuard( *m_pData );
- return USHORT( m_pData->pActUndoArray->aUndoActions.size() );
+ return m_pData->pActUndoArray->aUndoActions.size();
}
//------------------------------------------------------------------------
@@ -1033,10 +1033,10 @@ bool SfxUndoManager::ImplIsInListAction_Lock() const
//------------------------------------------------------------------------
-USHORT SfxUndoManager::GetListActionDepth() const
+size_t SfxUndoManager::GetListActionDepth() const
{
UndoManagerGuard aGuard( *m_pData );
- USHORT nDepth(0);
+ size_t nDepth(0);
SfxUndoArray* pLookup( m_pData->pActUndoArray );
while ( pLookup != m_pData->pUndoArray )
@@ -1050,7 +1050,7 @@ USHORT SfxUndoManager::GetListActionDepth() const
//------------------------------------------------------------------------
-USHORT SfxUndoManager::LeaveListAction()
+size_t SfxUndoManager::LeaveListAction()
{
UndoManagerGuard aGuard( *m_pData );
return ImplLeaveListAction( false, aGuard );
@@ -1058,7 +1058,7 @@ USHORT SfxUndoManager::LeaveListAction()
//------------------------------------------------------------------------
-USHORT SfxUndoManager::LeaveAndMergeListAction()
+size_t SfxUndoManager::LeaveAndMergeListAction()
{
UndoManagerGuard aGuard( *m_pData );
return ImplLeaveListAction( true, aGuard );
@@ -1066,7 +1066,7 @@ USHORT SfxUndoManager::LeaveAndMergeListAction()
//------------------------------------------------------------------------
-USHORT SfxUndoManager::ImplLeaveListAction( const bool i_merge, UndoManagerGuard& i_guard )
+size_t SfxUndoManager::ImplLeaveListAction( const bool i_merge, UndoManagerGuard& i_guard )
{
if ( !ImplIsUndoEnabled_Lock() )
return 0;
@@ -1088,7 +1088,7 @@ USHORT SfxUndoManager::ImplLeaveListAction( const bool i_merge, UndoManagerGuard
m_pData->pActUndoArray = m_pData->pActUndoArray->pFatherUndoArray;
// If no undo actions were added to the list, delete the list action
- const USHORT nListActionElements = pArrayToLeave->nCurUndoAction;
+ const size_t nListActionElements = pArrayToLeave->nCurUndoAction;
if ( nListActionElements == 0 )
{
SfxUndoAction* pCurrentAction= m_pData->pActUndoArray->aUndoActions[ m_pData->pActUndoArray->nCurUndoAction-1 ].pAction;
@@ -1127,7 +1127,7 @@ USHORT SfxUndoManager::ImplLeaveListAction( const bool i_merge, UndoManagerGuard
// if the undo array has no comment, try to get it from its children
if ( pListAction->GetComment().Len() == 0 )
{
- for( USHORT n = 0; n < pListAction->aUndoActions.size(); n++ )
+ for( size_t n = 0; n < pListAction->aUndoActions.size(); n++ )
{
if( pListAction->aUndoActions[n].pAction->GetComment().Len() )
{
@@ -1154,7 +1154,7 @@ UndoStackMark SfxUndoManager::MarkTopUndoAction()
OSL_ENSURE((m_pData->mnMarks + 1) < (m_pData->mnEmptyMark - 1),
"SfxUndoManager::MarkTopUndoAction(): mark overflow!");
- USHORT const nActionPos = m_pData->pUndoArray->nCurUndoAction;
+ size_t const nActionPos = m_pData->pUndoArray->nCurUndoAction;
if (0 == nActionPos)
{
--m_pData->mnEmptyMark;
@@ -1207,7 +1207,7 @@ bool SfxUndoManager::HasTopUndoActionMark( UndoStackMark const i_mark )
{
UndoManagerGuard aGuard( *m_pData );
- USHORT nActionPos = m_pData->pUndoArray->nCurUndoAction;
+ size_t nActionPos = m_pData->pUndoArray->nCurUndoAction;
if ( nActionPos == 0 )
{
return (i_mark == m_pData->mnEmptyMark);
@@ -1229,7 +1229,7 @@ bool SfxUndoManager::HasTopUndoActionMark( UndoStackMark const i_mark )
//------------------------------------------------------------------------
-void SfxUndoManager::RemoveOldestUndoActions( USHORT const i_count )
+void SfxUndoManager::RemoveOldestUndoActions( size_t const i_count )
{
UndoManagerGuard aGuard( *m_pData );
@@ -1317,25 +1317,25 @@ void SfxListUndoAction::UndoWithContext( SfxUndoContext& i_context )
void SfxListUndoAction::Redo()
{
- for(USHORT i=nCurUndoAction;i<aUndoActions.size();i++)
+ for(size_t i=nCurUndoAction;i<aUndoActions.size();i++)
aUndoActions[i].pAction->Redo();
- nCurUndoAction = USHORT( aUndoActions.size() );
+ nCurUndoAction = aUndoActions.size();
}
//------------------------------------------------------------------------
void SfxListUndoAction::RedoWithContext( SfxUndoContext& i_context )
{
- for(USHORT i=nCurUndoAction;i<aUndoActions.size();i++)
+ for(size_t i=nCurUndoAction;i<aUndoActions.size();i++)
aUndoActions[i].pAction->RedoWithContext( i_context );
- nCurUndoAction = USHORT( aUndoActions.size() );
+ nCurUndoAction = aUndoActions.size();
}
//------------------------------------------------------------------------
void SfxListUndoAction::Repeat(SfxRepeatTarget&rTarget)
{
- for(USHORT i=0;i<nCurUndoAction;i++)
+ for(size_t i=0;i<nCurUndoAction;i++)
aUndoActions[i].pAction->Repeat(rTarget);
}
@@ -1343,7 +1343,7 @@ void SfxListUndoAction::Repeat(SfxRepeatTarget&rTarget)
BOOL SfxListUndoAction::CanRepeat(SfxRepeatTarget&r) const
{
- for(USHORT i=0;i<nCurUndoAction;i++)
+ for(size_t i=0;i<nCurUndoAction;i++)
if(!aUndoActions[i].pAction->CanRepeat(r))
return FALSE;
return TRUE;
@@ -1375,7 +1375,7 @@ SfxLinkUndoAction::SfxLinkUndoAction(::svl::IUndoManager *pManager)
// is dirty, too.
if ( pManager->GetMaxUndoActionCount() )
{
- USHORT nPos = pManager->GetUndoActionCount()-1;
+ size_t nPos = pManager->GetUndoActionCount()-1;
pAction = pUndoManagerImplementation->m_pData->pActUndoArray->aUndoActions[nPos].pAction;
pAction->SetLinked();
}