1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
25 #include "address.hxx"
34 //----------------------------------------------------------------------------
36 class ScSimpleUndo
: public SfxUndoAction
38 ScSimpleUndo(const ScSimpleUndo
&); // disabled
42 ScSimpleUndo( ScDocShell
* pDocSh
);
43 virtual ~ScSimpleUndo();
45 virtual sal_Bool
Merge( SfxUndoAction
*pNextAction
);
48 ScDocShell
* pDocShell
;
49 SfxUndoAction
* pDetectiveUndo
;
51 bool IsPaintLocked() const { return pDocShell
->IsPaintLocked(); }
53 bool SetViewMarkData( const ScMarkData
& rMarkData
);
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
72 ScBlockUndo( ScDocShell
* pDocSh
, const ScRange
& rRange
,
73 ScBlockUndoMode eBlockMode
);
74 virtual ~ScBlockUndo();
78 SdrUndoAction
* pDrawUndo
;
79 ScBlockUndoMode eMode
;
86 sal_Bool
AdjustHeight();
90 class ScMultiBlockUndo
: public ScSimpleUndo
94 ScMultiBlockUndo(ScDocShell
* pDocSh
, const ScRangeList
& rRanges
,
95 ScBlockUndoMode eBlockMode
);
96 virtual ~ScMultiBlockUndo();
99 ScRangeList maBlockRanges
;
100 SdrUndoAction
* mpDrawUndo
;
101 ScBlockUndoMode meMode
;
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
119 ScDBData
* pAutoDBRange
;
120 ScRange aOriginalRange
;
121 SdrUndoAction
* mpDrawUndo
;
125 ScDBFuncUndo( ScDocShell
* pDocSh
, const ScRange
& rOriginal
, SdrUndoAction
* pDrawUndo
= 0 );
126 virtual ~ScDBFuncUndo();
128 void SetDrawUndoAction( SdrUndoAction
* pDrawUndo
);
136 //----------------------------------------------------------------------------
138 enum ScMoveUndoMode
{ SC_UNDO_REFFIRST
, SC_UNDO_REFLAST
};
140 class ScMoveUndo
: public ScSimpleUndo
// mit Referenzen
144 ScMoveUndo( ScDocShell
* pDocSh
,
145 ScDocument
* pRefDoc
, ScRefUndoData
* pRefData
,
146 ScMoveUndoMode eRefMode
);
147 virtual ~ScMoveUndo();
150 SdrUndoAction
* pDrawUndo
;
151 ScDocument
* pRefUndoDoc
;
152 ScRefUndoData
* pRefUndoData
;
153 ScMoveUndoMode eMode
;
164 //----------------------------------------------------------------------------
166 class ScUndoWrapper
: public SfxUndoAction
// for manual merging of actions
168 SfxUndoAction
* pWrappedUndo
;
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
);
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;
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */