1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef SC_UNDOBLK_HXX 28 #define SC_UNDOBLK_HXX 29 30 #include "undobase.hxx" 31 #include "markdata.hxx" 32 #include "viewutil.hxx" 33 #include "spellparam.hxx" 34 35 class ScDocShell; 36 class ScBaseCell; 37 class ScDocument; 38 class ScOutlineTable; 39 class ScRangeName; 40 class ScRangeList; 41 class ScDBCollection; 42 class ScPatternAttr; 43 class SvxBoxItem; 44 class SvxBoxInfoItem; 45 class SvxSearchItem; 46 class SdrUndoAction; 47 48 //---------------------------------------------------------------------------- 49 50 class ScUndoInsertCells: public ScMoveUndo 51 { 52 public: 53 TYPEINFO(); 54 ScUndoInsertCells( ScDocShell* pNewDocShell, 55 const ScRange& rRange, SCTAB nNewCount, SCTAB* pNewTabs, SCTAB* pNewScenarios, 56 InsCellCmd eNewCmd, ScDocument* pUndoDocument, ScRefUndoData* pRefData, 57 sal_Bool bNewPartOfPaste ); 58 virtual ~ScUndoInsertCells(); 59 60 virtual void Undo(); 61 virtual void Redo(); 62 virtual void Repeat( SfxRepeatTarget& rTarget ); 63 virtual sal_Bool CanRepeat( SfxRepeatTarget& rTarget ) const; 64 65 virtual String GetComment() const; 66 67 virtual sal_Bool Merge( SfxUndoAction *pNextAction ); 68 69 private: 70 ScRange aEffRange; 71 SCTAB nCount; 72 SCTAB* pTabs; 73 SCTAB* pScenarios; 74 sal_uLong nEndChangeAction; 75 InsCellCmd eCmd; 76 sal_Bool bPartOfPaste; 77 SfxUndoAction* pPasteUndo; 78 79 void DoChange ( const sal_Bool bUndo ); 80 void SetChangeTrack(); 81 }; 82 83 84 class ScUndoDeleteCells: public ScMoveUndo 85 { 86 public: 87 TYPEINFO(); 88 ScUndoDeleteCells( ScDocShell* pNewDocShell, 89 const ScRange& rRange, SCTAB nNewCount, SCTAB* pNewTabs, SCTAB* pNewScenarios, 90 DelCellCmd eNewCmd, ScDocument* pUndoDocument, ScRefUndoData* pRefData ); 91 virtual ~ScUndoDeleteCells(); 92 93 virtual void Undo(); 94 virtual void Redo(); 95 virtual void Repeat(SfxRepeatTarget& rTarget); 96 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 97 98 virtual String GetComment() const; 99 100 private: 101 ScRange aEffRange; 102 SCTAB nCount; 103 SCTAB* pTabs; 104 SCTAB* pScenarios; 105 sal_uLong nStartChangeAction; 106 sal_uLong nEndChangeAction; 107 DelCellCmd eCmd; 108 109 void DoChange ( const sal_Bool bUndo ); 110 void SetChangeTrack(); 111 }; 112 113 114 class ScUndoDeleteMulti: public ScMoveUndo 115 { 116 public: 117 TYPEINFO(); 118 ScUndoDeleteMulti( ScDocShell* pNewDocShell, 119 sal_Bool bNewRows, sal_Bool bNeedsRefresh, SCTAB nNewTab, 120 const SCCOLROW* pRng, SCCOLROW nRngCnt, 121 ScDocument* pUndoDocument, ScRefUndoData* pRefData ); 122 virtual ~ScUndoDeleteMulti(); 123 124 virtual void Undo(); 125 virtual void Redo(); 126 virtual void Repeat(SfxRepeatTarget& rTarget); 127 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 128 129 virtual String GetComment() const; 130 131 private: 132 sal_Bool bRows; 133 sal_Bool bRefresh; 134 SCTAB nTab; 135 SCCOLROW* pRanges; 136 SCCOLROW nRangeCnt; 137 sal_uLong nStartChangeAction; 138 sal_uLong nEndChangeAction; 139 140 void DoChange() const; 141 void SetChangeTrack(); 142 }; 143 144 145 class ScUndoCut: public ScBlockUndo 146 { 147 public: 148 TYPEINFO(); 149 ScUndoCut( ScDocShell* pNewDocShell, 150 ScRange aRange, // adjusted for merged cells 151 ScAddress aOldEnd, // end position without adjustment 152 const ScMarkData& rMark, // selected sheets 153 ScDocument* pNewUndoDoc ); 154 virtual ~ScUndoCut(); 155 156 virtual void Undo(); 157 virtual void Redo(); 158 virtual void Repeat(SfxRepeatTarget& rTarget); 159 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 160 161 virtual String GetComment() const; 162 163 private: 164 ScMarkData aMarkData; 165 ScDocument* pUndoDoc; 166 ScRange aExtendedRange; 167 sal_uLong nStartChangeAction; 168 sal_uLong nEndChangeAction; 169 170 void DoChange( const sal_Bool bUndo ); 171 void SetChangeTrack(); 172 }; 173 174 175 struct ScUndoPasteOptions 176 { 177 sal_uInt16 nFunction; 178 sal_Bool bSkipEmpty; 179 sal_Bool bTranspose; 180 sal_Bool bAsLink; 181 InsCellCmd eMoveMode; 182 183 ScUndoPasteOptions() : 184 nFunction( PASTE_NOFUNC ), 185 bSkipEmpty( sal_False ), 186 bTranspose( sal_False ), 187 bAsLink( sal_False ), 188 eMoveMode( INS_NONE ) 189 {} 190 }; 191 192 class ScUndoPaste: public ScBlockUndo 193 { 194 public: 195 TYPEINFO(); 196 ScUndoPaste( ScDocShell* pNewDocShell, 197 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, 198 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, 199 const ScMarkData& rMark, 200 ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc, 201 sal_uInt16 nNewFlags, 202 ScRefUndoData* pRefData, void* pFill1, void* pFill2, void* pFill3, 203 sal_Bool bRedoIsFilled = sal_True, 204 const ScUndoPasteOptions* pOptions = NULL ); 205 virtual ~ScUndoPaste(); 206 207 virtual void Undo(); 208 virtual void Redo(); 209 virtual void Repeat(SfxRepeatTarget& rTarget); 210 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 211 212 virtual String GetComment() const; 213 214 private: 215 ScMarkData aMarkData; 216 ScDocument* pUndoDoc; 217 ScDocument* pRedoDoc; 218 sal_uInt16 nFlags; 219 ScRefUndoData* pRefUndoData; 220 ScRefUndoData* pRefRedoData; 221 sal_uLong nStartChangeAction; 222 sal_uLong nEndChangeAction; 223 sal_Bool bRedoFilled; 224 ScUndoPasteOptions aPasteOptions; 225 226 void DoChange( const sal_Bool bUndo ); 227 void SetChangeTrack(); 228 }; 229 230 231 class ScUndoDragDrop: public ScMoveUndo 232 { 233 public: 234 TYPEINFO(); 235 ScUndoDragDrop( ScDocShell* pNewDocShell, 236 const ScRange& rRange, ScAddress aNewDestPos, sal_Bool bNewCut, 237 ScDocument* pUndoDocument, ScRefUndoData* pRefData, 238 sal_Bool bScenario ); 239 virtual ~ScUndoDragDrop(); 240 241 virtual void Undo(); 242 virtual void Redo(); 243 virtual void Repeat(SfxRepeatTarget& rTarget); 244 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 245 246 virtual String GetComment() const; 247 248 private: 249 ScRange aSrcRange; 250 ScRange aDestRange; 251 sal_uLong nStartChangeAction; 252 sal_uLong nEndChangeAction; 253 sal_Bool bCut; 254 sal_Bool bKeepScenarioFlags; 255 256 void PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const; 257 void DoUndo( ScRange aRange ) const; 258 259 void SetChangeTrack(); 260 }; 261 262 263 class ScUndoDeleteContents: public ScSimpleUndo 264 { 265 public: 266 TYPEINFO(); 267 ScUndoDeleteContents( ScDocShell* pNewDocShell, 268 const ScMarkData& rMark, 269 const ScRange& rRange, 270 ScDocument* pNewUndoDoc, sal_Bool bNewMulti, 271 sal_uInt16 nNewFlags, sal_Bool bObjects ); 272 virtual ~ScUndoDeleteContents(); 273 274 virtual void Undo(); 275 virtual void Redo(); 276 virtual void Repeat(SfxRepeatTarget& rTarget); 277 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 278 279 virtual String GetComment() const; 280 281 private: 282 ScRange aRange; 283 ScMarkData aMarkData; 284 ScDocument* pUndoDoc; // Blockmarkierung und geloeschte Daten 285 SdrUndoAction* pDrawUndo; // geloeschte Objekte 286 sal_uLong nStartChangeAction; 287 sal_uLong nEndChangeAction; 288 sal_uInt16 nFlags; 289 sal_Bool bMulti; // Mehrfachselektion 290 291 void DoChange( const sal_Bool bUndo ); 292 void SetChangeTrack(); 293 }; 294 295 296 class ScUndoFillTable: public ScSimpleUndo 297 { 298 public: 299 TYPEINFO(); 300 ScUndoFillTable( ScDocShell* pNewDocShell, 301 const ScMarkData& rMark, 302 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, 303 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, 304 ScDocument* pNewUndoDoc, sal_Bool bNewMulti, SCTAB nSrc, 305 sal_uInt16 nFlg, sal_uInt16 nFunc, sal_Bool bSkip, sal_Bool bLink ); 306 virtual ~ScUndoFillTable(); 307 308 virtual void Undo(); 309 virtual void Redo(); 310 virtual void Repeat(SfxRepeatTarget& rTarget); 311 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 312 313 virtual String GetComment() const; 314 315 private: 316 ScRange aRange; 317 ScMarkData aMarkData; 318 ScDocument* pUndoDoc; // Blockmarkierung und geloeschte Daten 319 sal_uLong nStartChangeAction; 320 sal_uLong nEndChangeAction; 321 sal_uInt16 nFlags; 322 sal_uInt16 nFunction; 323 SCTAB nSrcTab; 324 sal_Bool bMulti; // Mehrfachselektion 325 sal_Bool bSkipEmpty; 326 sal_Bool bAsLink; 327 328 void DoChange( const sal_Bool bUndo ); 329 void SetChangeTrack(); 330 }; 331 332 333 class ScUndoSelectionAttr: public ScSimpleUndo 334 { 335 public: 336 TYPEINFO(); 337 ScUndoSelectionAttr( ScDocShell* pNewDocShell, 338 const ScMarkData& rMark, 339 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, 340 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, 341 ScDocument* pNewUndoDoc, sal_Bool bNewMulti, 342 const ScPatternAttr* pNewApply, 343 const SvxBoxItem* pNewOuter = NULL, 344 const SvxBoxInfoItem* pNewInner = NULL ); 345 virtual ~ScUndoSelectionAttr(); 346 347 virtual void Undo(); 348 virtual void Redo(); 349 virtual void Repeat(SfxRepeatTarget& rTarget); 350 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 351 352 virtual String GetComment() const; 353 354 private: 355 ScMarkData aMarkData; 356 ScRange aRange; 357 ScDocument* pUndoDoc; 358 sal_Bool bMulti; 359 ScPatternAttr* pApplyPattern; 360 SvxBoxItem* pLineOuter; 361 SvxBoxInfoItem* pLineInner; 362 363 void DoChange( const sal_Bool bUndo ); 364 }; 365 366 367 class ScUndoWidthOrHeight: public ScSimpleUndo 368 { 369 public: 370 TYPEINFO(); 371 ScUndoWidthOrHeight( ScDocShell* pNewDocShell, 372 const ScMarkData& rMark, 373 SCCOLROW nNewStart, SCTAB nNewStartTab, 374 SCCOLROW nNewEnd, SCTAB nNewEndTab, 375 ScDocument* pNewUndoDoc, 376 SCCOLROW nNewCnt, SCCOLROW* pNewRanges, 377 ScOutlineTable* pNewUndoTab, 378 ScSizeMode eNewMode, sal_uInt16 nNewSizeTwips, 379 sal_Bool bNewWidth ); 380 virtual ~ScUndoWidthOrHeight(); 381 382 virtual void Undo(); 383 virtual void Redo(); 384 virtual void Repeat(SfxRepeatTarget& rTarget); 385 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 386 387 virtual String GetComment() const; 388 389 private: 390 ScMarkData aMarkData; 391 SCCOLROW nStart; 392 SCCOLROW nEnd; 393 SCTAB nStartTab; 394 SCTAB nEndTab; 395 ScDocument* pUndoDoc; 396 ScOutlineTable* pUndoTab; 397 SCCOLROW nRangeCnt; 398 SCCOLROW* pRanges; 399 sal_uInt16 nNewSize; 400 sal_Bool bWidth; 401 ScSizeMode eMode; 402 SdrUndoAction* pDrawUndo; 403 }; 404 405 406 class ScUndoAutoFill: public ScBlockUndo 407 { 408 public: 409 TYPEINFO(); 410 ScUndoAutoFill( ScDocShell* pNewDocShell, 411 const ScRange& rRange, const ScRange& rSourceArea, 412 ScDocument* pNewUndoDoc, const ScMarkData& rMark, 413 FillDir eNewFillDir, 414 FillCmd eNewFillCmd, FillDateCmd eNewFillDateCmd, 415 double fNewStartValue, double fNewStepValue, double fNewMaxValue, 416 sal_uInt16 nMaxShIndex ); 417 virtual ~ScUndoAutoFill(); 418 419 virtual void Undo(); 420 virtual void Redo(); 421 virtual void Repeat(SfxRepeatTarget& rTarget); 422 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 423 424 virtual String GetComment() const; 425 426 private: 427 ScRange aSource; 428 ScMarkData aMarkData; 429 ScDocument* pUndoDoc; 430 FillDir eFillDir; 431 FillCmd eFillCmd; 432 FillDateCmd eFillDateCmd; 433 double fStartValue; 434 double fStepValue; 435 double fMaxValue; 436 sal_uLong nStartChangeAction; 437 sal_uLong nEndChangeAction; 438 sal_uInt16 nMaxSharedIndex; 439 440 void SetChangeTrack(); 441 }; 442 443 444 class ScUndoMerge: public ScSimpleUndo 445 { 446 public: 447 TYPEINFO(); 448 ScUndoMerge( ScDocShell* pNewDocShell, 449 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, 450 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, 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 String GetComment() const; 460 461 private: 462 ScRange maRange; 463 bool mbMergeContents; // Merge contents in Redo(). 464 ScDocument* mpUndoDoc; // wenn Daten zusammengefasst 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 String GetComment() const; 487 488 private: 489 ScDocument* pUndoDoc; // geloeschte Daten 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 String GetComment() const; 513 514 private: 515 ScAddress aCursorPos; 516 ScMarkData aMarkData; 517 String aUndoStr; // Daten bei Einfachmarkierung 518 ScDocument* pUndoDoc; // Blockmarkierung und geloeschte Daten 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 String GetComment() const; 548 549 private: 550 ScRange aRange; 551 ScDocument* pUndoDoc; // geloeschte Daten 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 String GetComment() const; 578 579 private: 580 ScMarkData aMarkData; 581 ScAddress aCursorPos; 582 ScDocument* pUndoDoc; // Blockmarkierung und geloeschte Daten 583 ScAddress aNewCursorPos; 584 ScDocument* pRedoDoc; // Blockmarkierung und neue Daten 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 String 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 String 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 String 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 String 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 String 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 String 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 String 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 String 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 //! auch BlockUndo umstellen? 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 String 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 String 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 String 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 String 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 String 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 ScRange& rArea, 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 String GetComment() const; 953 954 private: 955 ScDocument* pUndoDoc; 956 }; 957 958 959 class ScUndoBorder: public ScBlockUndo 960 { 961 public: 962 TYPEINFO(); 963 ScUndoBorder( ScDocShell* pNewDocShell, 964 const ScRangeList& rRangeList, 965 ScDocument* pNewUndoDoc, 966 const SvxBoxItem& rNewOuter, 967 const SvxBoxInfoItem& rNewInner ); 968 virtual ~ScUndoBorder(); 969 970 virtual void Undo(); 971 virtual void Redo(); 972 virtual void Repeat(SfxRepeatTarget& rTarget); 973 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 974 975 virtual String GetComment() const; 976 977 private: 978 ScDocument* pUndoDoc; 979 ScRangeList* pRanges; 980 SvxBoxItem* pOuter; 981 SvxBoxInfoItem* pInner; 982 }; 983 984 985 986 987 #endif 988 989