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: IDocumentUndoRedo.hxx,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 #ifndef IDOCUMENTUNDOREDO_HXX_INCLUDED
32 #define IDOCUMENTUNDOREDO_HXX_INCLUDED
34 #include <sal/types.h>
46 typedef sal_uInt16 SwUndoNoModifiedPosition
;
50 class IDocumentUndoRedo
55 virtual void SetUndoNoResetModified() = 0;
59 virtual bool IsUndoNoResetModified() const = 0;
61 /** UndoHistory am Dokument pflegen
62 bei Save, SaveAs, Create wird UndoHistory zurueckgesetzt ???
64 virtual void DoUndo(bool bUn
) = 0;
68 virtual bool DoesUndo() const = 0;
70 /** Zusammenfassen von Kontinuierlichen Insert/Delete/Overwrite von
71 Charaktern. Default ist ::com::sun::star::sdbcx::Group-Undo.
73 virtual void DoGroupUndo(bool bUn
) = 0;
77 virtual bool DoesGroupUndo() const = 0;
79 /** macht rueckgaengig:
80 0 letzte Aktion, sonst Aktionen bis zum Start der Klammerung nUndoId
81 In rUndoRange wird der restaurierte Bereich gesetzt.
83 virtual bool Undo( SwUndoIter
& ) = 0; // -> #111827#
87 @param nUndoId undo ID for the start object
88 @param pRewriter rewriter for comments @see SwUndo::GetComment
90 If the given nUndoId is equal to zero an undo object with ID
91 UNDO_START will be generated.
93 @return the undo ID of the created object
95 virtual SwUndoId
StartUndo( SwUndoId eUndoId
, const SwRewriter
* pRewriter
) = 0;
100 @param nUndoId undo ID for the closure object
101 @param pRewriter rewriter for comments @see SwUndo::GetComment
103 If the given nUndoId is equal to zero an undo object with ID
104 UNDO_START will be generated.
106 If pRewriter is not equal to zero the given rewriter will be
107 set for the generated closure object and the corresponding
108 start object. Otherwise an existent rewriter in theIDocumentRedlineAccess
109 corresponding start object will be propagated to the generated
112 virtual SwUndoId
EndUndo( SwUndoId eUndoId
, const SwRewriter
* pRewriter
) = 0;
115 loescht die gesamten UndoObjecte ( fuer Methoden die am Nodes
116 Array drehen ohne entsprechendes Undo !!)
118 virtual void DelAllUndoObj() = 0;
120 /** liefert die Id der letzten undofaehigen Aktion zurueck
121 oder USHRT_MAX fuellt ggf. VARARR mit ::com::sun::star::sdbcx::User-UndoIds
123 virtual SwUndoId
GetUndoIds(String
* pStr
, SwUndoIds
*pUndoIds
) const = 0;
127 virtual String
GetUndoIdsStr(String
* pStr
, SwUndoIds
*pUndoIds
) const = 0;
129 /** gibt es Klammerung mit der Id?
131 virtual bool HasUndoId(SwUndoId eId
) const = 0;
133 /* @@@MAINTAINABILITY-HORROR@@@
134 Implementation details made public.
135 die drei folgenden Methoden werden beim Undo und nur dort
136 benoetigt. Sollten sonst nicht aufgerufen werden.
138 virtual const SwNodes
* GetUndoNds() const = 0;
140 virtual SwUndo
* RemoveLastUndo(SwUndoId eUndoId
) = 0;
142 /** 2002-05-31 dvo, #95884#: To prevent an undo array overflow when
143 doing nested undos, undo may have to be disabled. Undo-intensive
144 actions (like auto-format) should check this manually.
146 virtual bool HasTooManyUndos() const = 0;
150 virtual bool Redo( SwUndoIter
& ) = 0;
152 /** liefert die Id der letzten Redofaehigen Aktion zurueck
153 fuellt ggf. VARARR mit RedoIds
155 virtual SwUndoId
GetRedoIds( String
* pStr
, SwUndoIds
*pRedoIds
) const = 0;
159 virtual String
GetRedoIdsStr( String
* pStr
, SwUndoIds
*pRedoIds
) const = 0;
163 virtual bool Repeat( SwUndoIter
&, sal_uInt16 nRepeatCnt
) = 0;
165 /** liefert die Id der letzten Repeatfaehigen Aktion zurueck
166 fuellt ggf. VARARR mit RedoIds
168 virtual SwUndoId
GetRepeatIds( String
* pStr
, SwUndoIds
*pRedoIds
) const = 0;
172 virtual String
GetRepeatIdsStr( String
* pStr
, SwUndoIds
*pRedoIds
) const = 0;
174 /** interne Verkuerzung fuer Insert am Ende
176 virtual void AppendUndo(SwUndo
*) = 0;
178 /** loescht alle UndoObjecte von nUndoPos
179 bis zum Ende des Undo-Arrays
181 virtual void ClearRedo() = 0;
183 /** Manipulates the position of the undo stack which reset the modified flag
185 virtual void setUndoNoModifiedPosition( SwUndoNoModifiedPosition
) = 0;
187 /** Gets the position of the undo stack which reset the modified flag
189 virtual SwUndoNoModifiedPosition
getUndoNoModifiedPosition() const = 0;
192 virtual ~IDocumentUndoRedo() {};