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