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_UNDODAT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_UNDODAT_HXX
23 #include "undobase.hxx"
24 #include "rangeutl.hxx"
25 #include "rangelst.hxx"
26 #include "sortparam.hxx"
27 #include "queryparam.hxx"
28 #include "subtotalparam.hxx"
31 #include <boost/scoped_ptr.hpp>
43 class ScUndoDoOutline
: public ScSimpleUndo
47 ScUndoDoOutline( ScDocShell
* pNewDocShell
,
48 SCCOLROW nNewStart
, SCCOLROW nNewEnd
, SCTAB nNewTab
,
49 ScDocument
* pNewUndoDoc
, bool bNewColumns
,
50 sal_uInt16 nNewLevel
, sal_uInt16 nNewEntry
, bool bNewShow
);
51 virtual ~ScUndoDoOutline();
53 virtual void Undo() SAL_OVERRIDE
;
54 virtual void Redo() SAL_OVERRIDE
;
55 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
56 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
58 virtual OUString
GetComment() const SAL_OVERRIDE
;
71 class ScUndoMakeOutline
: public ScSimpleUndo
75 ScUndoMakeOutline( ScDocShell
* pNewDocShell
,
76 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
77 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
78 ScOutlineTable
* pNewUndoTab
,
79 bool bNewColumns
, bool bNewMake
);
80 virtual ~ScUndoMakeOutline();
82 virtual void Undo() SAL_OVERRIDE
;
83 virtual void Redo() SAL_OVERRIDE
;
84 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
85 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
87 virtual OUString
GetComment() const SAL_OVERRIDE
;
90 ScAddress aBlockStart
;
92 ScOutlineTable
* pUndoTable
;
97 class ScUndoOutlineLevel
: public ScSimpleUndo
101 ScUndoOutlineLevel( ScDocShell
* pNewDocShell
,
102 SCCOLROW nNewStart
, SCCOLROW nNewEnd
, SCTAB nNewTab
,
103 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
104 bool bNewColumns
, sal_uInt16 nNewLevel
);
105 virtual ~ScUndoOutlineLevel();
107 virtual void Undo() SAL_OVERRIDE
;
108 virtual void Redo() SAL_OVERRIDE
;
109 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
110 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
112 virtual OUString
GetComment() const SAL_OVERRIDE
;
118 ScDocument
* pUndoDoc
;
119 ScOutlineTable
* pUndoTable
;
124 class ScUndoOutlineBlock
: public ScSimpleUndo
128 ScUndoOutlineBlock( ScDocShell
* pNewDocShell
,
129 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
130 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
131 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
133 virtual ~ScUndoOutlineBlock();
135 virtual void Undo() SAL_OVERRIDE
;
136 virtual void Redo() SAL_OVERRIDE
;
137 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
138 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
140 virtual OUString
GetComment() const SAL_OVERRIDE
;
143 ScAddress aBlockStart
;
145 ScDocument
* pUndoDoc
;
146 ScOutlineTable
* pUndoTable
;
150 class ScUndoRemoveAllOutlines
: public ScSimpleUndo
154 ScUndoRemoveAllOutlines( ScDocShell
* pNewDocShell
,
155 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
156 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
157 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
);
158 virtual ~ScUndoRemoveAllOutlines();
160 virtual void Undo() SAL_OVERRIDE
;
161 virtual void Redo() SAL_OVERRIDE
;
162 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
163 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
165 virtual OUString
GetComment() const SAL_OVERRIDE
;
168 ScAddress aBlockStart
;
170 ScDocument
* pUndoDoc
;
171 ScOutlineTable
* pUndoTable
;
174 class ScUndoAutoOutline
: public ScSimpleUndo
178 ScUndoAutoOutline( ScDocShell
* pNewDocShell
,
179 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
180 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
181 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
);
182 virtual ~ScUndoAutoOutline();
184 virtual void Undo() SAL_OVERRIDE
;
185 virtual void Redo() SAL_OVERRIDE
;
186 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
187 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
189 virtual OUString
GetComment() const SAL_OVERRIDE
;
192 ScAddress aBlockStart
;
194 ScDocument
* pUndoDoc
;
195 ScOutlineTable
* pUndoTable
;
198 class ScUndoSubTotals
: public ScDBFuncUndo
202 ScUndoSubTotals( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
203 const ScSubTotalParam
& rNewParam
, SCROW nNewEndY
,
204 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
205 // ScDBData* pNewData,
206 ScRangeName
* pNewUndoRange
, ScDBCollection
* pNewUndoDB
);
207 virtual ~ScUndoSubTotals();
209 virtual void Undo() SAL_OVERRIDE
;
210 virtual void Redo() SAL_OVERRIDE
;
211 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
212 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
214 virtual OUString
GetComment() const SAL_OVERRIDE
;
218 ScSubTotalParam aParam
; // The original passed parameter
219 SCROW nNewEndRow
; // Size of result
220 ScDocument
* pUndoDoc
;
221 ScOutlineTable
* pUndoTable
;
222 // ScDBData* pUndoDBData;
223 ScRangeName
* pUndoRange
;
224 ScDBCollection
* pUndoDB
;
227 class ScUndoQuery
: public ScDBFuncUndo
231 ScUndoQuery( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
232 const ScQueryParam
& rParam
, ScDocument
* pNewUndoDoc
,
233 ScDBCollection
* pNewUndoDB
, const ScRange
* pOld
,
234 bool bSize
, const ScRange
* pAdvSrc
);
235 virtual ~ScUndoQuery();
237 virtual void Undo() SAL_OVERRIDE
;
238 virtual void Redo() SAL_OVERRIDE
;
239 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
240 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
242 virtual OUString
GetComment() const SAL_OVERRIDE
;
245 SdrUndoAction
* pDrawUndo
;
247 ScQueryParam aQueryParam
;
248 ScDocument
* pUndoDoc
;
249 ScDBCollection
* pUndoDB
; // due to source and target range
257 class ScUndoAutoFilter
: public ScDBFuncUndo
263 void DoChange( bool bUndo
);
267 ScUndoAutoFilter( ScDocShell
* pNewDocShell
, const ScRange
& rRange
,
268 const OUString
& rName
, bool bSet
);
269 virtual ~ScUndoAutoFilter();
271 virtual void Undo() SAL_OVERRIDE
;
272 virtual void Redo() SAL_OVERRIDE
;
273 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
274 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
276 virtual OUString
GetComment() const SAL_OVERRIDE
;
279 class ScUndoDBData
: public ScSimpleUndo
283 ScUndoDBData( ScDocShell
* pNewDocShell
,
284 ScDBCollection
* pNewUndoColl
, ScDBCollection
* pNewRedoColl
);
285 virtual ~ScUndoDBData();
287 virtual void Undo() SAL_OVERRIDE
;
288 virtual void Redo() SAL_OVERRIDE
;
289 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
290 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
292 virtual OUString
GetComment() const SAL_OVERRIDE
;
295 ScDBCollection
* pUndoColl
;
296 ScDBCollection
* pRedoColl
;
299 class ScUndoImportData
: public ScSimpleUndo
303 ScUndoImportData( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
304 const ScImportParam
& rParam
, SCCOL nNewEndX
, SCROW nNewEndY
,
306 ScDocument
* pNewUndoDoc
, ScDocument
* pNewRedoDoc
,
307 ScDBData
* pNewUndoData
, ScDBData
* pNewRedoData
);
308 virtual ~ScUndoImportData();
310 virtual void Undo() SAL_OVERRIDE
;
311 virtual void Redo() SAL_OVERRIDE
;
312 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
313 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
315 virtual OUString
GetComment() const SAL_OVERRIDE
;
319 ScImportParam aImportParam
;
322 ScDocument
* pUndoDoc
;
323 ScDocument
* pRedoDoc
;
324 ScDBData
* pUndoDBData
;
325 ScDBData
* pRedoDBData
;
330 class ScUndoRepeatDB
: public ScSimpleUndo
334 ScUndoRepeatDB( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
335 SCCOL nStartX
, SCROW nStartY
, SCCOL nEndX
, SCROW nEndY
,
336 SCROW nResultEndRow
, SCCOL nCurX
, SCROW nCurY
,
337 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
338 ScRangeName
* pNewUndoRange
, ScDBCollection
* pNewUndoDB
,
339 const ScRange
* pOldQ
, const ScRange
* pNewQ
);
340 virtual ~ScUndoRepeatDB();
342 virtual void Undo() SAL_OVERRIDE
;
343 virtual void Redo() SAL_OVERRIDE
;
344 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
345 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
347 virtual OUString
GetComment() const SAL_OVERRIDE
;
350 ScAddress aBlockStart
;
353 ScAddress aCursorPos
;
354 ScDocument
* pUndoDoc
;
355 ScOutlineTable
* pUndoTable
;
356 ScRangeName
* pUndoRange
;
357 ScDBCollection
* pUndoDB
;
363 class ScUndoDataPilot
: public ScSimpleUndo
367 ScUndoDataPilot( ScDocShell
* pNewDocShell
,
368 ScDocument
* pOldDoc
, ScDocument
* pNewDoc
,
369 const ScDPObject
* pOldObj
, const ScDPObject
* pNewObj
,
371 virtual ~ScUndoDataPilot();
373 virtual void Undo() SAL_OVERRIDE
;
374 virtual void Redo() SAL_OVERRIDE
;
375 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
376 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
378 virtual OUString
GetComment() const SAL_OVERRIDE
;
381 ScDocument
* pOldUndoDoc
;
382 ScDocument
* pNewUndoDoc
;
383 ScDPObject
* pOldDPObject
;
384 ScDPObject
* pNewDPObject
;
388 class ScUndoConsolidate
: public ScSimpleUndo
392 ScUndoConsolidate( ScDocShell
* pNewDocShell
,
393 const ScArea
& rArea
, const ScConsolidateParam
& rPar
,
394 ScDocument
* pNewUndoDoc
, bool bReference
,
395 SCROW nInsCount
, ScOutlineTable
* pTab
,
397 virtual ~ScUndoConsolidate();
399 virtual void Undo() SAL_OVERRIDE
;
400 virtual void Redo() SAL_OVERRIDE
;
401 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
402 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
404 virtual OUString
GetComment() const SAL_OVERRIDE
;
408 ScDocument
* pUndoDoc
;
409 ScConsolidateParam aParam
;
412 ScOutlineTable
* pUndoTab
;
416 class ScUndoChartData
: public ScSimpleUndo
420 ScUndoChartData( ScDocShell
* pNewDocShell
,
421 const OUString
& rName
, const ScRange
& rNew
,
422 bool bColHdr
, bool bRowHdr
, bool bAdd
);
423 ScUndoChartData( ScDocShell
* pNewDocShell
,
424 const OUString
& rName
, const ScRangeListRef
& rNew
,
425 bool bColHdr
, bool bRowHdr
, bool bAdd
);
426 virtual ~ScUndoChartData();
428 virtual void Undo() SAL_OVERRIDE
;
429 virtual void Redo() SAL_OVERRIDE
;
430 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
431 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
433 virtual OUString
GetComment() const SAL_OVERRIDE
;
437 ScRangeListRef aOldRangeListRef
;
440 // ScRange aNewRange;
441 ScRangeListRef aNewRangeListRef
;
449 class ScUndoDataForm
: public ScBlockUndo
453 ScUndoDataForm( ScDocShell
* pNewDocShell
,
454 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
455 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
456 const ScMarkData
& rMark
,
457 ScDocument
* pNewUndoDoc
, ScDocument
* pNewRedoDoc
,
458 InsertDeleteFlags nNewFlags
,
459 ScRefUndoData
* pRefData
, void* pFill1
, void* pFill2
, void* pFill3
,
460 bool bRedoIsFilled
= true
462 virtual ~ScUndoDataForm();
464 virtual void Undo() SAL_OVERRIDE
;
465 virtual void Redo() SAL_OVERRIDE
;
466 virtual void Repeat(SfxRepeatTarget
& rTarget
) SAL_OVERRIDE
;
467 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const SAL_OVERRIDE
;
469 virtual OUString
GetComment() const SAL_OVERRIDE
;
472 boost::scoped_ptr
<ScMarkData
> mpMarkData
;
473 ScDocument
* pUndoDoc
;
474 ScDocument
* pRedoDoc
;
475 InsertDeleteFlags nFlags
;
476 ScRefUndoData
* pRefUndoData
;
477 ScRefUndoData
* pRefRedoData
;
478 sal_uLong nStartChangeAction
;
479 sal_uLong nEndChangeAction
;
482 void DoChange( const bool bUndo
);
483 void SetChangeTrack();
488 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */