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