Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef SC_UNDOBLK_HXX
20 : #define SC_UNDOBLK_HXX
21 :
22 : #include "undobase.hxx"
23 : #include "markdata.hxx"
24 : #include "viewutil.hxx"
25 : #include "spellparam.hxx"
26 : #include "cellmergeoption.hxx"
27 :
28 : #include <boost/shared_ptr.hpp>
29 : #include <boost/scoped_ptr.hpp>
30 :
31 : class ScDocShell;
32 : class ScDocument;
33 : class ScOutlineTable;
34 : class ScRangeList;
35 : class ScPatternAttr;
36 : class SvxBoxItem;
37 : class SvxBoxInfoItem;
38 : class SvxSearchItem;
39 : class SdrUndoAction;
40 : class ScEditDataArray;
41 :
42 : //----------------------------------------------------------------------------
43 :
44 : class ScUndoInsertCells: public ScMoveUndo
45 : {
46 : public:
47 : TYPEINFO();
48 : ScUndoInsertCells( ScDocShell* pNewDocShell,
49 : const ScRange& rRange, SCTAB nNewCount, SCTAB* pNewTabs, SCTAB* pNewScenarios,
50 : InsCellCmd eNewCmd, ScDocument* pUndoDocument, ScRefUndoData* pRefData,
51 : sal_Bool bNewPartOfPaste );
52 : virtual ~ScUndoInsertCells();
53 :
54 : virtual void Undo();
55 : virtual void Redo();
56 : virtual void Repeat( SfxRepeatTarget& rTarget );
57 : virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const;
58 :
59 : virtual OUString GetComment() const;
60 :
61 : virtual bool Merge( SfxUndoAction *pNextAction );
62 :
63 : private:
64 : ScRange aEffRange;
65 : SCTAB nCount;
66 : SCTAB* pTabs;
67 : SCTAB* pScenarios;
68 : sal_uLong nEndChangeAction;
69 : InsCellCmd eCmd;
70 : sal_Bool bPartOfPaste;
71 : SfxUndoAction* pPasteUndo;
72 :
73 : void DoChange ( const sal_Bool bUndo );
74 : void SetChangeTrack();
75 : };
76 :
77 :
78 : class ScUndoDeleteCells: public ScMoveUndo
79 : {
80 : public:
81 : TYPEINFO();
82 : ScUndoDeleteCells( ScDocShell* pNewDocShell,
83 : const ScRange& rRange, SCTAB nNewCount, SCTAB* pNewTabs, SCTAB* pNewScenarios,
84 : DelCellCmd eNewCmd, ScDocument* pUndoDocument, ScRefUndoData* pRefData );
85 : virtual ~ScUndoDeleteCells();
86 :
87 : virtual void Undo();
88 : virtual void Redo();
89 : virtual void Repeat(SfxRepeatTarget& rTarget);
90 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
91 :
92 : virtual OUString GetComment() const;
93 :
94 : private:
95 : ScRange aEffRange;
96 : SCTAB nCount;
97 : SCTAB* pTabs;
98 : SCTAB* pScenarios;
99 : sal_uLong nStartChangeAction;
100 : sal_uLong nEndChangeAction;
101 : DelCellCmd eCmd;
102 :
103 : void DoChange ( const sal_Bool bUndo );
104 : void SetChangeTrack();
105 : };
106 :
107 :
108 : class ScUndoDeleteMulti: public ScMoveUndo
109 : {
110 : public:
111 : TYPEINFO();
112 : ScUndoDeleteMulti( ScDocShell* pNewDocShell,
113 : sal_Bool bNewRows, sal_Bool bNeedsRefresh, SCTAB nNewTab,
114 : const SCCOLROW* pRng, SCCOLROW nRngCnt,
115 : ScDocument* pUndoDocument, ScRefUndoData* pRefData );
116 : virtual ~ScUndoDeleteMulti();
117 :
118 : virtual void Undo();
119 : virtual void Redo();
120 : virtual void Repeat(SfxRepeatTarget& rTarget);
121 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
122 :
123 : virtual OUString GetComment() const;
124 :
125 : private:
126 : sal_Bool bRows;
127 : sal_Bool bRefresh;
128 : SCTAB nTab;
129 : SCCOLROW* pRanges;
130 : SCCOLROW nRangeCnt;
131 : sal_uLong nStartChangeAction;
132 : sal_uLong nEndChangeAction;
133 :
134 : void DoChange() const;
135 : void SetChangeTrack();
136 : };
137 :
138 :
139 : class ScUndoCut: public ScBlockUndo
140 : {
141 : public:
142 : TYPEINFO();
143 : ScUndoCut( ScDocShell* pNewDocShell,
144 : ScRange aRange, // adjusted for merged cells
145 : ScAddress aOldEnd, // end position without adjustment
146 : const ScMarkData& rMark, // selected sheets
147 : ScDocument* pNewUndoDoc );
148 : virtual ~ScUndoCut();
149 :
150 : virtual void Undo();
151 : virtual void Redo();
152 : virtual void Repeat(SfxRepeatTarget& rTarget);
153 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
154 :
155 : virtual OUString GetComment() const;
156 :
157 : private:
158 : ScMarkData aMarkData;
159 : ScDocument* pUndoDoc;
160 : ScRange aExtendedRange;
161 : sal_uLong nStartChangeAction;
162 : sal_uLong nEndChangeAction;
163 :
164 : void DoChange( const sal_Bool bUndo );
165 : void SetChangeTrack();
166 : };
167 :
168 :
169 : struct ScUndoPasteOptions
170 : {
171 : sal_uInt16 nFunction;
172 : sal_Bool bSkipEmpty;
173 : sal_Bool bTranspose;
174 : sal_Bool bAsLink;
175 : InsCellCmd eMoveMode;
176 :
177 43 : ScUndoPasteOptions() :
178 : nFunction( PASTE_NOFUNC ),
179 : bSkipEmpty( false ),
180 : bTranspose( false ),
181 : bAsLink( false ),
182 43 : eMoveMode( INS_NONE )
183 43 : {}
184 : };
185 :
186 : class ScUndoPaste: public ScMultiBlockUndo
187 : {
188 : public:
189 : TYPEINFO();
190 : ScUndoPaste(ScDocShell* pNewDocShell, const ScRangeList& rRanges,
191 : const ScMarkData& rMark,
192 : ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
193 : sal_uInt16 nNewFlags,
194 : ScRefUndoData* pRefData,
195 : bool bRedoIsFilled = true,
196 : const ScUndoPasteOptions* pOptions = NULL);
197 : virtual ~ScUndoPaste();
198 :
199 : virtual void Undo();
200 : virtual void Redo();
201 : virtual void Repeat(SfxRepeatTarget& rTarget);
202 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
203 :
204 : virtual OUString GetComment() const;
205 :
206 : private:
207 : ScMarkData aMarkData;
208 : ScDocument* pUndoDoc;
209 : ScDocument* pRedoDoc;
210 : sal_uInt16 nFlags;
211 : ScRefUndoData* pRefUndoData;
212 : ScRefUndoData* pRefRedoData;
213 : sal_uLong nStartChangeAction;
214 : sal_uLong nEndChangeAction;
215 : sal_Bool bRedoFilled;
216 : ScUndoPasteOptions aPasteOptions;
217 :
218 : void DoChange(bool bUndo);
219 : void SetChangeTrack();
220 : };
221 :
222 :
223 : class ScUndoDragDrop: public ScMoveUndo
224 : {
225 : public:
226 : TYPEINFO();
227 : ScUndoDragDrop( ScDocShell* pNewDocShell,
228 : const ScRange& rRange, ScAddress aNewDestPos, sal_Bool bNewCut,
229 : ScDocument* pUndoDocument, ScRefUndoData* pRefData,
230 : sal_Bool bScenario );
231 : virtual ~ScUndoDragDrop();
232 :
233 : virtual void Undo();
234 : virtual void Redo();
235 : virtual void Repeat(SfxRepeatTarget& rTarget);
236 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
237 :
238 : virtual OUString GetComment() const;
239 :
240 : private:
241 : ScRange aSrcRange;
242 : ScRange aDestRange;
243 : sal_uLong nStartChangeAction;
244 : sal_uLong nEndChangeAction;
245 : sal_Bool bCut;
246 : sal_Bool bKeepScenarioFlags;
247 :
248 : void PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const;
249 : void DoUndo( ScRange aRange ) const;
250 :
251 : void SetChangeTrack();
252 : };
253 :
254 :
255 : class ScUndoDeleteContents: public ScSimpleUndo
256 : {
257 : public:
258 : TYPEINFO();
259 : ScUndoDeleteContents( ScDocShell* pNewDocShell,
260 : const ScMarkData& rMark,
261 : const ScRange& rRange,
262 : ScDocument* pNewUndoDoc, sal_Bool bNewMulti,
263 : sal_uInt16 nNewFlags, sal_Bool bObjects );
264 : virtual ~ScUndoDeleteContents();
265 :
266 : virtual void Undo();
267 : virtual void Redo();
268 : virtual void Repeat(SfxRepeatTarget& rTarget);
269 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
270 :
271 : virtual OUString GetComment() const;
272 :
273 : private:
274 : ScRange aRange;
275 : ScMarkData aMarkData;
276 : ScDocument* pUndoDoc; // Block mark and deleted data
277 : SdrUndoAction* pDrawUndo; // Deleted objects
278 : sal_uLong nStartChangeAction;
279 : sal_uLong nEndChangeAction;
280 : sal_uInt16 nFlags;
281 : sal_Bool bMulti; // Multi selection
282 :
283 : void DoChange( const sal_Bool bUndo );
284 : void SetChangeTrack();
285 : };
286 :
287 :
288 : class ScUndoFillTable: public ScSimpleUndo
289 : {
290 : public:
291 : TYPEINFO();
292 : ScUndoFillTable( ScDocShell* pNewDocShell,
293 : const ScMarkData& rMark,
294 : SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
295 : SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
296 : ScDocument* pNewUndoDoc, sal_Bool bNewMulti, SCTAB nSrc,
297 : sal_uInt16 nFlg, sal_uInt16 nFunc, sal_Bool bSkip, sal_Bool bLink );
298 : virtual ~ScUndoFillTable();
299 :
300 : virtual void Undo();
301 : virtual void Redo();
302 : virtual void Repeat(SfxRepeatTarget& rTarget);
303 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
304 :
305 : virtual OUString GetComment() const;
306 :
307 : private:
308 : ScRange aRange;
309 : ScMarkData aMarkData;
310 : ScDocument* pUndoDoc; // Block mark and deleted data
311 : sal_uLong nStartChangeAction;
312 : sal_uLong nEndChangeAction;
313 : sal_uInt16 nFlags;
314 : sal_uInt16 nFunction;
315 : SCTAB nSrcTab;
316 : sal_Bool bMulti; // Multi selection
317 : sal_Bool bSkipEmpty;
318 : sal_Bool bAsLink;
319 :
320 : void DoChange( const sal_Bool bUndo );
321 : void SetChangeTrack();
322 : };
323 :
324 :
325 : class ScUndoSelectionAttr: public ScSimpleUndo
326 : {
327 : public:
328 : TYPEINFO();
329 : ScUndoSelectionAttr( ScDocShell* pNewDocShell,
330 : const ScMarkData& rMark,
331 : SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
332 : SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
333 : ScDocument* pNewUndoDoc, sal_Bool bNewMulti,
334 : const ScPatternAttr* pNewApply,
335 : const SvxBoxItem* pNewOuter = NULL,
336 : const SvxBoxInfoItem* pNewInner = NULL );
337 : virtual ~ScUndoSelectionAttr();
338 :
339 : virtual void Undo();
340 : virtual void Redo();
341 : virtual void Repeat(SfxRepeatTarget& rTarget);
342 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
343 :
344 : virtual OUString GetComment() const;
345 :
346 : ScEditDataArray* GetDataArray();
347 : private:
348 : ScMarkData aMarkData;
349 : ScRange aRange;
350 : boost::scoped_ptr<ScEditDataArray> mpDataArray;
351 : ScDocument* pUndoDoc;
352 : sal_Bool bMulti;
353 : ScPatternAttr* pApplyPattern;
354 : SvxBoxItem* pLineOuter;
355 : SvxBoxInfoItem* pLineInner;
356 :
357 : void DoChange( const sal_Bool bUndo );
358 : void ChangeEditData( const bool bUndo );
359 : };
360 :
361 :
362 : class ScUndoWidthOrHeight: public ScSimpleUndo
363 : {
364 : public:
365 : TYPEINFO();
366 : ScUndoWidthOrHeight( ScDocShell* pNewDocShell,
367 : const ScMarkData& rMark,
368 : SCCOLROW nNewStart, SCTAB nNewStartTab,
369 : SCCOLROW nNewEnd, SCTAB nNewEndTab,
370 : ScDocument* pNewUndoDoc,
371 : SCCOLROW nNewCnt, SCCOLROW* pNewRanges,
372 : ScOutlineTable* pNewUndoTab,
373 : ScSizeMode eNewMode, sal_uInt16 nNewSizeTwips,
374 : sal_Bool bNewWidth );
375 : virtual ~ScUndoWidthOrHeight();
376 :
377 : virtual void Undo();
378 : virtual void Redo();
379 : virtual void Repeat(SfxRepeatTarget& rTarget);
380 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
381 :
382 : virtual OUString GetComment() const;
383 :
384 : private:
385 : ScMarkData aMarkData;
386 : SCCOLROW nStart;
387 : SCCOLROW nEnd;
388 : SCTAB nStartTab;
389 : SCTAB nEndTab;
390 : ScDocument* pUndoDoc;
391 : ScOutlineTable* pUndoTab;
392 : SCCOLROW nRangeCnt;
393 : SCCOLROW* pRanges;
394 : sal_uInt16 nNewSize;
395 : sal_Bool bWidth;
396 : ScSizeMode eMode;
397 : SdrUndoAction* pDrawUndo;
398 : };
399 :
400 :
401 : class ScUndoAutoFill: public ScBlockUndo
402 : {
403 : public:
404 : TYPEINFO();
405 : ScUndoAutoFill( ScDocShell* pNewDocShell,
406 : const ScRange& rRange, const ScRange& rSourceArea,
407 : ScDocument* pNewUndoDoc, const ScMarkData& rMark,
408 : FillDir eNewFillDir,
409 : FillCmd eNewFillCmd, FillDateCmd eNewFillDateCmd,
410 : double fNewStartValue, double fNewStepValue, double fNewMaxValue );
411 : virtual ~ScUndoAutoFill();
412 :
413 : virtual void Undo();
414 : virtual void Redo();
415 : virtual void Repeat(SfxRepeatTarget& rTarget);
416 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
417 :
418 : virtual OUString GetComment() const;
419 :
420 : private:
421 : ScRange aSource;
422 : ScMarkData aMarkData;
423 : ScDocument* pUndoDoc;
424 : FillDir eFillDir;
425 : FillCmd eFillCmd;
426 : FillDateCmd eFillDateCmd;
427 : double fStartValue;
428 : double fStepValue;
429 : double fMaxValue;
430 : sal_uLong nStartChangeAction;
431 : sal_uLong nEndChangeAction;
432 :
433 : void SetChangeTrack();
434 : };
435 :
436 :
437 : class ScUndoMerge: public ScSimpleUndo
438 : {
439 : public:
440 : TYPEINFO();
441 : ScUndoMerge( ScDocShell* pNewDocShell, const ScCellMergeOption& rOption,
442 : bool bMergeContents, ScDocument* pUndoDoc, SdrUndoAction* pDrawUndo);
443 : virtual ~ScUndoMerge();
444 :
445 : virtual void Undo();
446 : virtual void Redo();
447 : virtual void Repeat(SfxRepeatTarget& rTarget);
448 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
449 :
450 : virtual OUString GetComment() const;
451 :
452 : private:
453 : ScCellMergeOption maOption;
454 : bool mbMergeContents; // Merge contents in Redo().
455 : ScDocument* mpUndoDoc; // when data is merged
456 : SdrUndoAction* mpDrawUndo;
457 :
458 : void DoChange( bool bUndo ) const;
459 : };
460 :
461 :
462 : class ScUndoAutoFormat: public ScBlockUndo
463 : {
464 : public:
465 : TYPEINFO();
466 : ScUndoAutoFormat( ScDocShell* pNewDocShell,
467 : const ScRange& rRange, ScDocument* pNewUndoDoc,
468 : const ScMarkData& rMark,
469 : sal_Bool bNewSize, sal_uInt16 nNewFormatNo );
470 : virtual ~ScUndoAutoFormat();
471 :
472 : virtual void Undo();
473 : virtual void Redo();
474 : virtual void Repeat(SfxRepeatTarget& rTarget);
475 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
476 :
477 : virtual OUString GetComment() const;
478 :
479 : private:
480 : ScDocument* pUndoDoc; // deleted data
481 : ScMarkData aMarkData;
482 : sal_Bool bSize;
483 : sal_uInt16 nFormatNo;
484 : };
485 :
486 :
487 : class ScUndoReplace: public ScSimpleUndo
488 : {
489 : public:
490 : TYPEINFO();
491 : ScUndoReplace( ScDocShell* pNewDocShell,
492 : const ScMarkData& rMark,
493 : SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
494 : const String& rNewUndoStr, ScDocument* pNewUndoDoc,
495 : const SvxSearchItem* pItem );
496 : virtual ~ScUndoReplace();
497 :
498 : virtual void Undo();
499 : virtual void Redo();
500 : virtual void Repeat(SfxRepeatTarget& rTarget);
501 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
502 :
503 : virtual OUString GetComment() const;
504 :
505 : private:
506 : ScAddress aCursorPos;
507 : ScMarkData aMarkData;
508 : String aUndoStr; // Data at single selection
509 : ScDocument* pUndoDoc; // Block mark and deleted data
510 : SvxSearchItem* pSearchItem;
511 : sal_uLong nStartChangeAction;
512 : sal_uLong nEndChangeAction;
513 :
514 : void SetChangeTrack();
515 : };
516 :
517 :
518 : class ScUndoTabOp: public ScSimpleUndo
519 : {
520 : public:
521 : TYPEINFO();
522 : ScUndoTabOp( ScDocShell* pNewDocShell,
523 : SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
524 : SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
525 : ScDocument* pNewUndoDoc,
526 : const ScRefAddress& rFormulaCell,
527 : const ScRefAddress& rFormulaEnd,
528 : const ScRefAddress& rRowCell,
529 : const ScRefAddress& rColCell,
530 : sal_uInt8 nMode );
531 : virtual ~ScUndoTabOp();
532 :
533 : virtual void Undo();
534 : virtual void Redo();
535 : virtual void Repeat(SfxRepeatTarget& rTarget);
536 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
537 :
538 : virtual OUString GetComment() const;
539 :
540 : private:
541 : ScRange aRange;
542 : ScDocument* pUndoDoc; // Deleted data
543 : ScRefAddress theFormulaCell;
544 : ScRefAddress theFormulaEnd;
545 : ScRefAddress theRowCell;
546 : ScRefAddress theColCell;
547 : sal_uInt8 nMode;
548 : };
549 :
550 :
551 : class ScUndoConversion : public ScSimpleUndo
552 : {
553 : public:
554 : TYPEINFO();
555 :
556 : ScUndoConversion( ScDocShell* pNewDocShell, const ScMarkData& rMark,
557 : SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScDocument* pNewUndoDoc,
558 : SCCOL nNewX, SCROW nNewY, SCTAB nNewZ, ScDocument* pNewRedoDoc,
559 : const ScConversionParam& rConvParam );
560 : virtual ~ScUndoConversion();
561 :
562 : virtual void Undo();
563 : virtual void Redo();
564 : virtual void Repeat(SfxRepeatTarget& rTarget);
565 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
566 :
567 : virtual OUString GetComment() const;
568 :
569 : private:
570 : ScMarkData aMarkData;
571 : ScAddress aCursorPos;
572 : ScDocument* pUndoDoc; // Block mark and deleted data
573 : ScAddress aNewCursorPos;
574 : ScDocument* pRedoDoc; // Block mark and new data
575 : sal_uLong nStartChangeAction;
576 : sal_uLong nEndChangeAction;
577 : ScConversionParam maConvParam; /// Conversion type and parameters.
578 :
579 : void DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPos );
580 : void SetChangeTrack();
581 : };
582 :
583 : class ScUndoRefConversion: public ScSimpleUndo
584 : {
585 : public:
586 : TYPEINFO();
587 : ScUndoRefConversion( ScDocShell* pNewDocShell,
588 : const ScRange& aMarkRange, const ScMarkData& rMark,
589 : ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc, sal_Bool bNewMulti, sal_uInt16 nNewFlag);
590 : virtual ~ScUndoRefConversion();
591 :
592 : virtual void Undo();
593 : virtual void Redo();
594 : virtual void Repeat(SfxRepeatTarget& rTarget);
595 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
596 :
597 : virtual OUString GetComment() const;
598 :
599 : private:
600 : ScMarkData aMarkData;
601 : ScDocument* pUndoDoc;
602 : ScDocument* pRedoDoc;
603 : ScRange aRange;
604 : sal_Bool bMulti;
605 : sal_uInt16 nFlags;
606 : sal_uLong nStartChangeAction;
607 : sal_uLong nEndChangeAction;
608 :
609 : void DoChange( ScDocument* pRefDoc);
610 : void SetChangeTrack();
611 : };
612 :
613 : class ScUndoListNames: public ScBlockUndo
614 : {
615 : public:
616 : TYPEINFO();
617 : ScUndoListNames( ScDocShell* pNewDocShell,
618 : const ScRange& rRange,
619 : ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc );
620 : virtual ~ScUndoListNames();
621 :
622 : virtual void Undo();
623 : virtual void Redo();
624 : virtual void Repeat(SfxRepeatTarget& rTarget);
625 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
626 :
627 : virtual OUString GetComment() const;
628 :
629 : private:
630 : ScDocument* pUndoDoc;
631 : ScDocument* pRedoDoc;
632 :
633 : void DoChange( ScDocument* pSrcDoc ) const;
634 : };
635 :
636 :
637 : class ScUndoUseScenario: public ScSimpleUndo
638 : {
639 : public:
640 : TYPEINFO();
641 : ScUndoUseScenario( ScDocShell* pNewDocShell,
642 : const ScMarkData& rMark,
643 : const ScArea& rDestArea, ScDocument* pNewUndoDoc,
644 : const String& rNewName );
645 : virtual ~ScUndoUseScenario();
646 :
647 : virtual void Undo();
648 : virtual void Redo();
649 : virtual void Repeat(SfxRepeatTarget& rTarget);
650 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
651 :
652 : virtual OUString GetComment() const;
653 :
654 : private:
655 : ScDocument* pUndoDoc;
656 : ScRange aRange;
657 : ScMarkData aMarkData;
658 : String aName;
659 : };
660 :
661 :
662 : class ScUndoSelectionStyle: public ScSimpleUndo
663 : {
664 : public:
665 : TYPEINFO();
666 : ScUndoSelectionStyle( ScDocShell* pNewDocShell,
667 : const ScMarkData& rMark,
668 : const ScRange& rRange,
669 : const String& rName,
670 : ScDocument* pNewUndoDoc );
671 : virtual ~ScUndoSelectionStyle();
672 :
673 : virtual void Undo();
674 : virtual void Redo();
675 : virtual void Repeat(SfxRepeatTarget& rTarget);
676 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
677 :
678 : virtual OUString GetComment() const;
679 : virtual sal_uInt16 GetId() const;
680 :
681 : private:
682 : ScMarkData aMarkData;
683 : ScDocument* pUndoDoc;
684 : String aStyleName;
685 : ScRange aRange;
686 :
687 : void DoChange( const sal_Bool bUndo );
688 : };
689 :
690 :
691 : class ScUndoRefreshLink: public ScSimpleUndo
692 : {
693 : public:
694 : TYPEINFO();
695 : ScUndoRefreshLink( ScDocShell* pNewDocShell,
696 : ScDocument* pNewUndoDoc );
697 : virtual ~ScUndoRefreshLink();
698 :
699 : virtual void Undo();
700 : virtual void Redo();
701 : virtual void Repeat(SfxRepeatTarget& rTarget);
702 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
703 :
704 : virtual OUString GetComment() const;
705 :
706 : private:
707 : ScDocument* pUndoDoc;
708 : ScDocument* pRedoDoc;
709 : };
710 :
711 :
712 : class ScUndoEnterMatrix: public ScBlockUndo
713 : {
714 : public:
715 : TYPEINFO();
716 : ScUndoEnterMatrix( ScDocShell* pNewDocShell,
717 : const ScRange& rArea,
718 : ScDocument* pNewUndoDoc,
719 : const String& rForm );
720 : virtual ~ScUndoEnterMatrix();
721 :
722 : virtual void Undo();
723 : virtual void Redo();
724 : virtual void Repeat(SfxRepeatTarget& rTarget);
725 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
726 :
727 : virtual OUString GetComment() const;
728 :
729 : private:
730 : ScDocument* pUndoDoc;
731 : String aFormula;
732 : sal_uLong nStartChangeAction;
733 : sal_uLong nEndChangeAction;
734 :
735 : void SetChangeTrack();
736 : };
737 :
738 :
739 : class ScUndoInsertAreaLink : public ScSimpleUndo
740 : {
741 : public:
742 : TYPEINFO();
743 : ScUndoInsertAreaLink( ScDocShell* pShell,
744 : const String& rDoc,
745 : const String& rFlt, const String& rOpt,
746 : const String& rArea, const ScRange& rDestRange,
747 : sal_uLong nRefreshDelay );
748 : virtual ~ScUndoInsertAreaLink();
749 :
750 : virtual void Undo();
751 : virtual void Redo();
752 : virtual void Repeat(SfxRepeatTarget& rTarget);
753 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
754 :
755 : virtual OUString GetComment() const;
756 :
757 : private:
758 : String aDocName;
759 : String aFltName;
760 : String aOptions;
761 : String aAreaName;
762 : ScRange aRange;
763 : sal_uLong nRefreshDelay;
764 : };
765 :
766 :
767 : class ScUndoRemoveAreaLink : public ScSimpleUndo
768 : {
769 : public:
770 : TYPEINFO();
771 : ScUndoRemoveAreaLink( ScDocShell* pShell,
772 : const String& rDoc,
773 : const String& rFlt, const String& rOpt,
774 : const String& rArea, const ScRange& rDestRange,
775 : sal_uLong nRefreshDelay );
776 : virtual ~ScUndoRemoveAreaLink();
777 :
778 : virtual void Undo();
779 : virtual void Redo();
780 : virtual void Repeat(SfxRepeatTarget& rTarget);
781 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
782 :
783 : virtual OUString GetComment() const;
784 :
785 : private:
786 : String aDocName;
787 : String aFltName;
788 : String aOptions;
789 : String aAreaName;
790 : ScRange aRange;
791 : sal_uLong nRefreshDelay;
792 : };
793 :
794 :
795 : class ScUndoUpdateAreaLink : public ScSimpleUndo //! also change BlockUndo?
796 : {
797 : public:
798 : TYPEINFO();
799 : ScUndoUpdateAreaLink( ScDocShell* pShell,
800 : const String& rOldD,
801 : const String& rOldF, const String& rOldO,
802 : const String& rOldA, const ScRange& rOldR,
803 : sal_uLong nOldRD,
804 : const String& rNewD,
805 : const String& rNewF, const String& rNewO,
806 : const String& rNewA, const ScRange& rNewR,
807 : sal_uLong nNewRD,
808 : ScDocument* pUndo, ScDocument* pRedo,
809 : sal_Bool bDoInsert );
810 : virtual ~ScUndoUpdateAreaLink();
811 :
812 : virtual void Undo();
813 : virtual void Redo();
814 : virtual void Repeat(SfxRepeatTarget& rTarget);
815 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
816 :
817 : virtual OUString GetComment() const;
818 :
819 : private:
820 : String aOldDoc;
821 : String aOldFlt;
822 : String aOldOpt;
823 : String aOldArea;
824 : ScRange aOldRange;
825 : String aNewDoc;
826 : String aNewFlt;
827 : String aNewOpt;
828 : String aNewArea;
829 : ScRange aNewRange;
830 : ScDocument* pUndoDoc;
831 : ScDocument* pRedoDoc;
832 : sal_uLong nOldRefresh;
833 : sal_uLong nNewRefresh;
834 : sal_Bool bWithInsert;
835 :
836 : void DoChange( const sal_Bool bUndo ) const;
837 : };
838 :
839 :
840 : class ScUndoIndent: public ScBlockUndo
841 : {
842 : public:
843 : TYPEINFO();
844 : ScUndoIndent( ScDocShell* pNewDocShell, const ScMarkData& rMark,
845 : ScDocument* pNewUndoDoc, sal_Bool bIncrement );
846 : virtual ~ScUndoIndent();
847 :
848 : virtual void Undo();
849 : virtual void Redo();
850 : virtual void Repeat(SfxRepeatTarget& rTarget);
851 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
852 :
853 : virtual OUString GetComment() const;
854 :
855 : private:
856 : ScMarkData aMarkData;
857 : ScDocument* pUndoDoc;
858 : sal_Bool bIsIncrement;
859 : };
860 :
861 :
862 : class ScUndoTransliterate: public ScBlockUndo
863 : {
864 : public:
865 : TYPEINFO();
866 : ScUndoTransliterate( ScDocShell* pNewDocShell, const ScMarkData& rMark,
867 : ScDocument* pNewUndoDoc, sal_Int32 nType );
868 : virtual ~ScUndoTransliterate();
869 :
870 : virtual void Undo();
871 : virtual void Redo();
872 : virtual void Repeat(SfxRepeatTarget& rTarget);
873 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
874 :
875 : virtual OUString GetComment() const;
876 :
877 : private:
878 : ScMarkData aMarkData;
879 : ScDocument* pUndoDoc;
880 : sal_Int32 nTransliterationType;
881 : };
882 :
883 :
884 : class ScUndoClearItems: public ScBlockUndo
885 : {
886 : public:
887 : TYPEINFO();
888 : ScUndoClearItems( ScDocShell* pNewDocShell, const ScMarkData& rMark,
889 : ScDocument* pNewUndoDoc, const sal_uInt16* pW );
890 : virtual ~ScUndoClearItems();
891 :
892 : virtual void Undo();
893 : virtual void Redo();
894 : virtual void Repeat(SfxRepeatTarget& rTarget);
895 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
896 :
897 : virtual OUString GetComment() const;
898 :
899 : private:
900 : ScMarkData aMarkData;
901 : ScDocument* pUndoDoc;
902 : sal_uInt16* pWhich;
903 : };
904 :
905 :
906 : class ScUndoRemoveBreaks: public ScSimpleUndo
907 : {
908 : public:
909 : TYPEINFO();
910 : ScUndoRemoveBreaks( ScDocShell* pNewDocShell,
911 : SCTAB nNewTab, ScDocument* pNewUndoDoc );
912 : virtual ~ScUndoRemoveBreaks();
913 :
914 : virtual void Undo();
915 : virtual void Redo();
916 : virtual void Repeat(SfxRepeatTarget& rTarget);
917 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
918 :
919 : virtual OUString GetComment() const;
920 :
921 : private:
922 : SCTAB nTab;
923 : ScDocument* pUndoDoc;
924 : };
925 :
926 :
927 : class ScUndoRemoveMerge: public ScBlockUndo
928 : {
929 : public:
930 : TYPEINFO();
931 : ScUndoRemoveMerge( ScDocShell* pNewDocShell,
932 : const ScCellMergeOption& rOption,
933 : ScDocument* pNewUndoDoc );
934 : virtual ~ScUndoRemoveMerge();
935 :
936 : virtual void Undo();
937 : virtual void Redo();
938 : virtual void Repeat(SfxRepeatTarget& rTarget);
939 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
940 :
941 : virtual OUString GetComment() const;
942 :
943 : private:
944 : void SetCurTab();
945 :
946 : ScCellMergeOption maOption;
947 : ScDocument* pUndoDoc;
948 : };
949 :
950 :
951 : class ScUndoBorder: public ScBlockUndo
952 : {
953 : public:
954 : TYPEINFO();
955 : ScUndoBorder( ScDocShell* pNewDocShell,
956 : const ScRangeList& rRangeList,
957 : ScDocument* pNewUndoDoc,
958 : const SvxBoxItem& rNewOuter,
959 : const SvxBoxInfoItem& rNewInner );
960 : virtual ~ScUndoBorder();
961 :
962 : virtual void Undo();
963 : virtual void Redo();
964 : virtual void Repeat(SfxRepeatTarget& rTarget);
965 : virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
966 :
967 : virtual OUString GetComment() const;
968 :
969 : private:
970 : ScDocument* pUndoDoc;
971 : ScRangeList* pRanges;
972 : SvxBoxItem* pOuter;
973 : SvxBoxInfoItem* pInner;
974 : };
975 :
976 :
977 :
978 :
979 : #endif
980 :
981 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|