bump product version to 4.1.6.2
[LibreOffice.git] / sc / source / ui / inc / undobase.hxx
blobc6e6b957d38b697a8ad86465057709a8e115bc80
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_UNDOBASE_HXX
21 #define SC_UNDOBASE_HXX
23 #include <svl/undo.hxx>
24 #include "global.hxx"
25 #include "address.hxx"
26 #include "docsh.hxx"
28 class ScDocument;
29 class ScDocShell;
30 class SdrUndoAction;
31 class ScRefUndoData;
32 class ScDBData;
34 //----------------------------------------------------------------------------
36 class ScSimpleUndo: public SfxUndoAction
38 ScSimpleUndo(const ScSimpleUndo&); // disabled
40 public:
41 TYPEINFO();
42 ScSimpleUndo( ScDocShell* pDocSh );
43 virtual ~ScSimpleUndo();
45 virtual sal_Bool Merge( SfxUndoAction *pNextAction );
47 protected:
48 ScDocShell* pDocShell;
49 SfxUndoAction* pDetectiveUndo;
51 bool IsPaintLocked() const { return pDocShell->IsPaintLocked(); }
53 bool SetViewMarkData( const ScMarkData& rMarkData );
55 void BeginUndo();
56 void EndUndo();
57 void BeginRedo();
58 void EndRedo();
60 static void ShowTable( SCTAB nTab );
61 static void ShowTable( const ScRange& rRange );
64 //----------------------------------------------------------------------------
66 enum ScBlockUndoMode { SC_UNDO_SIMPLE, SC_UNDO_MANUALHEIGHT, SC_UNDO_AUTOHEIGHT };
68 class ScBlockUndo: public ScSimpleUndo
70 public:
71 TYPEINFO();
72 ScBlockUndo( ScDocShell* pDocSh, const ScRange& rRange,
73 ScBlockUndoMode eBlockMode );
74 virtual ~ScBlockUndo();
76 protected:
77 ScRange aBlockRange;
78 SdrUndoAction* pDrawUndo;
79 ScBlockUndoMode eMode;
81 void BeginUndo();
82 void EndUndo();
83 // void BeginRedo();
84 void EndRedo();
86 sal_Bool AdjustHeight();
87 void ShowBlock();
90 class ScMultiBlockUndo: public ScSimpleUndo
92 public:
93 TYPEINFO();
94 ScMultiBlockUndo(ScDocShell* pDocSh, const ScRangeList& rRanges,
95 ScBlockUndoMode eBlockMode);
96 virtual ~ScMultiBlockUndo();
98 protected:
99 ScRangeList maBlockRanges;
100 SdrUndoAction* mpDrawUndo;
101 ScBlockUndoMode meMode;
103 void BeginUndo();
104 void EndUndo();
105 void EndRedo();
107 void AdjustHeight();
108 void ShowBlock();
111 //----------------------------------------------------------------------------
113 // for functions that act on a database range - takes care of the unnamed database range
114 // (collected separately, before the undo action, for showing dialogs etc.)
116 class ScDBFuncUndo: public ScSimpleUndo
118 protected:
119 ScDBData* pAutoDBRange;
120 ScRange aOriginalRange;
121 SdrUndoAction* mpDrawUndo;
123 public:
124 TYPEINFO();
125 ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal, SdrUndoAction* pDrawUndo = 0 );
126 virtual ~ScDBFuncUndo();
128 void SetDrawUndoAction( SdrUndoAction* pDrawUndo );
130 void BeginUndo();
131 void EndUndo();
132 void BeginRedo();
133 void EndRedo();
136 //----------------------------------------------------------------------------
138 enum ScMoveUndoMode { SC_UNDO_REFFIRST, SC_UNDO_REFLAST };
140 class ScMoveUndo: public ScSimpleUndo // mit Referenzen
142 public:
143 TYPEINFO();
144 ScMoveUndo( ScDocShell* pDocSh,
145 ScDocument* pRefDoc, ScRefUndoData* pRefData,
146 ScMoveUndoMode eRefMode );
147 virtual ~ScMoveUndo();
149 protected:
150 SdrUndoAction* pDrawUndo;
151 ScDocument* pRefUndoDoc;
152 ScRefUndoData* pRefUndoData;
153 ScMoveUndoMode eMode;
155 void BeginUndo();
156 void EndUndo();
157 // void BeginRedo();
158 // void EndRedo();
160 private:
161 void UndoRef();
164 //----------------------------------------------------------------------------
166 class ScUndoWrapper: public SfxUndoAction // for manual merging of actions
168 SfxUndoAction* pWrappedUndo;
170 public:
171 TYPEINFO();
172 ScUndoWrapper( SfxUndoAction* pUndo );
173 virtual ~ScUndoWrapper();
175 SfxUndoAction* GetWrappedUndo() { return pWrappedUndo; }
176 void ForgetWrappedUndo();
178 virtual sal_Bool IsLinked();
179 virtual void SetLinked( sal_Bool bIsLinked );
180 virtual void Undo();
181 virtual void Redo();
182 virtual void Repeat(SfxRepeatTarget& rTarget);
183 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const;
184 virtual sal_Bool Merge( SfxUndoAction *pNextAction );
185 virtual OUString GetComment() const;
186 virtual OUString GetRepeatComment(SfxRepeatTarget&) const;
187 virtual sal_uInt16 GetId() const;
191 #endif
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */