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 INCLUDED_SC_SOURCE_UI_INC_UNDOBASE_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_UNDOBASE_HXX
23 #include <svl/undo.hxx>
25 #include "address.hxx"
27 #include <columnspanset.hxx>
29 #include <boost/ptr_container/ptr_map.hpp>
37 class ScSimpleUndo
: public SfxUndoAction
39 ScSimpleUndo(const ScSimpleUndo
&) SAL_DELETED_FUNCTION
;
42 typedef boost::ptr_map
<SCTAB
,sc::ColumnSpanSet
> DataSpansType
;
45 ScSimpleUndo( ScDocShell
* pDocSh
);
46 virtual ~ScSimpleUndo();
48 virtual bool Merge( SfxUndoAction
*pNextAction
) SAL_OVERRIDE
;
51 ScDocShell
* pDocShell
;
52 SfxUndoAction
* pDetectiveUndo
;
54 bool IsPaintLocked() const { return pDocShell
->IsPaintLocked(); }
56 bool SetViewMarkData( const ScMarkData
& rMarkData
);
63 void BroadcastChanges( const ScRange
& rRange
);
66 * Broadcast changes on specified spans.
68 * @param rSpans container that specifies all spans whose changes need to
71 void BroadcastChanges( const DataSpansType
& rSpans
);
73 static void ShowTable( SCTAB nTab
);
74 static void ShowTable( const ScRange
& rRange
);
77 enum ScBlockUndoMode
{ SC_UNDO_SIMPLE
, SC_UNDO_MANUALHEIGHT
, SC_UNDO_AUTOHEIGHT
};
79 class ScBlockUndo
: public ScSimpleUndo
83 ScBlockUndo( ScDocShell
* pDocSh
, const ScRange
& rRange
,
84 ScBlockUndoMode eBlockMode
);
85 virtual ~ScBlockUndo();
89 SdrUndoAction
* pDrawUndo
;
90 ScBlockUndoMode eMode
;
101 class ScMultiBlockUndo
: public ScSimpleUndo
105 ScMultiBlockUndo(ScDocShell
* pDocSh
, const ScRangeList
& rRanges
,
106 ScBlockUndoMode eBlockMode
);
107 virtual ~ScMultiBlockUndo();
110 ScRangeList maBlockRanges
;
111 SdrUndoAction
* mpDrawUndo
;
112 ScBlockUndoMode meMode
;
122 // for functions that act on a database range - takes care of the unnamed database range
123 // (collected separately, before the undo action, for showing dialogs etc.)
125 class ScDBFuncUndo
: public ScSimpleUndo
128 ScDBData
* pAutoDBRange
;
129 ScRange aOriginalRange
;
130 SdrUndoAction
* mpDrawUndo
;
134 ScDBFuncUndo( ScDocShell
* pDocSh
, const ScRange
& rOriginal
, SdrUndoAction
* pDrawUndo
= 0 );
135 virtual ~ScDBFuncUndo();
143 enum ScMoveUndoMode
{ SC_UNDO_REFFIRST
, SC_UNDO_REFLAST
};
145 class ScMoveUndo
: public ScSimpleUndo
// mit Referenzen
149 ScMoveUndo( ScDocShell
* pDocSh
,
150 ScDocument
* pRefDoc
, ScRefUndoData
* pRefData
,
151 ScMoveUndoMode eRefMode
);
152 virtual ~ScMoveUndo();
155 SdrUndoAction
* pDrawUndo
;
156 ScDocument
* pRefUndoDoc
;
157 ScRefUndoData
* pRefUndoData
;
158 ScMoveUndoMode eMode
;
169 class ScUndoWrapper
: public SfxUndoAction
// for manual merging of actions
171 SfxUndoAction
* pWrappedUndo
;
175 ScUndoWrapper( SfxUndoAction
* pUndo
);
176 virtual ~ScUndoWrapper();
178 SfxUndoAction
* GetWrappedUndo() { return pWrappedUndo
; }
179 void ForgetWrappedUndo();
181 virtual void SetLinkToSfxLinkUndoAction(SfxLinkUndoAction
* pSfxLinkUndoAction
) SAL_OVERRIDE
;
183 virtual void Undo() SAL_OVERRIDE
;
184 virtual void Redo() SAL_OVERRIDE
;
185 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
186 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
187 virtual bool Merge( SfxUndoAction
*pNextAction
) SAL_OVERRIDE
;
188 virtual OUString
GetComment() const SAL_OVERRIDE
;
189 virtual OUString
GetRepeatComment(SfxRepeatTarget
&) const SAL_OVERRIDE
;
190 virtual sal_uInt16
GetId() const SAL_OVERRIDE
;
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */