1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: undomanager.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
33 #include <tools/debug.hxx>
34 #include "undo/undomanager.hxx"
38 UndoManager::UndoManager( USHORT nMaxUndoActionCount
/* = 20 */ )
39 : SfxUndoManager( nMaxUndoActionCount
)
41 , mpLinkedUndoManager(NULL
)
45 void UndoManager::EnterListAction(const UniString
&rComment
, const UniString
& rRepeatComment
, USHORT nId
/* =0 */)
49 ClearLinkedRedoActions();
51 SfxUndoManager::EnterListAction( rComment
, rRepeatComment
, nId
);
55 void UndoManager::LeaveListAction()
59 SfxUndoManager::LeaveListAction();
66 DBG_ERROR("sd::UndoManager::LeaveListAction(), no open list action!" );
71 void UndoManager::AddUndoAction( SfxUndoAction
*pAction
, BOOL bTryMerg
/* = FALSE */ )
75 ClearLinkedRedoActions();
76 SfxUndoManager::AddUndoAction( pAction
, bTryMerg
);
85 BOOL
UndoManager::Undo( USHORT nCount
)
87 ScopeLockGuard
aGuard( maIsInUndoLock
);
88 return SfxUndoManager::Undo( nCount
);
91 BOOL
UndoManager::Redo( USHORT nCount
)
93 ScopeLockGuard
aGuard( maIsInUndoLock
);
94 return SfxUndoManager::Redo( nCount
);
100 void UndoManager::SetLinkedUndoManager (SfxUndoManager
* pLinkedUndoManager
)
102 mpLinkedUndoManager
= pLinkedUndoManager
;
108 void UndoManager::ClearLinkedRedoActions (void)
110 if (mpLinkedUndoManager
!= NULL
)
111 mpLinkedUndoManager
->ClearRedo();