update dev300-m58
[ooovba.git] / sc / source / ui / inc / undodat.hxx
blob98599538d18f88c3f5e0462e61a9a018c6122818
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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"
40 #include "pivot.hxx"
42 class ScDocShell;
43 class ScDocument;
44 class ScOutlineTable;
45 class ScRangeName;
46 class ScDBData;
47 class ScDBCollection;
48 class ScDPObject;
49 class SdrUndoAction;
51 //----------------------------------------------------------------------------
53 class ScUndoDoOutline: public ScSimpleUndo
55 public:
56 TYPEINFO();
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();
63 virtual void Undo();
64 virtual void Redo();
65 virtual void Repeat(SfxRepeatTarget& rTarget);
66 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
68 virtual String GetComment() const;
70 private:
71 SCCOLROW nStart;
72 SCCOLROW nEnd;
73 SCTAB nTab;
74 ScDocument* pUndoDoc;
75 BOOL bColumns;
76 USHORT nLevel;
77 USHORT nEntry;
78 BOOL bShow;
82 class ScUndoMakeOutline: public ScSimpleUndo
84 public:
85 TYPEINFO();
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();
93 virtual void Undo();
94 virtual void Redo();
95 virtual void Repeat(SfxRepeatTarget& rTarget);
96 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
98 virtual String GetComment() const;
100 private:
101 ScAddress aBlockStart;
102 ScAddress aBlockEnd;
103 ScOutlineTable* pUndoTable;
104 BOOL bColumns;
105 BOOL bMake;
109 class ScUndoOutlineLevel: public ScSimpleUndo
111 public:
112 TYPEINFO();
113 ScUndoOutlineLevel( ScDocShell* pNewDocShell,
114 SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab,
115 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab,
116 BOOL bNewColumns, USHORT nNewLevel );
117 virtual ~ScUndoOutlineLevel();
119 virtual void Undo();
120 virtual void Redo();
121 virtual void Repeat(SfxRepeatTarget& rTarget);
122 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
124 virtual String GetComment() const;
126 private:
127 SCCOLROW nStart;
128 SCCOLROW nEnd;
129 SCTAB nTab;
130 ScDocument* pUndoDoc;
131 ScOutlineTable* pUndoTable;
132 BOOL bColumns;
133 USHORT nLevel;
137 class ScUndoOutlineBlock: public ScSimpleUndo
139 public:
140 TYPEINFO();
141 ScUndoOutlineBlock( ScDocShell* pNewDocShell,
142 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
143 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
144 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab,
145 BOOL bNewShow );
146 virtual ~ScUndoOutlineBlock();
148 virtual void Undo();
149 virtual void Redo();
150 virtual void Repeat(SfxRepeatTarget& rTarget);
151 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
153 virtual String GetComment() const;
155 private:
156 ScAddress aBlockStart;
157 ScAddress aBlockEnd;
158 ScDocument* pUndoDoc;
159 ScOutlineTable* pUndoTable;
160 BOOL bShow;
164 class ScUndoRemoveAllOutlines: public ScSimpleUndo
166 public:
167 TYPEINFO();
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();
174 virtual void Undo();
175 virtual void Redo();
176 virtual void Repeat(SfxRepeatTarget& rTarget);
177 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
179 virtual String GetComment() const;
181 private:
182 ScAddress aBlockStart;
183 ScAddress aBlockEnd;
184 ScDocument* pUndoDoc;
185 ScOutlineTable* pUndoTable;
189 class ScUndoAutoOutline: public ScSimpleUndo
191 public:
192 TYPEINFO();
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();
199 virtual void Undo();
200 virtual void Redo();
201 virtual void Repeat(SfxRepeatTarget& rTarget);
202 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
204 virtual String GetComment() const;
206 private:
207 ScAddress aBlockStart;
208 ScAddress aBlockEnd;
209 ScDocument* pUndoDoc;
210 ScOutlineTable* pUndoTable;
214 class ScUndoSubTotals: public ScDBFuncUndo
216 public:
217 TYPEINFO();
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();
225 virtual void Undo();
226 virtual void Redo();
227 virtual void Repeat(SfxRepeatTarget& rTarget);
228 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
230 virtual String GetComment() const;
232 private:
233 SCTAB nTab;
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
246 public:
247 TYPEINFO();
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();
254 virtual void Undo();
255 virtual void Redo();
256 virtual void Repeat(SfxRepeatTarget& rTarget);
257 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
259 virtual String GetComment() const;
261 private:
262 SCTAB nTab;
263 ScSortParam aSortParam;
264 BOOL bRepeatQuery;
265 ScDocument* pUndoDoc;
266 ScDBCollection* pUndoDB; // wegen Quell- und Zielbereich
267 BOOL bDestArea;
268 ScRange aDestRange;
272 class ScUndoQuery: public ScDBFuncUndo
274 public:
275 TYPEINFO();
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();
282 virtual void Undo();
283 virtual void Redo();
284 virtual void Repeat(SfxRepeatTarget& rTarget);
285 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
287 virtual String GetComment() const;
289 private:
290 SdrUndoAction* pDrawUndo;
291 SCTAB nTab;
292 ScQueryParam aQueryParam;
293 ScDocument* pUndoDoc;
294 ScDBCollection* pUndoDB; // wegen Quell- und Zielbereich
295 ScRange aOldDest;
296 ScRange aAdvSource;
297 BOOL bIsAdvanced;
298 BOOL bDestArea;
299 BOOL bDoSize;
303 class ScUndoAutoFilter: public ScDBFuncUndo
305 private:
306 String aDBName;
307 BOOL bFilterSet;
309 void DoChange( BOOL bUndo );
311 public:
312 TYPEINFO();
313 ScUndoAutoFilter( ScDocShell* pNewDocShell, const ScRange& rRange,
314 const String& rName, BOOL bSet );
315 virtual ~ScUndoAutoFilter();
317 virtual void Undo();
318 virtual void Redo();
319 virtual void Repeat(SfxRepeatTarget& rTarget);
320 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
322 virtual String GetComment() const;
326 class ScUndoDBData: public ScSimpleUndo
328 public:
329 TYPEINFO();
330 ScUndoDBData( ScDocShell* pNewDocShell,
331 ScDBCollection* pNewUndoColl, ScDBCollection* pNewRedoColl );
332 virtual ~ScUndoDBData();
334 virtual void Undo();
335 virtual void Redo();
336 virtual void Repeat(SfxRepeatTarget& rTarget);
337 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
339 virtual String GetComment() const;
341 private:
342 ScDBCollection* pUndoColl;
343 ScDBCollection* pRedoColl;
347 class ScUndoImportData: public ScSimpleUndo
349 public:
350 TYPEINFO();
351 ScUndoImportData( ScDocShell* pNewDocShell, SCTAB nNewTab,
352 const ScImportParam& rParam, SCCOL nNewEndX, SCROW nNewEndY,
353 SCCOL nNewFormula,
354 ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
355 ScDBData* pNewUndoData, ScDBData* pNewRedoData );
356 virtual ~ScUndoImportData();
358 virtual void Undo();
359 virtual void Redo();
360 virtual void Repeat(SfxRepeatTarget& rTarget);
361 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
363 virtual String GetComment() const;
365 private:
366 SCTAB nTab;
367 ScImportParam aImportParam;
368 SCCOL nEndCol;
369 SCROW nEndRow;
370 ScDocument* pUndoDoc;
371 ScDocument* pRedoDoc;
372 ScDBData* pUndoDBData;
373 ScDBData* pRedoDBData;
374 SCCOL nFormulaCols;
375 BOOL bRedoFilled;
379 class ScUndoRepeatDB: public ScSimpleUndo
381 public:
382 TYPEINFO();
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();
391 virtual void Undo();
392 virtual void Redo();
393 virtual void Repeat(SfxRepeatTarget& rTarget);
394 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
396 virtual String GetComment() const;
398 private:
399 ScAddress aBlockStart;
400 ScAddress aBlockEnd;
401 SCROW nNewEndRow;
402 ScAddress aCursorPos;
403 ScDocument* pUndoDoc;
404 ScOutlineTable* pUndoTable;
405 ScRangeName* pUndoRange;
406 ScDBCollection* pUndoDB;
407 ScRange aOldQuery;
408 ScRange aNewQuery;
409 BOOL bQuerySize;
412 //UNUSED2008-05 class ScUndoPivot: public ScSimpleUndo
413 //UNUSED2008-05 {
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();
421 //UNUSED2008-05
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;
426 //UNUSED2008-05
427 //UNUSED2008-05 virtual String GetComment() const;
428 //UNUSED2008-05
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;
444 //UNUSED2008-05 };
446 class ScUndoDataPilot: public ScSimpleUndo
448 public:
449 TYPEINFO();
450 ScUndoDataPilot( ScDocShell* pNewDocShell,
451 ScDocument* pOldDoc, ScDocument* pNewDoc,
452 const ScDPObject* pOldObj, const ScDPObject* pNewObj,
453 BOOL bMove );
454 virtual ~ScUndoDataPilot();
456 virtual void Undo();
457 virtual void Redo();
458 virtual void Repeat(SfxRepeatTarget& rTarget);
459 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
461 virtual String GetComment() const;
463 private:
464 ScDocument* pOldUndoDoc;
465 ScDocument* pNewUndoDoc;
466 ScDPObject* pOldDPObject;
467 ScDPObject* pNewDPObject;
468 BOOL bAllowMove;
472 class ScUndoConsolidate: public ScSimpleUndo
474 public:
475 TYPEINFO();
476 ScUndoConsolidate( ScDocShell* pNewDocShell,
477 const ScArea& rArea, const ScConsolidateParam& rPar,
478 ScDocument* pNewUndoDoc, BOOL bReference,
479 SCROW nInsCount, ScOutlineTable* pTab,
480 ScDBData* pData );
481 virtual ~ScUndoConsolidate();
483 virtual void Undo();
484 virtual void Redo();
485 virtual void Repeat(SfxRepeatTarget& rTarget);
486 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
488 virtual String GetComment() const;
490 private:
491 ScArea aDestArea;
492 ScDocument* pUndoDoc;
493 ScConsolidateParam aParam;
494 BOOL bInsRef;
495 SCSIZE nInsertCount;
496 ScOutlineTable* pUndoTab;
497 ScDBData* pUndoData;
501 class ScUndoChartData: public ScSimpleUndo
503 public:
504 TYPEINFO();
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();
513 virtual void Undo();
514 virtual void Redo();
515 virtual void Repeat(SfxRepeatTarget& rTarget);
516 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
518 virtual String GetComment() const;
520 private:
521 String aChartName;
522 ScRangeListRef aOldRangeListRef;
523 BOOL bOldColHeaders;
524 BOOL bOldRowHeaders;
525 // ScRange aNewRange;
526 ScRangeListRef aNewRangeListRef;
527 BOOL bNewColHeaders;
528 BOOL bNewRowHeaders;
529 BOOL bAddRange;
531 void Init();
534 // amelia
535 class ScUndoDataForm: public ScBlockUndo
537 public:
538 TYPEINFO();
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,
544 USHORT nNewFlags,
545 ScRefUndoData* pRefData, void* pFill1, void* pFill2, void* pFill3,
546 BOOL bRedoIsFilled = TRUE
548 virtual ~ScUndoDataForm();
550 virtual void Undo();
551 virtual void Redo();
552 virtual void Repeat(SfxRepeatTarget& rTarget);
553 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
555 virtual String GetComment() const;
557 private:
558 ScMarkData aMarkData;
559 ScDocument* pUndoDoc;
560 ScDocument* pRedoDoc;
561 USHORT nFlags;
562 ScRefUndoData* pRefUndoData;
563 ScRefUndoData* pRefRedoData;
564 ULONG nStartChangeAction;
565 ULONG nEndChangeAction;
566 BOOL bRedoFilled;
568 void DoChange( const BOOL bUndo );
569 void SetChangeTrack();
573 #endif