Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / undodat.hxx
blob23eb82d4bda83df2c8da4f71a177c387e3ec8261
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
29 #include "pivot.hxx"
31 #include <boost/scoped_ptr.hpp>
33 class ScDocShell;
34 class ScDocument;
35 class ScOutlineTable;
36 class ScRangeName;
37 class ScDBData;
38 class ScDBCollection;
39 class ScDPObject;
40 class SdrUndoAction;
41 class ScMarkData;
43 //----------------------------------------------------------------------------
45 class ScUndoDoOutline: public ScSimpleUndo
47 public:
48 TYPEINFO();
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();
55 virtual void Undo();
56 virtual void Redo();
57 virtual void Repeat(SfxRepeatTarget& rTarget);
58 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
60 virtual OUString GetComment() const;
62 private:
63 SCCOLROW nStart;
64 SCCOLROW nEnd;
65 SCTAB nTab;
66 ScDocument* pUndoDoc;
67 sal_Bool bColumns;
68 sal_uInt16 nLevel;
69 sal_uInt16 nEntry;
70 sal_Bool bShow;
74 class ScUndoMakeOutline: public ScSimpleUndo
76 public:
77 TYPEINFO();
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();
85 virtual void Undo();
86 virtual void Redo();
87 virtual void Repeat(SfxRepeatTarget& rTarget);
88 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
90 virtual OUString GetComment() const;
92 private:
93 ScAddress aBlockStart;
94 ScAddress aBlockEnd;
95 ScOutlineTable* pUndoTable;
96 sal_Bool bColumns;
97 sal_Bool bMake;
101 class ScUndoOutlineLevel: public ScSimpleUndo
103 public:
104 TYPEINFO();
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();
111 virtual void Undo();
112 virtual void Redo();
113 virtual void Repeat(SfxRepeatTarget& rTarget);
114 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
116 virtual OUString GetComment() const;
118 private:
119 SCCOLROW nStart;
120 SCCOLROW nEnd;
121 SCTAB nTab;
122 ScDocument* pUndoDoc;
123 ScOutlineTable* pUndoTable;
124 sal_Bool bColumns;
125 sal_uInt16 nLevel;
129 class ScUndoOutlineBlock: public ScSimpleUndo
131 public:
132 TYPEINFO();
133 ScUndoOutlineBlock( ScDocShell* pNewDocShell,
134 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
135 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
136 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab,
137 sal_Bool bNewShow );
138 virtual ~ScUndoOutlineBlock();
140 virtual void Undo();
141 virtual void Redo();
142 virtual void Repeat(SfxRepeatTarget& rTarget);
143 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
145 virtual OUString GetComment() const;
147 private:
148 ScAddress aBlockStart;
149 ScAddress aBlockEnd;
150 ScDocument* pUndoDoc;
151 ScOutlineTable* pUndoTable;
152 sal_Bool bShow;
156 class ScUndoRemoveAllOutlines: public ScSimpleUndo
158 public:
159 TYPEINFO();
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();
166 virtual void Undo();
167 virtual void Redo();
168 virtual void Repeat(SfxRepeatTarget& rTarget);
169 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
171 virtual OUString GetComment() const;
173 private:
174 ScAddress aBlockStart;
175 ScAddress aBlockEnd;
176 ScDocument* pUndoDoc;
177 ScOutlineTable* pUndoTable;
181 class ScUndoAutoOutline: public ScSimpleUndo
183 public:
184 TYPEINFO();
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();
191 virtual void Undo();
192 virtual void Redo();
193 virtual void Repeat(SfxRepeatTarget& rTarget);
194 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
196 virtual OUString GetComment() const;
198 private:
199 ScAddress aBlockStart;
200 ScAddress aBlockEnd;
201 ScDocument* pUndoDoc;
202 ScOutlineTable* pUndoTable;
206 class ScUndoSubTotals: public ScDBFuncUndo
208 public:
209 TYPEINFO();
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();
217 virtual void Undo();
218 virtual void Redo();
219 virtual void Repeat(SfxRepeatTarget& rTarget);
220 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
222 virtual OUString GetComment() const;
224 private:
225 SCTAB nTab;
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
238 public:
239 TYPEINFO();
240 ScUndoSort( ScDocShell* pNewDocShell, SCTAB nNewTab,
241 const ScSortParam& rParam,
242 ScDocument* pNewUndoDoc,
243 ScDBCollection* pNewUndoDB, const ScRange* pDest = NULL );
244 virtual ~ScUndoSort();
246 virtual void Undo();
247 virtual void Redo();
248 virtual void Repeat(SfxRepeatTarget& rTarget);
249 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
251 virtual OUString GetComment() const;
253 private:
254 SCTAB nTab;
255 ScSortParam aSortParam;
256 ScDocument* pUndoDoc;
257 ScDBCollection* pUndoDB; // due to source and target range
258 sal_Bool bDestArea;
259 ScRange aDestRange;
263 class ScUndoQuery: public ScDBFuncUndo
265 public:
266 TYPEINFO();
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();
273 virtual void Undo();
274 virtual void Redo();
275 virtual void Repeat(SfxRepeatTarget& rTarget);
276 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
278 virtual OUString GetComment() const;
280 private:
281 SdrUndoAction* pDrawUndo;
282 SCTAB nTab;
283 ScQueryParam aQueryParam;
284 ScDocument* pUndoDoc;
285 ScDBCollection* pUndoDB; // due to source and target range
286 ScRange aOldDest;
287 ScRange aAdvSource;
288 sal_Bool bIsAdvanced;
289 sal_Bool bDestArea;
290 sal_Bool bDoSize;
294 class ScUndoAutoFilter: public ScDBFuncUndo
296 private:
297 OUString aDBName;
298 bool bFilterSet;
300 void DoChange( bool bUndo );
302 public:
303 TYPEINFO();
304 ScUndoAutoFilter( ScDocShell* pNewDocShell, const ScRange& rRange,
305 const OUString& rName, bool bSet );
306 virtual ~ScUndoAutoFilter();
308 virtual void Undo();
309 virtual void Redo();
310 virtual void Repeat(SfxRepeatTarget& rTarget);
311 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
313 virtual OUString GetComment() const;
317 class ScUndoDBData: public ScSimpleUndo
319 public:
320 TYPEINFO();
321 ScUndoDBData( ScDocShell* pNewDocShell,
322 ScDBCollection* pNewUndoColl, ScDBCollection* pNewRedoColl );
323 virtual ~ScUndoDBData();
325 virtual void Undo();
326 virtual void Redo();
327 virtual void Repeat(SfxRepeatTarget& rTarget);
328 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
330 virtual OUString GetComment() const;
332 private:
333 ScDBCollection* pUndoColl;
334 ScDBCollection* pRedoColl;
338 class ScUndoImportData: public ScSimpleUndo
340 public:
341 TYPEINFO();
342 ScUndoImportData( ScDocShell* pNewDocShell, SCTAB nNewTab,
343 const ScImportParam& rParam, SCCOL nNewEndX, SCROW nNewEndY,
344 SCCOL nNewFormula,
345 ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
346 ScDBData* pNewUndoData, ScDBData* pNewRedoData );
347 virtual ~ScUndoImportData();
349 virtual void Undo();
350 virtual void Redo();
351 virtual void Repeat(SfxRepeatTarget& rTarget);
352 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
354 virtual OUString GetComment() const;
356 private:
357 SCTAB nTab;
358 ScImportParam aImportParam;
359 SCCOL nEndCol;
360 SCROW nEndRow;
361 ScDocument* pUndoDoc;
362 ScDocument* pRedoDoc;
363 ScDBData* pUndoDBData;
364 ScDBData* pRedoDBData;
365 SCCOL nFormulaCols;
366 sal_Bool bRedoFilled;
370 class ScUndoRepeatDB: public ScSimpleUndo
372 public:
373 TYPEINFO();
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();
382 virtual void Undo();
383 virtual void Redo();
384 virtual void Repeat(SfxRepeatTarget& rTarget);
385 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
387 virtual OUString GetComment() const;
389 private:
390 ScAddress aBlockStart;
391 ScAddress aBlockEnd;
392 SCROW nNewEndRow;
393 ScAddress aCursorPos;
394 ScDocument* pUndoDoc;
395 ScOutlineTable* pUndoTable;
396 ScRangeName* pUndoRange;
397 ScDBCollection* pUndoDB;
398 ScRange aOldQuery;
399 ScRange aNewQuery;
400 sal_Bool bQuerySize;
404 class ScUndoDataPilot: public ScSimpleUndo
406 public:
407 TYPEINFO();
408 ScUndoDataPilot( ScDocShell* pNewDocShell,
409 ScDocument* pOldDoc, ScDocument* pNewDoc,
410 const ScDPObject* pOldObj, const ScDPObject* pNewObj,
411 sal_Bool bMove );
412 virtual ~ScUndoDataPilot();
414 virtual void Undo();
415 virtual void Redo();
416 virtual void Repeat(SfxRepeatTarget& rTarget);
417 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
419 virtual OUString GetComment() const;
421 private:
422 ScDocument* pOldUndoDoc;
423 ScDocument* pNewUndoDoc;
424 ScDPObject* pOldDPObject;
425 ScDPObject* pNewDPObject;
426 sal_Bool bAllowMove;
430 class ScUndoConsolidate: public ScSimpleUndo
432 public:
433 TYPEINFO();
434 ScUndoConsolidate( ScDocShell* pNewDocShell,
435 const ScArea& rArea, const ScConsolidateParam& rPar,
436 ScDocument* pNewUndoDoc, sal_Bool bReference,
437 SCROW nInsCount, ScOutlineTable* pTab,
438 ScDBData* pData );
439 virtual ~ScUndoConsolidate();
441 virtual void Undo();
442 virtual void Redo();
443 virtual void Repeat(SfxRepeatTarget& rTarget);
444 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
446 virtual OUString GetComment() const;
448 private:
449 ScArea aDestArea;
450 ScDocument* pUndoDoc;
451 ScConsolidateParam aParam;
452 sal_Bool bInsRef;
453 SCSIZE nInsertCount;
454 ScOutlineTable* pUndoTab;
455 ScDBData* pUndoData;
459 class ScUndoChartData: public ScSimpleUndo
461 public:
462 TYPEINFO();
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();
471 virtual void Undo();
472 virtual void Redo();
473 virtual void Repeat(SfxRepeatTarget& rTarget);
474 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
476 virtual OUString GetComment() const;
478 private:
479 OUString aChartName;
480 ScRangeListRef aOldRangeListRef;
481 bool bOldColHeaders;
482 bool bOldRowHeaders;
483 // ScRange aNewRange;
484 ScRangeListRef aNewRangeListRef;
485 bool bNewColHeaders;
486 bool bNewRowHeaders;
487 bool bAddRange;
489 void Init();
492 class ScUndoDataForm: public ScBlockUndo
494 public:
495 TYPEINFO();
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();
507 virtual void Undo();
508 virtual void Redo();
509 virtual void Repeat(SfxRepeatTarget& rTarget);
510 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
512 virtual OUString GetComment() const;
514 private:
515 boost::scoped_ptr<ScMarkData> mpMarkData;
516 ScDocument* pUndoDoc;
517 ScDocument* pRedoDoc;
518 sal_uInt16 nFlags;
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();
530 #endif
532 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */