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_UNDODAT_HXX
21 #define SC_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 //----------------------------------------------------------------------------
45 class ScUndoDoOutline
: public ScSimpleUndo
49 ScUndoDoOutline( ScDocShell
* pNewDocShell
,
50 SCCOLROW nNewStart
, SCCOLROW nNewEnd
, SCTAB nNewTab
,
51 ScDocument
* pNewUndoDoc
, sal_Bool bNewColumns
,
52 sal_uInt16 nNewLevel
, sal_uInt16 nNewEntry
, sal_Bool bNewShow
);
53 virtual ~ScUndoDoOutline();
57 virtual void Repeat(SfxRepeatTarget
& rTarget
);
58 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
60 virtual OUString
GetComment() const;
74 class ScUndoMakeOutline
: public ScSimpleUndo
78 ScUndoMakeOutline( ScDocShell
* pNewDocShell
,
79 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
80 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
81 ScOutlineTable
* pNewUndoTab
,
82 sal_Bool bNewColumns
, sal_Bool bNewMake
);
83 virtual ~ScUndoMakeOutline();
87 virtual void Repeat(SfxRepeatTarget
& rTarget
);
88 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
90 virtual OUString
GetComment() const;
93 ScAddress aBlockStart
;
95 ScOutlineTable
* pUndoTable
;
101 class ScUndoOutlineLevel
: public ScSimpleUndo
105 ScUndoOutlineLevel( ScDocShell
* pNewDocShell
,
106 SCCOLROW nNewStart
, SCCOLROW nNewEnd
, SCTAB nNewTab
,
107 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
108 sal_Bool bNewColumns
, sal_uInt16 nNewLevel
);
109 virtual ~ScUndoOutlineLevel();
113 virtual void Repeat(SfxRepeatTarget
& rTarget
);
114 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
116 virtual OUString
GetComment() const;
122 ScDocument
* pUndoDoc
;
123 ScOutlineTable
* pUndoTable
;
129 class ScUndoOutlineBlock
: public ScSimpleUndo
133 ScUndoOutlineBlock( ScDocShell
* pNewDocShell
,
134 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
135 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
136 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
138 virtual ~ScUndoOutlineBlock();
142 virtual void Repeat(SfxRepeatTarget
& rTarget
);
143 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
145 virtual OUString
GetComment() const;
148 ScAddress aBlockStart
;
150 ScDocument
* pUndoDoc
;
151 ScOutlineTable
* pUndoTable
;
156 class ScUndoRemoveAllOutlines
: public ScSimpleUndo
160 ScUndoRemoveAllOutlines( ScDocShell
* pNewDocShell
,
161 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
162 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
163 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
);
164 virtual ~ScUndoRemoveAllOutlines();
168 virtual void Repeat(SfxRepeatTarget
& rTarget
);
169 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
171 virtual OUString
GetComment() const;
174 ScAddress aBlockStart
;
176 ScDocument
* pUndoDoc
;
177 ScOutlineTable
* pUndoTable
;
181 class ScUndoAutoOutline
: public ScSimpleUndo
185 ScUndoAutoOutline( ScDocShell
* pNewDocShell
,
186 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
187 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
188 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
);
189 virtual ~ScUndoAutoOutline();
193 virtual void Repeat(SfxRepeatTarget
& rTarget
);
194 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
196 virtual OUString
GetComment() const;
199 ScAddress aBlockStart
;
201 ScDocument
* pUndoDoc
;
202 ScOutlineTable
* pUndoTable
;
206 class ScUndoSubTotals
: public ScDBFuncUndo
210 ScUndoSubTotals( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
211 const ScSubTotalParam
& rNewParam
, SCROW nNewEndY
,
212 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
213 // ScDBData* pNewData,
214 ScRangeName
* pNewUndoRange
, ScDBCollection
* pNewUndoDB
);
215 virtual ~ScUndoSubTotals();
219 virtual void Repeat(SfxRepeatTarget
& rTarget
);
220 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
222 virtual OUString
GetComment() const;
226 ScSubTotalParam aParam
; // The original passed parameter
227 SCROW nNewEndRow
; // Size of result
228 ScDocument
* pUndoDoc
;
229 ScOutlineTable
* pUndoTable
;
230 // ScDBData* pUndoDBData;
231 ScRangeName
* pUndoRange
;
232 ScDBCollection
* pUndoDB
;
236 class ScUndoSort
: public ScDBFuncUndo
240 ScUndoSort( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
241 const ScSortParam
& rParam
,
242 ScDocument
* pNewUndoDoc
,
243 ScDBCollection
* pNewUndoDB
, const ScRange
* pDest
= NULL
);
244 virtual ~ScUndoSort();
248 virtual void Repeat(SfxRepeatTarget
& rTarget
);
249 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
251 virtual OUString
GetComment() const;
255 ScSortParam aSortParam
;
256 ScDocument
* pUndoDoc
;
257 ScDBCollection
* pUndoDB
; // due to source and target range
263 class ScUndoQuery
: public ScDBFuncUndo
267 ScUndoQuery( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
268 const ScQueryParam
& rParam
, ScDocument
* pNewUndoDoc
,
269 ScDBCollection
* pNewUndoDB
, const ScRange
* pOld
,
270 sal_Bool bSize
, const ScRange
* pAdvSrc
);
271 virtual ~ScUndoQuery();
275 virtual void Repeat(SfxRepeatTarget
& rTarget
);
276 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
278 virtual OUString
GetComment() const;
281 SdrUndoAction
* pDrawUndo
;
283 ScQueryParam aQueryParam
;
284 ScDocument
* pUndoDoc
;
285 ScDBCollection
* pUndoDB
; // due to source and target range
288 sal_Bool bIsAdvanced
;
294 class ScUndoAutoFilter
: public ScDBFuncUndo
300 void DoChange( bool bUndo
);
304 ScUndoAutoFilter( ScDocShell
* pNewDocShell
, const ScRange
& rRange
,
305 const OUString
& rName
, bool bSet
);
306 virtual ~ScUndoAutoFilter();
310 virtual void Repeat(SfxRepeatTarget
& rTarget
);
311 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
313 virtual OUString
GetComment() const;
317 class ScUndoDBData
: public ScSimpleUndo
321 ScUndoDBData( ScDocShell
* pNewDocShell
,
322 ScDBCollection
* pNewUndoColl
, ScDBCollection
* pNewRedoColl
);
323 virtual ~ScUndoDBData();
327 virtual void Repeat(SfxRepeatTarget
& rTarget
);
328 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
330 virtual OUString
GetComment() const;
333 ScDBCollection
* pUndoColl
;
334 ScDBCollection
* pRedoColl
;
338 class ScUndoImportData
: public ScSimpleUndo
342 ScUndoImportData( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
343 const ScImportParam
& rParam
, SCCOL nNewEndX
, SCROW nNewEndY
,
345 ScDocument
* pNewUndoDoc
, ScDocument
* pNewRedoDoc
,
346 ScDBData
* pNewUndoData
, ScDBData
* pNewRedoData
);
347 virtual ~ScUndoImportData();
351 virtual void Repeat(SfxRepeatTarget
& rTarget
);
352 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
354 virtual OUString
GetComment() const;
358 ScImportParam aImportParam
;
361 ScDocument
* pUndoDoc
;
362 ScDocument
* pRedoDoc
;
363 ScDBData
* pUndoDBData
;
364 ScDBData
* pRedoDBData
;
366 sal_Bool bRedoFilled
;
370 class ScUndoRepeatDB
: public ScSimpleUndo
374 ScUndoRepeatDB( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
375 SCCOL nStartX
, SCROW nStartY
, SCCOL nEndX
, SCROW nEndY
,
376 SCROW nResultEndRow
, SCCOL nCurX
, SCROW nCurY
,
377 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
378 ScRangeName
* pNewUndoRange
, ScDBCollection
* pNewUndoDB
,
379 const ScRange
* pOldQ
, const ScRange
* pNewQ
);
380 virtual ~ScUndoRepeatDB();
384 virtual void Repeat(SfxRepeatTarget
& rTarget
);
385 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
387 virtual OUString
GetComment() const;
390 ScAddress aBlockStart
;
393 ScAddress aCursorPos
;
394 ScDocument
* pUndoDoc
;
395 ScOutlineTable
* pUndoTable
;
396 ScRangeName
* pUndoRange
;
397 ScDBCollection
* pUndoDB
;
404 class ScUndoDataPilot
: public ScSimpleUndo
408 ScUndoDataPilot( ScDocShell
* pNewDocShell
,
409 ScDocument
* pOldDoc
, ScDocument
* pNewDoc
,
410 const ScDPObject
* pOldObj
, const ScDPObject
* pNewObj
,
412 virtual ~ScUndoDataPilot();
416 virtual void Repeat(SfxRepeatTarget
& rTarget
);
417 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
419 virtual OUString
GetComment() const;
422 ScDocument
* pOldUndoDoc
;
423 ScDocument
* pNewUndoDoc
;
424 ScDPObject
* pOldDPObject
;
425 ScDPObject
* pNewDPObject
;
430 class ScUndoConsolidate
: public ScSimpleUndo
434 ScUndoConsolidate( ScDocShell
* pNewDocShell
,
435 const ScArea
& rArea
, const ScConsolidateParam
& rPar
,
436 ScDocument
* pNewUndoDoc
, sal_Bool bReference
,
437 SCROW nInsCount
, ScOutlineTable
* pTab
,
439 virtual ~ScUndoConsolidate();
443 virtual void Repeat(SfxRepeatTarget
& rTarget
);
444 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
446 virtual OUString
GetComment() const;
450 ScDocument
* pUndoDoc
;
451 ScConsolidateParam aParam
;
454 ScOutlineTable
* pUndoTab
;
459 class ScUndoChartData
: public ScSimpleUndo
463 ScUndoChartData( ScDocShell
* pNewDocShell
,
464 const OUString
& rName
, const ScRange
& rNew
,
465 bool bColHdr
, bool bRowHdr
, bool bAdd
);
466 ScUndoChartData( ScDocShell
* pNewDocShell
,
467 const OUString
& rName
, const ScRangeListRef
& rNew
,
468 bool bColHdr
, bool bRowHdr
, bool bAdd
);
469 virtual ~ScUndoChartData();
473 virtual void Repeat(SfxRepeatTarget
& rTarget
);
474 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
476 virtual OUString
GetComment() const;
480 ScRangeListRef aOldRangeListRef
;
483 // ScRange aNewRange;
484 ScRangeListRef aNewRangeListRef
;
492 class ScUndoDataForm
: public ScBlockUndo
496 ScUndoDataForm( ScDocShell
* pNewDocShell
,
497 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
498 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
499 const ScMarkData
& rMark
,
500 ScDocument
* pNewUndoDoc
, ScDocument
* pNewRedoDoc
,
501 sal_uInt16 nNewFlags
,
502 ScRefUndoData
* pRefData
, void* pFill1
, void* pFill2
, void* pFill3
,
503 sal_Bool bRedoIsFilled
= true
505 virtual ~ScUndoDataForm();
509 virtual void Repeat(SfxRepeatTarget
& rTarget
);
510 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
512 virtual OUString
GetComment() const;
515 boost::scoped_ptr
<ScMarkData
> mpMarkData
;
516 ScDocument
* pUndoDoc
;
517 ScDocument
* pRedoDoc
;
519 ScRefUndoData
* pRefUndoData
;
520 ScRefUndoData
* pRefRedoData
;
521 sal_uLong nStartChangeAction
;
522 sal_uLong nEndChangeAction
;
523 sal_Bool bRedoFilled
;
525 void DoChange( const sal_Bool bUndo
);
526 void SetChangeTrack();
532 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */