update dev300-m57
[ooovba.git] / sc / source / ui / inc / undodat.hxx
blobd3912a9ff4d60ae317b48f8284e416b196fec7a6
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 "pivot.hxx"
41 class ScDocShell;
42 class ScDocument;
43 class ScOutlineTable;
44 class ScRangeName;
45 class ScDBData;
46 class ScDBCollection;
47 class ScDPObject;
48 class SdrUndoAction;
50 //----------------------------------------------------------------------------
52 class ScUndoDoOutline: public ScSimpleUndo
54 public:
55 TYPEINFO();
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();
62 virtual void Undo();
63 virtual void Redo();
64 virtual void Repeat(SfxRepeatTarget& rTarget);
65 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
67 virtual String GetComment() const;
69 private:
70 SCCOLROW nStart;
71 SCCOLROW nEnd;
72 SCTAB nTab;
73 ScDocument* pUndoDoc;
74 BOOL bColumns;
75 USHORT nLevel;
76 USHORT nEntry;
77 BOOL bShow;
81 class ScUndoMakeOutline: public ScSimpleUndo
83 public:
84 TYPEINFO();
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();
92 virtual void Undo();
93 virtual void Redo();
94 virtual void Repeat(SfxRepeatTarget& rTarget);
95 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
97 virtual String GetComment() const;
99 private:
100 ScAddress aBlockStart;
101 ScAddress aBlockEnd;
102 ScOutlineTable* pUndoTable;
103 BOOL bColumns;
104 BOOL bMake;
108 class ScUndoOutlineLevel: public ScSimpleUndo
110 public:
111 TYPEINFO();
112 ScUndoOutlineLevel( ScDocShell* pNewDocShell,
113 SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab,
114 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab,
115 BOOL bNewColumns, USHORT nNewLevel );
116 virtual ~ScUndoOutlineLevel();
118 virtual void Undo();
119 virtual void Redo();
120 virtual void Repeat(SfxRepeatTarget& rTarget);
121 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
123 virtual String GetComment() const;
125 private:
126 SCCOLROW nStart;
127 SCCOLROW nEnd;
128 SCTAB nTab;
129 ScDocument* pUndoDoc;
130 ScOutlineTable* pUndoTable;
131 BOOL bColumns;
132 USHORT nLevel;
136 class ScUndoOutlineBlock: public ScSimpleUndo
138 public:
139 TYPEINFO();
140 ScUndoOutlineBlock( ScDocShell* pNewDocShell,
141 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
142 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
143 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab,
144 BOOL bNewShow );
145 virtual ~ScUndoOutlineBlock();
147 virtual void Undo();
148 virtual void Redo();
149 virtual void Repeat(SfxRepeatTarget& rTarget);
150 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
152 virtual String GetComment() const;
154 private:
155 ScAddress aBlockStart;
156 ScAddress aBlockEnd;
157 ScDocument* pUndoDoc;
158 ScOutlineTable* pUndoTable;
159 BOOL bShow;
163 class ScUndoRemoveAllOutlines: public ScSimpleUndo
165 public:
166 TYPEINFO();
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();
173 virtual void Undo();
174 virtual void Redo();
175 virtual void Repeat(SfxRepeatTarget& rTarget);
176 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
178 virtual String GetComment() const;
180 private:
181 ScAddress aBlockStart;
182 ScAddress aBlockEnd;
183 ScDocument* pUndoDoc;
184 ScOutlineTable* pUndoTable;
188 class ScUndoAutoOutline: public ScSimpleUndo
190 public:
191 TYPEINFO();
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();
198 virtual void Undo();
199 virtual void Redo();
200 virtual void Repeat(SfxRepeatTarget& rTarget);
201 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
203 virtual String GetComment() const;
205 private:
206 ScAddress aBlockStart;
207 ScAddress aBlockEnd;
208 ScDocument* pUndoDoc;
209 ScOutlineTable* pUndoTable;
213 class ScUndoSubTotals: public ScDBFuncUndo
215 public:
216 TYPEINFO();
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();
224 virtual void Undo();
225 virtual void Redo();
226 virtual void Repeat(SfxRepeatTarget& rTarget);
227 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
229 virtual String GetComment() const;
231 private:
232 SCTAB nTab;
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
245 public:
246 TYPEINFO();
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();
253 virtual void Undo();
254 virtual void Redo();
255 virtual void Repeat(SfxRepeatTarget& rTarget);
256 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
258 virtual String GetComment() const;
260 private:
261 SCTAB nTab;
262 ScSortParam aSortParam;
263 BOOL bRepeatQuery;
264 ScDocument* pUndoDoc;
265 ScDBCollection* pUndoDB; // wegen Quell- und Zielbereich
266 BOOL bDestArea;
267 ScRange aDestRange;
271 class ScUndoQuery: public ScDBFuncUndo
273 public:
274 TYPEINFO();
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();
281 virtual void Undo();
282 virtual void Redo();
283 virtual void Repeat(SfxRepeatTarget& rTarget);
284 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
286 virtual String GetComment() const;
288 private:
289 SdrUndoAction* pDrawUndo;
290 SCTAB nTab;
291 ScQueryParam aQueryParam;
292 ScDocument* pUndoDoc;
293 ScDBCollection* pUndoDB; // wegen Quell- und Zielbereich
294 ScRange aOldDest;
295 ScRange aAdvSource;
296 BOOL bIsAdvanced;
297 BOOL bDestArea;
298 BOOL bDoSize;
302 class ScUndoAutoFilter: public ScDBFuncUndo
304 private:
305 String aDBName;
306 BOOL bFilterSet;
308 void DoChange( BOOL bUndo );
310 public:
311 TYPEINFO();
312 ScUndoAutoFilter( ScDocShell* pNewDocShell, const ScRange& rRange,
313 const String& rName, BOOL bSet );
314 virtual ~ScUndoAutoFilter();
316 virtual void Undo();
317 virtual void Redo();
318 virtual void Repeat(SfxRepeatTarget& rTarget);
319 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
321 virtual String GetComment() const;
325 class ScUndoDBData: public ScSimpleUndo
327 public:
328 TYPEINFO();
329 ScUndoDBData( ScDocShell* pNewDocShell,
330 ScDBCollection* pNewUndoColl, ScDBCollection* pNewRedoColl );
331 virtual ~ScUndoDBData();
333 virtual void Undo();
334 virtual void Redo();
335 virtual void Repeat(SfxRepeatTarget& rTarget);
336 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
338 virtual String GetComment() const;
340 private:
341 ScDBCollection* pUndoColl;
342 ScDBCollection* pRedoColl;
346 class ScUndoImportData: public ScSimpleUndo
348 public:
349 TYPEINFO();
350 ScUndoImportData( ScDocShell* pNewDocShell, SCTAB nNewTab,
351 const ScImportParam& rParam, SCCOL nNewEndX, SCROW nNewEndY,
352 SCCOL nNewFormula,
353 ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
354 ScDBData* pNewUndoData, ScDBData* pNewRedoData );
355 virtual ~ScUndoImportData();
357 virtual void Undo();
358 virtual void Redo();
359 virtual void Repeat(SfxRepeatTarget& rTarget);
360 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
362 virtual String GetComment() const;
364 private:
365 SCTAB nTab;
366 ScImportParam aImportParam;
367 SCCOL nEndCol;
368 SCROW nEndRow;
369 ScDocument* pUndoDoc;
370 ScDocument* pRedoDoc;
371 ScDBData* pUndoDBData;
372 ScDBData* pRedoDBData;
373 SCCOL nFormulaCols;
374 BOOL bRedoFilled;
378 class ScUndoRepeatDB: public ScSimpleUndo
380 public:
381 TYPEINFO();
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();
390 virtual void Undo();
391 virtual void Redo();
392 virtual void Repeat(SfxRepeatTarget& rTarget);
393 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
395 virtual String GetComment() const;
397 private:
398 ScAddress aBlockStart;
399 ScAddress aBlockEnd;
400 SCROW nNewEndRow;
401 ScAddress aCursorPos;
402 ScDocument* pUndoDoc;
403 ScOutlineTable* pUndoTable;
404 ScRangeName* pUndoRange;
405 ScDBCollection* pUndoDB;
406 ScRange aOldQuery;
407 ScRange aNewQuery;
408 BOOL bQuerySize;
411 //UNUSED2008-05 class ScUndoPivot: public ScSimpleUndo
412 //UNUSED2008-05 {
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();
420 //UNUSED2008-05
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;
425 //UNUSED2008-05
426 //UNUSED2008-05 virtual String GetComment() const;
427 //UNUSED2008-05
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;
443 //UNUSED2008-05 };
445 class ScUndoDataPilot: public ScSimpleUndo
447 public:
448 TYPEINFO();
449 ScUndoDataPilot( ScDocShell* pNewDocShell,
450 ScDocument* pOldDoc, ScDocument* pNewDoc,
451 const ScDPObject* pOldObj, const ScDPObject* pNewObj,
452 BOOL bMove );
453 virtual ~ScUndoDataPilot();
455 virtual void Undo();
456 virtual void Redo();
457 virtual void Repeat(SfxRepeatTarget& rTarget);
458 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
460 virtual String GetComment() const;
462 private:
463 ScDocument* pOldUndoDoc;
464 ScDocument* pNewUndoDoc;
465 ScDPObject* pOldDPObject;
466 ScDPObject* pNewDPObject;
467 BOOL bAllowMove;
471 class ScUndoConsolidate: public ScSimpleUndo
473 public:
474 TYPEINFO();
475 ScUndoConsolidate( ScDocShell* pNewDocShell,
476 const ScArea& rArea, const ScConsolidateParam& rPar,
477 ScDocument* pNewUndoDoc, BOOL bReference,
478 SCROW nInsCount, ScOutlineTable* pTab,
479 ScDBData* pData );
480 virtual ~ScUndoConsolidate();
482 virtual void Undo();
483 virtual void Redo();
484 virtual void Repeat(SfxRepeatTarget& rTarget);
485 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
487 virtual String GetComment() const;
489 private:
490 ScArea aDestArea;
491 ScDocument* pUndoDoc;
492 ScConsolidateParam aParam;
493 BOOL bInsRef;
494 SCSIZE nInsertCount;
495 ScOutlineTable* pUndoTab;
496 ScDBData* pUndoData;
500 class ScUndoChartData: public ScSimpleUndo
502 public:
503 TYPEINFO();
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();
512 virtual void Undo();
513 virtual void Redo();
514 virtual void Repeat(SfxRepeatTarget& rTarget);
515 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
517 virtual String GetComment() const;
519 private:
520 String aChartName;
521 ScRangeListRef aOldRangeListRef;
522 BOOL bOldColHeaders;
523 BOOL bOldRowHeaders;
524 // ScRange aNewRange;
525 ScRangeListRef aNewRangeListRef;
526 BOOL bNewColHeaders;
527 BOOL bNewRowHeaders;
528 BOOL bAddRange;
530 void Init();
533 // amelia
534 class ScUndoDataForm: public ScBlockUndo
536 public:
537 TYPEINFO();
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,
543 USHORT nNewFlags,
544 ScRefUndoData* pRefData, void* pFill1, void* pFill2, void* pFill3,
545 BOOL bRedoIsFilled = TRUE
547 virtual ~ScUndoDataForm();
549 virtual void Undo();
550 virtual void Redo();
551 virtual void Repeat(SfxRepeatTarget& rTarget);
552 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
554 virtual String GetComment() const;
556 private:
557 ScMarkData aMarkData;
558 ScDocument* pUndoDoc;
559 ScDocument* pRedoDoc;
560 USHORT nFlags;
561 ScRefUndoData* pRefUndoData;
562 ScRefUndoData* pRefRedoData;
563 ULONG nStartChangeAction;
564 ULONG nEndChangeAction;
565 BOOL bRedoFilled;
567 void DoChange( const BOOL bUndo );
568 void SetChangeTrack();
572 #endif