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"
39 #include "queryparam.hxx"
51 //----------------------------------------------------------------------------
53 class ScUndoDoOutline
: public ScSimpleUndo
57 ScUndoDoOutline( ScDocShell
* pNewDocShell
,
58 SCCOLROW nNewStart
, SCCOLROW nNewEnd
, SCTAB nNewTab
,
59 ScDocument
* pNewUndoDoc
, BOOL bNewColumns
,
60 USHORT nNewLevel
, USHORT nNewEntry
, BOOL bNewShow
);
61 virtual ~ScUndoDoOutline();
65 virtual void Repeat(SfxRepeatTarget
& rTarget
);
66 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
68 virtual String
GetComment() const;
82 class ScUndoMakeOutline
: public ScSimpleUndo
86 ScUndoMakeOutline( ScDocShell
* pNewDocShell
,
87 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
88 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
89 ScOutlineTable
* pNewUndoTab
,
90 BOOL bNewColumns
, BOOL bNewMake
);
91 virtual ~ScUndoMakeOutline();
95 virtual void Repeat(SfxRepeatTarget
& rTarget
);
96 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
98 virtual String
GetComment() const;
101 ScAddress aBlockStart
;
103 ScOutlineTable
* pUndoTable
;
109 class ScUndoOutlineLevel
: public ScSimpleUndo
113 ScUndoOutlineLevel( ScDocShell
* pNewDocShell
,
114 SCCOLROW nNewStart
, SCCOLROW nNewEnd
, SCTAB nNewTab
,
115 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
116 BOOL bNewColumns
, USHORT nNewLevel
);
117 virtual ~ScUndoOutlineLevel();
121 virtual void Repeat(SfxRepeatTarget
& rTarget
);
122 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
124 virtual String
GetComment() const;
130 ScDocument
* pUndoDoc
;
131 ScOutlineTable
* pUndoTable
;
137 class ScUndoOutlineBlock
: public ScSimpleUndo
141 ScUndoOutlineBlock( ScDocShell
* pNewDocShell
,
142 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
143 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
144 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
146 virtual ~ScUndoOutlineBlock();
150 virtual void Repeat(SfxRepeatTarget
& rTarget
);
151 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
153 virtual String
GetComment() const;
156 ScAddress aBlockStart
;
158 ScDocument
* pUndoDoc
;
159 ScOutlineTable
* pUndoTable
;
164 class ScUndoRemoveAllOutlines
: public ScSimpleUndo
168 ScUndoRemoveAllOutlines( ScDocShell
* pNewDocShell
,
169 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
170 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
171 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
);
172 virtual ~ScUndoRemoveAllOutlines();
176 virtual void Repeat(SfxRepeatTarget
& rTarget
);
177 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
179 virtual String
GetComment() const;
182 ScAddress aBlockStart
;
184 ScDocument
* pUndoDoc
;
185 ScOutlineTable
* pUndoTable
;
189 class ScUndoAutoOutline
: public ScSimpleUndo
193 ScUndoAutoOutline( ScDocShell
* pNewDocShell
,
194 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
195 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
196 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
);
197 virtual ~ScUndoAutoOutline();
201 virtual void Repeat(SfxRepeatTarget
& rTarget
);
202 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
204 virtual String
GetComment() const;
207 ScAddress aBlockStart
;
209 ScDocument
* pUndoDoc
;
210 ScOutlineTable
* pUndoTable
;
214 class ScUndoSubTotals
: public ScDBFuncUndo
218 ScUndoSubTotals( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
219 const ScSubTotalParam
& rNewParam
, SCROW nNewEndY
,
220 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
221 // ScDBData* pNewData,
222 ScRangeName
* pNewUndoRange
, ScDBCollection
* pNewUndoDB
);
223 virtual ~ScUndoSubTotals();
227 virtual void Repeat(SfxRepeatTarget
& rTarget
);
228 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
230 virtual String
GetComment() const;
234 ScSubTotalParam aParam
; // Original uebergebener Parameter
235 SCROW nNewEndRow
; // Ergebnis-Groesse
236 ScDocument
* pUndoDoc
;
237 ScOutlineTable
* pUndoTable
;
238 // ScDBData* pUndoDBData;
239 ScRangeName
* pUndoRange
;
240 ScDBCollection
* pUndoDB
;
244 class ScUndoSort
: public ScDBFuncUndo
248 ScUndoSort( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
249 const ScSortParam
& rParam
,
250 BOOL bQuery
, ScDocument
* pNewUndoDoc
,
251 ScDBCollection
* pNewUndoDB
, const ScRange
* pDest
= NULL
);
252 virtual ~ScUndoSort();
256 virtual void Repeat(SfxRepeatTarget
& rTarget
);
257 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
259 virtual String
GetComment() const;
263 ScSortParam aSortParam
;
265 ScDocument
* pUndoDoc
;
266 ScDBCollection
* pUndoDB
; // wegen Quell- und Zielbereich
272 class ScUndoQuery
: public ScDBFuncUndo
276 ScUndoQuery( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
277 const ScQueryParam
& rParam
, ScDocument
* pNewUndoDoc
,
278 ScDBCollection
* pNewUndoDB
, const ScRange
* pOld
,
279 BOOL bSize
, const ScRange
* pAdvSrc
);
280 virtual ~ScUndoQuery();
284 virtual void Repeat(SfxRepeatTarget
& rTarget
);
285 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
287 virtual String
GetComment() const;
290 SdrUndoAction
* pDrawUndo
;
292 ScQueryParam aQueryParam
;
293 ScDocument
* pUndoDoc
;
294 ScDBCollection
* pUndoDB
; // wegen Quell- und Zielbereich
303 class ScUndoAutoFilter
: public ScDBFuncUndo
309 void DoChange( BOOL bUndo
);
313 ScUndoAutoFilter( ScDocShell
* pNewDocShell
, const ScRange
& rRange
,
314 const String
& rName
, BOOL bSet
);
315 virtual ~ScUndoAutoFilter();
319 virtual void Repeat(SfxRepeatTarget
& rTarget
);
320 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
322 virtual String
GetComment() const;
326 class ScUndoDBData
: public ScSimpleUndo
330 ScUndoDBData( ScDocShell
* pNewDocShell
,
331 ScDBCollection
* pNewUndoColl
, ScDBCollection
* pNewRedoColl
);
332 virtual ~ScUndoDBData();
336 virtual void Repeat(SfxRepeatTarget
& rTarget
);
337 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
339 virtual String
GetComment() const;
342 ScDBCollection
* pUndoColl
;
343 ScDBCollection
* pRedoColl
;
347 class ScUndoImportData
: public ScSimpleUndo
351 ScUndoImportData( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
352 const ScImportParam
& rParam
, SCCOL nNewEndX
, SCROW nNewEndY
,
354 ScDocument
* pNewUndoDoc
, ScDocument
* pNewRedoDoc
,
355 ScDBData
* pNewUndoData
, ScDBData
* pNewRedoData
);
356 virtual ~ScUndoImportData();
360 virtual void Repeat(SfxRepeatTarget
& rTarget
);
361 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
363 virtual String
GetComment() const;
367 ScImportParam aImportParam
;
370 ScDocument
* pUndoDoc
;
371 ScDocument
* pRedoDoc
;
372 ScDBData
* pUndoDBData
;
373 ScDBData
* pRedoDBData
;
379 class ScUndoRepeatDB
: public ScSimpleUndo
383 ScUndoRepeatDB( ScDocShell
* pNewDocShell
, SCTAB nNewTab
,
384 SCCOL nStartX
, SCROW nStartY
, SCCOL nEndX
, SCROW nEndY
,
385 SCROW nResultEndRow
, SCCOL nCurX
, SCROW nCurY
,
386 ScDocument
* pNewUndoDoc
, ScOutlineTable
* pNewUndoTab
,
387 ScRangeName
* pNewUndoRange
, ScDBCollection
* pNewUndoDB
,
388 const ScRange
* pOldQ
, const ScRange
* pNewQ
);
389 virtual ~ScUndoRepeatDB();
393 virtual void Repeat(SfxRepeatTarget
& rTarget
);
394 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
396 virtual String
GetComment() const;
399 ScAddress aBlockStart
;
402 ScAddress aCursorPos
;
403 ScDocument
* pUndoDoc
;
404 ScOutlineTable
* pUndoTable
;
405 ScRangeName
* pUndoRange
;
406 ScDBCollection
* pUndoDB
;
412 //UNUSED2008-05 class ScUndoPivot: public ScSimpleUndo
414 //UNUSED2008-05 public:
415 //UNUSED2008-05 TYPEINFO();
416 //UNUSED2008-05 ScUndoPivot( ScDocShell* pNewDocShell,
417 //UNUSED2008-05 const ScArea& rOld, const ScArea& rNew,
418 //UNUSED2008-05 ScDocument* pOldDoc, ScDocument* pNewDoc,
419 //UNUSED2008-05 const ScPivot* pOldPivot, const ScPivot* pNewPivot );
420 //UNUSED2008-05 virtual ~ScUndoPivot();
422 //UNUSED2008-05 virtual void Undo();
423 //UNUSED2008-05 virtual void Redo();
424 //UNUSED2008-05 virtual void Repeat(SfxRepeatTarget& rTarget);
425 //UNUSED2008-05 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
427 //UNUSED2008-05 virtual String GetComment() const;
429 //UNUSED2008-05 private:
430 //UNUSED2008-05 ScArea aOldArea;
431 //UNUSED2008-05 ScArea aNewArea;
432 //UNUSED2008-05 ScDocument* pOldUndoDoc;
433 //UNUSED2008-05 ScDocument* pNewUndoDoc;
434 //UNUSED2008-05 ScPivotParam aOldParam; // fuer Redo
435 //UNUSED2008-05 ScQueryParam aOldQuery;
436 //UNUSED2008-05 ScArea aOldSrc;
437 //UNUSED2008-05 ScPivotParam aNewParam; // fuer Undo in Collection
438 //UNUSED2008-05 ScQueryParam aNewQuery;
439 //UNUSED2008-05 ScArea aNewSrc;
440 //UNUSED2008-05 String aOldName;
441 //UNUSED2008-05 String aOldTag;
442 //UNUSED2008-05 String aNewName;
443 //UNUSED2008-05 String aNewTag;
446 class ScUndoDataPilot
: public ScSimpleUndo
450 ScUndoDataPilot( ScDocShell
* pNewDocShell
,
451 ScDocument
* pOldDoc
, ScDocument
* pNewDoc
,
452 const ScDPObject
* pOldObj
, const ScDPObject
* pNewObj
,
454 virtual ~ScUndoDataPilot();
458 virtual void Repeat(SfxRepeatTarget
& rTarget
);
459 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
461 virtual String
GetComment() const;
464 ScDocument
* pOldUndoDoc
;
465 ScDocument
* pNewUndoDoc
;
466 ScDPObject
* pOldDPObject
;
467 ScDPObject
* pNewDPObject
;
472 class ScUndoConsolidate
: public ScSimpleUndo
476 ScUndoConsolidate( ScDocShell
* pNewDocShell
,
477 const ScArea
& rArea
, const ScConsolidateParam
& rPar
,
478 ScDocument
* pNewUndoDoc
, BOOL bReference
,
479 SCROW nInsCount
, ScOutlineTable
* pTab
,
481 virtual ~ScUndoConsolidate();
485 virtual void Repeat(SfxRepeatTarget
& rTarget
);
486 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
488 virtual String
GetComment() const;
492 ScDocument
* pUndoDoc
;
493 ScConsolidateParam aParam
;
496 ScOutlineTable
* pUndoTab
;
501 class ScUndoChartData
: public ScSimpleUndo
505 ScUndoChartData( ScDocShell
* pNewDocShell
,
506 const String
& rName
, const ScRange
& rNew
,
507 BOOL bColHdr
, BOOL bRowHdr
, BOOL bAdd
);
508 ScUndoChartData( ScDocShell
* pNewDocShell
,
509 const String
& rName
, const ScRangeListRef
& rNew
,
510 BOOL bColHdr
, BOOL bRowHdr
, BOOL bAdd
);
511 virtual ~ScUndoChartData();
515 virtual void Repeat(SfxRepeatTarget
& rTarget
);
516 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
518 virtual String
GetComment() const;
522 ScRangeListRef aOldRangeListRef
;
525 // ScRange aNewRange;
526 ScRangeListRef aNewRangeListRef
;
535 class ScUndoDataForm
: public ScBlockUndo
539 ScUndoDataForm( ScDocShell
* pNewDocShell
,
540 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
541 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
542 const ScMarkData
& rMark
,
543 ScDocument
* pNewUndoDoc
, ScDocument
* pNewRedoDoc
,
545 ScRefUndoData
* pRefData
, void* pFill1
, void* pFill2
, void* pFill3
,
546 BOOL bRedoIsFilled
= TRUE
548 virtual ~ScUndoDataForm();
552 virtual void Repeat(SfxRepeatTarget
& rTarget
);
553 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
555 virtual String
GetComment() const;
558 ScMarkData aMarkData
;
559 ScDocument
* pUndoDoc
;
560 ScDocument
* pRedoDoc
;
562 ScRefUndoData
* pRefUndoData
;
563 ScRefUndoData
* pRefRedoData
;
564 ULONG nStartChangeAction
;
565 ULONG nEndChangeAction
;
568 void DoChange( const BOOL bUndo
);
569 void SetChangeTrack();