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 bool Merge( SfxUndoAction
*pNextAction
);
48 ScDocShell
* pDocShell
;
49 SfxUndoAction
* pDetectiveUndo
;
51 bool IsPaintLocked() const { return pDocShell
->IsPaintLocked(); }
53 bool SetViewMarkData( const ScMarkData
& rMarkData
);
60 void BroadcastChanges( const ScRange
& rRange
);
62 static void ShowTable( SCTAB nTab
);
63 static void ShowTable( const ScRange
& rRange
);
66 //----------------------------------------------------------------------------
68 enum ScBlockUndoMode
{ SC_UNDO_SIMPLE
, SC_UNDO_MANUALHEIGHT
, SC_UNDO_AUTOHEIGHT
};
70 class ScBlockUndo
: public ScSimpleUndo
74 ScBlockUndo( ScDocShell
* pDocSh
, const ScRange
& rRange
,
75 ScBlockUndoMode eBlockMode
);
76 virtual ~ScBlockUndo();
80 SdrUndoAction
* pDrawUndo
;
81 ScBlockUndoMode eMode
;
88 sal_Bool
AdjustHeight();
92 class ScMultiBlockUndo
: public ScSimpleUndo
96 ScMultiBlockUndo(ScDocShell
* pDocSh
, const ScRangeList
& rRanges
,
97 ScBlockUndoMode eBlockMode
);
98 virtual ~ScMultiBlockUndo();
101 ScRangeList maBlockRanges
;
102 SdrUndoAction
* mpDrawUndo
;
103 ScBlockUndoMode meMode
;
113 //----------------------------------------------------------------------------
115 // for functions that act on a database range - takes care of the unnamed database range
116 // (collected separately, before the undo action, for showing dialogs etc.)
118 class ScDBFuncUndo
: public ScSimpleUndo
121 ScDBData
* pAutoDBRange
;
122 ScRange aOriginalRange
;
123 SdrUndoAction
* mpDrawUndo
;
127 ScDBFuncUndo( ScDocShell
* pDocSh
, const ScRange
& rOriginal
, SdrUndoAction
* pDrawUndo
= 0 );
128 virtual ~ScDBFuncUndo();
130 void SetDrawUndoAction( SdrUndoAction
* pDrawUndo
);
138 //----------------------------------------------------------------------------
140 enum ScMoveUndoMode
{ SC_UNDO_REFFIRST
, SC_UNDO_REFLAST
};
142 class ScMoveUndo
: public ScSimpleUndo
// mit Referenzen
146 ScMoveUndo( ScDocShell
* pDocSh
,
147 ScDocument
* pRefDoc
, ScRefUndoData
* pRefData
,
148 ScMoveUndoMode eRefMode
);
149 virtual ~ScMoveUndo();
152 SdrUndoAction
* pDrawUndo
;
153 ScDocument
* pRefUndoDoc
;
154 ScRefUndoData
* pRefUndoData
;
155 ScMoveUndoMode eMode
;
166 //----------------------------------------------------------------------------
168 class ScUndoWrapper
: public SfxUndoAction
// for manual merging of actions
170 SfxUndoAction
* pWrappedUndo
;
174 ScUndoWrapper( SfxUndoAction
* pUndo
);
175 virtual ~ScUndoWrapper();
177 SfxUndoAction
* GetWrappedUndo() { return pWrappedUndo
; }
178 void ForgetWrappedUndo();
180 virtual void SetLinkToSfxLinkUndoAction(SfxLinkUndoAction
* pSfxLinkUndoAction
);
184 virtual void Repeat(SfxRepeatTarget
& rTarget
);
185 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
186 virtual bool Merge( SfxUndoAction
*pNextAction
);
187 virtual OUString
GetComment() const;
188 virtual OUString
GetRepeatComment(SfxRepeatTarget
&) const;
189 virtual sal_uInt16
GetId() const;
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */