xref: /aoo42x/main/sd/source/core/undo/undomanager.cxx (revision 69ffbee1)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
105b190011SAndrew Rist  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
195b190011SAndrew Rist  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26*69ffbee1SArmin Le Grand 
27cdf0e10cSrcweir #include <tools/debug.hxx>
28*69ffbee1SArmin Le Grand #include <undo/undomanager.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir using namespace sd;
31cdf0e10cSrcweir 
UndoManager(sal_uInt16 nMaxUndoActionCount)32cdf0e10cSrcweir UndoManager::UndoManager( sal_uInt16 nMaxUndoActionCount /* = 20 */ )
33*69ffbee1SArmin Le Grand : SdrUndoManager( nMaxUndoActionCount )
34cdf0e10cSrcweir , mpLinkedUndoManager(NULL)
35cdf0e10cSrcweir {
36cdf0e10cSrcweir }
37cdf0e10cSrcweir 
EnterListAction(const UniString & rComment,const UniString & rRepeatComment,sal_uInt16 nId)38cdf0e10cSrcweir void UndoManager::EnterListAction(const UniString &rComment, const UniString& rRepeatComment, sal_uInt16 nId /* =0 */)
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 	if( !IsDoing() )
41cdf0e10cSrcweir 	{
42cdf0e10cSrcweir         ClearLinkedRedoActions();
43*69ffbee1SArmin Le Grand 		SdrUndoManager::EnterListAction( rComment, rRepeatComment, nId );
44cdf0e10cSrcweir 	}
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
AddUndoAction(SfxUndoAction * pAction,sal_Bool bTryMerg)47cdf0e10cSrcweir void UndoManager::AddUndoAction( SfxUndoAction *pAction, sal_Bool bTryMerg /* = sal_False */ )
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 	if( !IsDoing() )
50cdf0e10cSrcweir 	{
51cdf0e10cSrcweir         ClearLinkedRedoActions();
52*69ffbee1SArmin Le Grand 		SdrUndoManager::AddUndoAction( pAction, bTryMerg );
53cdf0e10cSrcweir 	}
54cdf0e10cSrcweir 	else
55cdf0e10cSrcweir 	{
56cdf0e10cSrcweir 		delete pAction;
57cdf0e10cSrcweir 	}
58cdf0e10cSrcweir }
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
SetLinkedUndoManager(::svl::IUndoManager * pLinkedUndoManager)61cdf0e10cSrcweir void UndoManager::SetLinkedUndoManager (::svl::IUndoManager* pLinkedUndoManager)
62cdf0e10cSrcweir {
63cdf0e10cSrcweir     mpLinkedUndoManager = pLinkedUndoManager;
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
ClearLinkedRedoActions(void)69cdf0e10cSrcweir void UndoManager::ClearLinkedRedoActions (void)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir     if (mpLinkedUndoManager != NULL)
72cdf0e10cSrcweir         mpLinkedUndoManager->ClearRedo();
73cdf0e10cSrcweir }
74