merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / inc / undobase.hxx
blob7e163b7114d22520257cc224e6d87f947a492796
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>
35 #include "global.hxx"
36 #include "address.hxx"
38 class ScDocument;
39 class ScDocShell;
40 class SdrUndoAction;
41 class ScRefUndoData;
42 class ScDBData;
44 //----------------------------------------------------------------------------
46 class ScSimpleUndo: public SfxUndoAction
48 public:
49 TYPEINFO();
50 ScSimpleUndo( ScDocShell* pDocSh );
51 virtual ~ScSimpleUndo();
53 virtual BOOL Merge( SfxUndoAction *pNextAction );
55 protected:
56 ScDocShell* pDocShell;
57 SfxUndoAction* pDetectiveUndo;
59 void BeginUndo();
60 void EndUndo();
61 void BeginRedo();
62 void EndRedo();
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
74 public:
75 TYPEINFO();
76 ScBlockUndo( ScDocShell* pDocSh, const ScRange& rRange,
77 ScBlockUndoMode eBlockMode );
78 virtual ~ScBlockUndo();
80 protected:
81 ScRange aBlockRange;
82 SdrUndoAction* pDrawUndo;
83 ScBlockUndoMode eMode;
85 void BeginUndo();
86 void EndUndo();
87 // void BeginRedo();
88 void EndRedo();
90 BOOL AdjustHeight();
91 void ShowBlock();
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;
105 public:
106 TYPEINFO();
107 ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal, SdrUndoAction* pDrawUndo = 0 );
108 virtual ~ScDBFuncUndo();
110 void SetDrawUndoAction( SdrUndoAction* pDrawUndo );
112 void BeginUndo();
113 void EndUndo();
114 void BeginRedo();
115 void EndRedo();
118 //----------------------------------------------------------------------------
120 enum ScMoveUndoMode { SC_UNDO_REFFIRST, SC_UNDO_REFLAST };
122 class ScMoveUndo: public ScSimpleUndo // mit Referenzen
124 public:
125 TYPEINFO();
126 ScMoveUndo( ScDocShell* pDocSh,
127 ScDocument* pRefDoc, ScRefUndoData* pRefData,
128 ScMoveUndoMode eRefMode );
129 virtual ~ScMoveUndo();
131 protected:
132 SdrUndoAction* pDrawUndo;
133 ScDocument* pRefUndoDoc;
134 ScRefUndoData* pRefUndoData;
135 ScMoveUndoMode eMode;
137 void BeginUndo();
138 void EndUndo();
139 // void BeginRedo();
140 // void EndRedo();
142 private:
143 void UndoRef();
146 //----------------------------------------------------------------------------
148 class ScUndoWrapper: public SfxUndoAction // for manual merging of actions
150 SfxUndoAction* pWrappedUndo;
152 public:
153 TYPEINFO();
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 );
162 virtual void Undo();
163 virtual void Redo();
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;
173 #endif