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: undobase.hxx,v $
10 * $Revision: 1.6.128.1 $
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 SC_UNDOBASE_HXX
32 #define SC_UNDOBASE_HXX
34 #include <svtools/undo.hxx>
36 #include "address.hxx"
44 //----------------------------------------------------------------------------
46 class ScSimpleUndo
: public SfxUndoAction
50 ScSimpleUndo( ScDocShell
* pDocSh
);
51 virtual ~ScSimpleUndo();
53 virtual BOOL
Merge( SfxUndoAction
*pNextAction
);
56 ScDocShell
* pDocShell
;
57 SfxUndoAction
* pDetectiveUndo
;
64 static void ShowTable( SCTAB nTab
);
65 static void ShowTable( const ScRange
& rRange
);
68 //----------------------------------------------------------------------------
70 enum ScBlockUndoMode
{ SC_UNDO_SIMPLE
, SC_UNDO_MANUALHEIGHT
, SC_UNDO_AUTOHEIGHT
};
72 class ScBlockUndo
: public ScSimpleUndo
76 ScBlockUndo( ScDocShell
* pDocSh
, const ScRange
& rRange
,
77 ScBlockUndoMode eBlockMode
);
78 virtual ~ScBlockUndo();
82 SdrUndoAction
* pDrawUndo
;
83 ScBlockUndoMode eMode
;
94 //----------------------------------------------------------------------------
96 // for functions that act on a database range - takes care of the unnamed database range
97 // (collected separately, before the undo action, for showing dialogs etc.)
99 class ScDBFuncUndo
: public ScSimpleUndo
101 ScDBData
* pAutoDBRange
;
102 ScRange aOriginalRange
;
103 SdrUndoAction
* mpDrawUndo
;
107 ScDBFuncUndo( ScDocShell
* pDocSh
, const ScRange
& rOriginal
, SdrUndoAction
* pDrawUndo
= 0 );
108 virtual ~ScDBFuncUndo();
110 void SetDrawUndoAction( SdrUndoAction
* pDrawUndo
);
118 //----------------------------------------------------------------------------
120 enum ScMoveUndoMode
{ SC_UNDO_REFFIRST
, SC_UNDO_REFLAST
};
122 class ScMoveUndo
: public ScSimpleUndo
// mit Referenzen
126 ScMoveUndo( ScDocShell
* pDocSh
,
127 ScDocument
* pRefDoc
, ScRefUndoData
* pRefData
,
128 ScMoveUndoMode eRefMode
);
129 virtual ~ScMoveUndo();
132 SdrUndoAction
* pDrawUndo
;
133 ScDocument
* pRefUndoDoc
;
134 ScRefUndoData
* pRefUndoData
;
135 ScMoveUndoMode eMode
;
146 //----------------------------------------------------------------------------
148 class ScUndoWrapper
: public SfxUndoAction
// for manual merging of actions
150 SfxUndoAction
* pWrappedUndo
;
154 ScUndoWrapper( SfxUndoAction
* pUndo
);
155 virtual ~ScUndoWrapper();
157 SfxUndoAction
* GetWrappedUndo() { return pWrappedUndo
; }
158 void ForgetWrappedUndo();
160 virtual BOOL
IsLinked();
161 virtual void SetLinked( BOOL bIsLinked
);
164 virtual void Repeat(SfxRepeatTarget
& rTarget
);
165 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
166 virtual BOOL
Merge( SfxUndoAction
*pNextAction
);
167 virtual String
GetComment() const;
168 virtual String
GetRepeatComment(SfxRepeatTarget
&) const;
169 virtual USHORT
GetId() const;