1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: undodat.hxx,v $
10 * $Revision: 1.8.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_UNDODAT_HXX
32 #define SC_UNDODAT_HXX
34 #include "undobase.hxx"
35 #include "rangeutl.hxx" // ScArea
36 #include "rangelst.hxx" // ScRangeListRef
37 #include "markdata.hxx"
38 #include "sortparam.hxx"
50 //----------------------------------------------------------------------------
52 class ScUndoDoOutline
: public ScSimpleUndo
56 ScUndoDoOutline( ScDocShell
* pNewDocShell
,
57 SCCOLROW nNewStart
, SCCOLROW nNewEnd
, SCTAB nNewTab
,
58 ScDocument
* pNewUndoDoc
, BOOL bNewColumns
,
59 USHORT nNewLevel
, USHORT nNewEntry
, BOOL bNewShow
);
60 virtual ~ScUndoDoOutline();
64 virtual void Repeat(SfxRepeatTarget
& rTarget
);
65 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
67 virtual String
GetComment() const;
81 class ScUndoMakeOutline
: public ScSimpleUndo
85 ScUndoMakeOutline( ScDocShell
* pNewDocShell
,
86 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
87 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
88 ScOutlineTable
* pNewUndoTab
,
89 BOOL bNewColumns
, BOOL bNewMake
);
90 virtual ~ScUndoMakeOutline();
94 virtual void Repeat(SfxRepeatTarget
& rTarget
);
95 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
97 virtual String
GetComment() const;
100 ScAddress aBlockStart
;
102 ScOutlineTable
* pUndoTable
;
108 class ScUndoOutlineLevel
: public ScSimpleUndo
112 ScUndoOutlineLevel( ScDocShell
* pNewDocShell
,
113 SCCOLROW nNewStart
, SCCOLROW nNewEnd
, SCTAB nNewTab
,
114 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
115 BOOL bNewColumns
, USHORT nNewLevel
);
116 virtual ~ScUndoOutlineLevel();
120 virtual void Repeat(SfxRepeatTarget
& rTarget
);
121 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
123 virtual String
GetComment() const;
129 ScDocument
* pUndoDoc
;
130 ScOutlineTable
* pUndoTable
;
136 class ScUndoOutlineBlock
: public ScSimpleUndo
140 ScUndoOutlineBlock( ScDocShell
* pNewDocShell
,
141 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
142 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
143 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
145 virtual ~ScUndoOutlineBlock();
149 virtual void Repeat(SfxRepeatTarget
& rTarget
);
150 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
152 virtual String
GetComment() const;
155 ScAddress aBlockStart
;
157 ScDocument
* pUndoDoc
;
158 ScOutlineTable
* pUndoTable
;
163 class ScUndoRemoveAllOutlines
: public ScSimpleUndo
167 ScUndoRemoveAllOutlines( ScDocShell
* pNewDocShell
,
168 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
169 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
170 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
);
171 virtual ~ScUndoRemoveAllOutlines();
175 virtual void Repeat(SfxRepeatTarget
& rTarget
);
176 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
178 virtual String
GetComment() const;
181 ScAddress aBlockStart
;
183 ScDocument
* pUndoDoc
;
184 ScOutlineTable
* pUndoTable
;
188 class ScUndoAutoOutline
: public ScSimpleUndo
192 ScUndoAutoOutline( ScDocShell
* pNewDocShell
,
193 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
194 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
195 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
);
196 virtual ~ScUndoAutoOutline();
200 virtual void Repeat(SfxRepeatTarget
& rTarget
);
201 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
203 virtual String
GetComment() const;
206 ScAddress aBlockStart
;
208 ScDocument
* pUndoDoc
;
209 ScOutlineTable
* pUndoTable
;
213 class ScUndoSubTotals
: public ScDBFuncUndo
217 ScUndoSubTotals( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
218 const ScSubTotalParam
& rNewParam
, SCROW nNewEndY
,
219 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
220 // ScDBData* pNewData,
221 ScRangeName
* pNewUndoRange
, ScDBCollection
* pNewUndoDB
);
222 virtual ~ScUndoSubTotals();
226 virtual void Repeat(SfxRepeatTarget
& rTarget
);
227 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
229 virtual String
GetComment() const;
233 ScSubTotalParam aParam
; // Original uebergebener Parameter
234 SCROW nNewEndRow
; // Ergebnis-Groesse
235 ScDocument
* pUndoDoc
;
236 ScOutlineTable
* pUndoTable
;
237 // ScDBData* pUndoDBData;
238 ScRangeName
* pUndoRange
;
239 ScDBCollection
* pUndoDB
;
243 class ScUndoSort
: public ScDBFuncUndo
247 ScUndoSort( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
248 const ScSortParam
& rParam
,
249 BOOL bQuery
, ScDocument
* pNewUndoDoc
,
250 ScDBCollection
* pNewUndoDB
, const ScRange
* pDest
= NULL
);
251 virtual ~ScUndoSort();
255 virtual void Repeat(SfxRepeatTarget
& rTarget
);
256 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
258 virtual String
GetComment() const;
262 ScSortParam aSortParam
;
264 ScDocument
* pUndoDoc
;
265 ScDBCollection
* pUndoDB
; // wegen Quell- und Zielbereich
271 class ScUndoQuery
: public ScDBFuncUndo
275 ScUndoQuery( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
276 const ScQueryParam
& rParam
, ScDocument
* pNewUndoDoc
,
277 ScDBCollection
* pNewUndoDB
, const ScRange
* pOld
,
278 BOOL bSize
, const ScRange
* pAdvSrc
);
279 virtual ~ScUndoQuery();
283 virtual void Repeat(SfxRepeatTarget
& rTarget
);
284 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
286 virtual String
GetComment() const;
289 SdrUndoAction
* pDrawUndo
;
291 ScQueryParam aQueryParam
;
292 ScDocument
* pUndoDoc
;
293 ScDBCollection
* pUndoDB
; // wegen Quell- und Zielbereich
302 class ScUndoAutoFilter
: public ScDBFuncUndo
308 void DoChange( BOOL bUndo
);
312 ScUndoAutoFilter( ScDocShell
* pNewDocShell
, const ScRange
& rRange
,
313 const String
& rName
, BOOL bSet
);
314 virtual ~ScUndoAutoFilter();
318 virtual void Repeat(SfxRepeatTarget
& rTarget
);
319 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
321 virtual String
GetComment() const;
325 class ScUndoDBData
: public ScSimpleUndo
329 ScUndoDBData( ScDocShell
* pNewDocShell
,
330 ScDBCollection
* pNewUndoColl
, ScDBCollection
* pNewRedoColl
);
331 virtual ~ScUndoDBData();
335 virtual void Repeat(SfxRepeatTarget
& rTarget
);
336 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
338 virtual String
GetComment() const;
341 ScDBCollection
* pUndoColl
;
342 ScDBCollection
* pRedoColl
;
346 class ScUndoImportData
: public ScSimpleUndo
350 ScUndoImportData( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
351 const ScImportParam
& rParam
, SCCOL nNewEndX
, SCROW nNewEndY
,
353 ScDocument
* pNewUndoDoc
, ScDocument
* pNewRedoDoc
,
354 ScDBData
* pNewUndoData
, ScDBData
* pNewRedoData
);
355 virtual ~ScUndoImportData();
359 virtual void Repeat(SfxRepeatTarget
& rTarget
);
360 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
362 virtual String
GetComment() const;
366 ScImportParam aImportParam
;
369 ScDocument
* pUndoDoc
;
370 ScDocument
* pRedoDoc
;
371 ScDBData
* pUndoDBData
;
372 ScDBData
* pRedoDBData
;
378 class ScUndoRepeatDB
: public ScSimpleUndo
382 ScUndoRepeatDB( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
383 SCCOL nStartX
, SCROW nStartY
, SCCOL nEndX
, SCROW nEndY
,
384 SCROW nResultEndRow
, SCCOL nCurX
, SCROW nCurY
,
385 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
386 ScRangeName
* pNewUndoRange
, ScDBCollection
* pNewUndoDB
,
387 const ScRange
* pOldQ
, const ScRange
* pNewQ
);
388 virtual ~ScUndoRepeatDB();
392 virtual void Repeat(SfxRepeatTarget
& rTarget
);
393 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
395 virtual String
GetComment() const;
398 ScAddress aBlockStart
;
401 ScAddress aCursorPos
;
402 ScDocument
* pUndoDoc
;
403 ScOutlineTable
* pUndoTable
;
404 ScRangeName
* pUndoRange
;
405 ScDBCollection
* pUndoDB
;
411 //UNUSED2008-05 class ScUndoPivot: public ScSimpleUndo
413 //UNUSED2008-05 public:
414 //UNUSED2008-05 TYPEINFO();
415 //UNUSED2008-05 ScUndoPivot( ScDocShell* pNewDocShell,
416 //UNUSED2008-05 const ScArea& rOld, const ScArea& rNew,
417 //UNUSED2008-05 ScDocument* pOldDoc, ScDocument* pNewDoc,
418 //UNUSED2008-05 const ScPivot* pOldPivot, const ScPivot* pNewPivot );
419 //UNUSED2008-05 virtual ~ScUndoPivot();
421 //UNUSED2008-05 virtual void Undo();
422 //UNUSED2008-05 virtual void Redo();
423 //UNUSED2008-05 virtual void Repeat(SfxRepeatTarget& rTarget);
424 //UNUSED2008-05 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
426 //UNUSED2008-05 virtual String GetComment() const;
428 //UNUSED2008-05 private:
429 //UNUSED2008-05 ScArea aOldArea;
430 //UNUSED2008-05 ScArea aNewArea;
431 //UNUSED2008-05 ScDocument* pOldUndoDoc;
432 //UNUSED2008-05 ScDocument* pNewUndoDoc;
433 //UNUSED2008-05 ScPivotParam aOldParam; // fuer Redo
434 //UNUSED2008-05 ScQueryParam aOldQuery;
435 //UNUSED2008-05 ScArea aOldSrc;
436 //UNUSED2008-05 ScPivotParam aNewParam; // fuer Undo in Collection
437 //UNUSED2008-05 ScQueryParam aNewQuery;
438 //UNUSED2008-05 ScArea aNewSrc;
439 //UNUSED2008-05 String aOldName;
440 //UNUSED2008-05 String aOldTag;
441 //UNUSED2008-05 String aNewName;
442 //UNUSED2008-05 String aNewTag;
445 class ScUndoDataPilot
: public ScSimpleUndo
449 ScUndoDataPilot( ScDocShell
* pNewDocShell
,
450 ScDocument
* pOldDoc
, ScDocument
* pNewDoc
,
451 const ScDPObject
* pOldObj
, const ScDPObject
* pNewObj
,
453 virtual ~ScUndoDataPilot();
457 virtual void Repeat(SfxRepeatTarget
& rTarget
);
458 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
460 virtual String
GetComment() const;
463 ScDocument
* pOldUndoDoc
;
464 ScDocument
* pNewUndoDoc
;
465 ScDPObject
* pOldDPObject
;
466 ScDPObject
* pNewDPObject
;
471 class ScUndoConsolidate
: public ScSimpleUndo
475 ScUndoConsolidate( ScDocShell
* pNewDocShell
,
476 const ScArea
& rArea
, const ScConsolidateParam
& rPar
,
477 ScDocument
* pNewUndoDoc
, BOOL bReference
,
478 SCROW nInsCount
, ScOutlineTable
* pTab
,
480 virtual ~ScUndoConsolidate();
484 virtual void Repeat(SfxRepeatTarget
& rTarget
);
485 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
487 virtual String
GetComment() const;
491 ScDocument
* pUndoDoc
;
492 ScConsolidateParam aParam
;
495 ScOutlineTable
* pUndoTab
;
500 class ScUndoChartData
: public ScSimpleUndo
504 ScUndoChartData( ScDocShell
* pNewDocShell
,
505 const String
& rName
, const ScRange
& rNew
,
506 BOOL bColHdr
, BOOL bRowHdr
, BOOL bAdd
);
507 ScUndoChartData( ScDocShell
* pNewDocShell
,
508 const String
& rName
, const ScRangeListRef
& rNew
,
509 BOOL bColHdr
, BOOL bRowHdr
, BOOL bAdd
);
510 virtual ~ScUndoChartData();
514 virtual void Repeat(SfxRepeatTarget
& rTarget
);
515 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
517 virtual String
GetComment() const;
521 ScRangeListRef aOldRangeListRef
;
524 // ScRange aNewRange;
525 ScRangeListRef aNewRangeListRef
;
534 class ScUndoDataForm
: public ScBlockUndo
538 ScUndoDataForm( ScDocShell
* pNewDocShell
,
539 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
540 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
541 const ScMarkData
& rMark
,
542 ScDocument
* pNewUndoDoc
, ScDocument
* pNewRedoDoc
,
544 ScRefUndoData
* pRefData
, void* pFill1
, void* pFill2
, void* pFill3
,
545 BOOL bRedoIsFilled
= TRUE
547 virtual ~ScUndoDataForm();
551 virtual void Repeat(SfxRepeatTarget
& rTarget
);
552 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
554 virtual String
GetComment() const;
557 ScMarkData aMarkData
;
558 ScDocument
* pUndoDoc
;
559 ScDocument
* pRedoDoc
;
561 ScRefUndoData
* pRefUndoData
;
562 ScRefUndoData
* pRefRedoData
;
563 ULONG nStartChangeAction
;
564 ULONG nEndChangeAction
;
567 void DoChange( const BOOL bUndo
);
568 void SetChangeTrack();