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 28 #ifndef SC_UNDODAT_HXX 29 #define SC_UNDODAT_HXX 30 31 #include "undobase.hxx" 32 #include "rangeutl.hxx" // ScArea 33 #include "rangelst.hxx" // ScRangeListRef 34 #include "markdata.hxx" 35 #include "sortparam.hxx" 36 #include "queryparam.hxx" 37 #include "pivot.hxx" 38 39 class ScDocShell; 40 class ScDocument; 41 class ScOutlineTable; 42 class ScRangeName; 43 class ScDBData; 44 class ScDBCollection; 45 class ScDPObject; 46 class SdrUndoAction; 47 48 //---------------------------------------------------------------------------- 49 50 class ScUndoDoOutline: public ScSimpleUndo 51 { 52 public: 53 TYPEINFO(); 54 ScUndoDoOutline( ScDocShell* pNewDocShell, 55 SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab, 56 ScDocument* pNewUndoDoc, sal_Bool bNewColumns, 57 sal_uInt16 nNewLevel, sal_uInt16 nNewEntry, sal_Bool bNewShow ); 58 virtual ~ScUndoDoOutline(); 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 private: 68 SCCOLROW nStart; 69 SCCOLROW nEnd; 70 SCTAB nTab; 71 ScDocument* pUndoDoc; 72 sal_Bool bColumns; 73 sal_uInt16 nLevel; 74 sal_uInt16 nEntry; 75 sal_Bool bShow; 76 }; 77 78 79 class ScUndoMakeOutline: public ScSimpleUndo 80 { 81 public: 82 TYPEINFO(); 83 ScUndoMakeOutline( ScDocShell* pNewDocShell, 84 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, 85 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, 86 ScOutlineTable* pNewUndoTab, 87 sal_Bool bNewColumns, sal_Bool bNewMake ); 88 virtual ~ScUndoMakeOutline(); 89 90 virtual void Undo(); 91 virtual void Redo(); 92 virtual void Repeat(SfxRepeatTarget& rTarget); 93 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 94 95 virtual String GetComment() const; 96 97 private: 98 ScAddress aBlockStart; 99 ScAddress aBlockEnd; 100 ScOutlineTable* pUndoTable; 101 sal_Bool bColumns; 102 sal_Bool bMake; 103 }; 104 105 106 class ScUndoOutlineLevel: public ScSimpleUndo 107 { 108 public: 109 TYPEINFO(); 110 ScUndoOutlineLevel( ScDocShell* pNewDocShell, 111 SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab, 112 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab, 113 sal_Bool bNewColumns, sal_uInt16 nNewLevel ); 114 virtual ~ScUndoOutlineLevel(); 115 116 virtual void Undo(); 117 virtual void Redo(); 118 virtual void Repeat(SfxRepeatTarget& rTarget); 119 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 120 121 virtual String GetComment() const; 122 123 private: 124 SCCOLROW nStart; 125 SCCOLROW nEnd; 126 SCTAB nTab; 127 ScDocument* pUndoDoc; 128 ScOutlineTable* pUndoTable; 129 sal_Bool bColumns; 130 sal_uInt16 nLevel; 131 }; 132 133 134 class ScUndoOutlineBlock: public ScSimpleUndo 135 { 136 public: 137 TYPEINFO(); 138 ScUndoOutlineBlock( ScDocShell* pNewDocShell, 139 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, 140 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, 141 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab, 142 sal_Bool bNewShow ); 143 virtual ~ScUndoOutlineBlock(); 144 145 virtual void Undo(); 146 virtual void Redo(); 147 virtual void Repeat(SfxRepeatTarget& rTarget); 148 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 149 150 virtual String GetComment() const; 151 152 private: 153 ScAddress aBlockStart; 154 ScAddress aBlockEnd; 155 ScDocument* pUndoDoc; 156 ScOutlineTable* pUndoTable; 157 sal_Bool bShow; 158 }; 159 160 161 class ScUndoRemoveAllOutlines: public ScSimpleUndo 162 { 163 public: 164 TYPEINFO(); 165 ScUndoRemoveAllOutlines( ScDocShell* pNewDocShell, 166 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, 167 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, 168 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab ); 169 virtual ~ScUndoRemoveAllOutlines(); 170 171 virtual void Undo(); 172 virtual void Redo(); 173 virtual void Repeat(SfxRepeatTarget& rTarget); 174 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 175 176 virtual String GetComment() const; 177 178 private: 179 ScAddress aBlockStart; 180 ScAddress aBlockEnd; 181 ScDocument* pUndoDoc; 182 ScOutlineTable* pUndoTable; 183 }; 184 185 186 class ScUndoAutoOutline: public ScSimpleUndo 187 { 188 public: 189 TYPEINFO(); 190 ScUndoAutoOutline( ScDocShell* pNewDocShell, 191 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ, 192 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ, 193 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab ); 194 virtual ~ScUndoAutoOutline(); 195 196 virtual void Undo(); 197 virtual void Redo(); 198 virtual void Repeat(SfxRepeatTarget& rTarget); 199 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 200 201 virtual String GetComment() const; 202 203 private: 204 ScAddress aBlockStart; 205 ScAddress aBlockEnd; 206 ScDocument* pUndoDoc; 207 ScOutlineTable* pUndoTable; 208 }; 209 210 211 class ScUndoSubTotals: public ScDBFuncUndo 212 { 213 public: 214 TYPEINFO(); 215 ScUndoSubTotals( ScDocShell* pNewDocShell, SCTAB nNewTab, 216 const ScSubTotalParam& rNewParam, SCROW nNewEndY, 217 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab, 218 // ScDBData* pNewData, 219 ScRangeName* pNewUndoRange, ScDBCollection* pNewUndoDB ); 220 virtual ~ScUndoSubTotals(); 221 222 virtual void Undo(); 223 virtual void Redo(); 224 virtual void Repeat(SfxRepeatTarget& rTarget); 225 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 226 227 virtual String GetComment() const; 228 229 private: 230 SCTAB nTab; 231 ScSubTotalParam aParam; // Original uebergebener Parameter 232 SCROW nNewEndRow; // Ergebnis-Groesse 233 ScDocument* pUndoDoc; 234 ScOutlineTable* pUndoTable; 235 // ScDBData* pUndoDBData; 236 ScRangeName* pUndoRange; 237 ScDBCollection* pUndoDB; 238 }; 239 240 241 class ScUndoSort: public ScDBFuncUndo 242 { 243 public: 244 TYPEINFO(); 245 ScUndoSort( ScDocShell* pNewDocShell, SCTAB nNewTab, 246 const ScSortParam& rParam, 247 sal_Bool bQuery, ScDocument* pNewUndoDoc, 248 ScDBCollection* pNewUndoDB, const ScRange* pDest = NULL ); 249 virtual ~ScUndoSort(); 250 251 virtual void Undo(); 252 virtual void Redo(); 253 virtual void Repeat(SfxRepeatTarget& rTarget); 254 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 255 256 virtual String GetComment() const; 257 258 private: 259 SCTAB nTab; 260 ScSortParam aSortParam; 261 sal_Bool bRepeatQuery; 262 ScDocument* pUndoDoc; 263 ScDBCollection* pUndoDB; // wegen Quell- und Zielbereich 264 sal_Bool bDestArea; 265 ScRange aDestRange; 266 }; 267 268 269 class ScUndoQuery: public ScDBFuncUndo 270 { 271 public: 272 TYPEINFO(); 273 ScUndoQuery( ScDocShell* pNewDocShell, SCTAB nNewTab, 274 const ScQueryParam& rParam, ScDocument* pNewUndoDoc, 275 ScDBCollection* pNewUndoDB, const ScRange* pOld, 276 sal_Bool bSize, const ScRange* pAdvSrc ); 277 virtual ~ScUndoQuery(); 278 279 virtual void Undo(); 280 virtual void Redo(); 281 virtual void Repeat(SfxRepeatTarget& rTarget); 282 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 283 284 virtual String GetComment() const; 285 286 private: 287 SdrUndoAction* pDrawUndo; 288 SCTAB nTab; 289 ScQueryParam aQueryParam; 290 ScDocument* pUndoDoc; 291 ScDBCollection* pUndoDB; // wegen Quell- und Zielbereich 292 ScRange aOldDest; 293 ScRange aAdvSource; 294 sal_Bool bIsAdvanced; 295 sal_Bool bDestArea; 296 sal_Bool bDoSize; 297 }; 298 299 300 class ScUndoAutoFilter: public ScDBFuncUndo 301 { 302 private: 303 String aDBName; 304 sal_Bool bFilterSet; 305 306 void DoChange( sal_Bool bUndo ); 307 308 public: 309 TYPEINFO(); 310 ScUndoAutoFilter( ScDocShell* pNewDocShell, const ScRange& rRange, 311 const String& rName, sal_Bool bSet ); 312 virtual ~ScUndoAutoFilter(); 313 314 virtual void Undo(); 315 virtual void Redo(); 316 virtual void Repeat(SfxRepeatTarget& rTarget); 317 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 318 319 virtual String GetComment() const; 320 }; 321 322 323 class ScUndoDBData: public ScSimpleUndo 324 { 325 public: 326 TYPEINFO(); 327 ScUndoDBData( ScDocShell* pNewDocShell, 328 ScDBCollection* pNewUndoColl, ScDBCollection* pNewRedoColl ); 329 virtual ~ScUndoDBData(); 330 331 virtual void Undo(); 332 virtual void Redo(); 333 virtual void Repeat(SfxRepeatTarget& rTarget); 334 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 335 336 virtual String GetComment() const; 337 338 private: 339 ScDBCollection* pUndoColl; 340 ScDBCollection* pRedoColl; 341 }; 342 343 344 class ScUndoImportData: public ScSimpleUndo 345 { 346 public: 347 TYPEINFO(); 348 ScUndoImportData( ScDocShell* pNewDocShell, SCTAB nNewTab, 349 const ScImportParam& rParam, SCCOL nNewEndX, SCROW nNewEndY, 350 SCCOL nNewFormula, 351 ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc, 352 ScDBData* pNewUndoData, ScDBData* pNewRedoData ); 353 virtual ~ScUndoImportData(); 354 355 virtual void Undo(); 356 virtual void Redo(); 357 virtual void Repeat(SfxRepeatTarget& rTarget); 358 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 359 360 virtual String GetComment() const; 361 362 private: 363 SCTAB nTab; 364 ScImportParam aImportParam; 365 SCCOL nEndCol; 366 SCROW nEndRow; 367 ScDocument* pUndoDoc; 368 ScDocument* pRedoDoc; 369 ScDBData* pUndoDBData; 370 ScDBData* pRedoDBData; 371 SCCOL nFormulaCols; 372 sal_Bool bRedoFilled; 373 }; 374 375 376 class ScUndoRepeatDB: public ScSimpleUndo 377 { 378 public: 379 TYPEINFO(); 380 ScUndoRepeatDB( ScDocShell* pNewDocShell, SCTAB nNewTab, 381 SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY, 382 SCROW nResultEndRow, SCCOL nCurX, SCROW nCurY, 383 ScDocument* pNewUndoDoc, ScOutlineTable* pNewUndoTab, 384 ScRangeName* pNewUndoRange, ScDBCollection* pNewUndoDB, 385 const ScRange* pOldQ, const ScRange* pNewQ ); 386 virtual ~ScUndoRepeatDB(); 387 388 virtual void Undo(); 389 virtual void Redo(); 390 virtual void Repeat(SfxRepeatTarget& rTarget); 391 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 392 393 virtual String GetComment() const; 394 395 private: 396 ScAddress aBlockStart; 397 ScAddress aBlockEnd; 398 SCROW nNewEndRow; 399 ScAddress aCursorPos; 400 ScDocument* pUndoDoc; 401 ScOutlineTable* pUndoTable; 402 ScRangeName* pUndoRange; 403 ScDBCollection* pUndoDB; 404 ScRange aOldQuery; 405 ScRange aNewQuery; 406 sal_Bool bQuerySize; 407 }; 408 409 //UNUSED2008-05 class ScUndoPivot: public ScSimpleUndo 410 //UNUSED2008-05 { 411 //UNUSED2008-05 public: 412 //UNUSED2008-05 TYPEINFO(); 413 //UNUSED2008-05 ScUndoPivot( ScDocShell* pNewDocShell, 414 //UNUSED2008-05 const ScArea& rOld, const ScArea& rNew, 415 //UNUSED2008-05 ScDocument* pOldDoc, ScDocument* pNewDoc, 416 //UNUSED2008-05 const ScPivot* pOldPivot, const ScPivot* pNewPivot ); 417 //UNUSED2008-05 virtual ~ScUndoPivot(); 418 //UNUSED2008-05 419 //UNUSED2008-05 virtual void Undo(); 420 //UNUSED2008-05 virtual void Redo(); 421 //UNUSED2008-05 virtual void Repeat(SfxRepeatTarget& rTarget); 422 //UNUSED2008-05 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 423 //UNUSED2008-05 424 //UNUSED2008-05 virtual String GetComment() const; 425 //UNUSED2008-05 426 //UNUSED2008-05 private: 427 //UNUSED2008-05 ScArea aOldArea; 428 //UNUSED2008-05 ScArea aNewArea; 429 //UNUSED2008-05 ScDocument* pOldUndoDoc; 430 //UNUSED2008-05 ScDocument* pNewUndoDoc; 431 //UNUSED2008-05 ScPivotParam aOldParam; // fuer Redo 432 //UNUSED2008-05 ScQueryParam aOldQuery; 433 //UNUSED2008-05 ScArea aOldSrc; 434 //UNUSED2008-05 ScPivotParam aNewParam; // fuer Undo in Collection 435 //UNUSED2008-05 ScQueryParam aNewQuery; 436 //UNUSED2008-05 ScArea aNewSrc; 437 //UNUSED2008-05 String aOldName; 438 //UNUSED2008-05 String aOldTag; 439 //UNUSED2008-05 String aNewName; 440 //UNUSED2008-05 String aNewTag; 441 //UNUSED2008-05 }; 442 443 class ScUndoDataPilot: public ScSimpleUndo 444 { 445 public: 446 TYPEINFO(); 447 ScUndoDataPilot( ScDocShell* pNewDocShell, 448 ScDocument* pOldDoc, ScDocument* pNewDoc, 449 const ScDPObject* pOldObj, const ScDPObject* pNewObj, 450 sal_Bool bMove ); 451 virtual ~ScUndoDataPilot(); 452 453 virtual void Undo(); 454 virtual void Redo(); 455 virtual void Repeat(SfxRepeatTarget& rTarget); 456 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 457 458 virtual String GetComment() const; 459 460 private: 461 ScDocument* pOldUndoDoc; 462 ScDocument* pNewUndoDoc; 463 ScDPObject* pOldDPObject; 464 ScDPObject* pNewDPObject; 465 sal_Bool bAllowMove; 466 }; 467 468 469 class ScUndoConsolidate: public ScSimpleUndo 470 { 471 public: 472 TYPEINFO(); 473 ScUndoConsolidate( ScDocShell* pNewDocShell, 474 const ScArea& rArea, const ScConsolidateParam& rPar, 475 ScDocument* pNewUndoDoc, sal_Bool bReference, 476 SCROW nInsCount, ScOutlineTable* pTab, 477 ScDBData* pData ); 478 virtual ~ScUndoConsolidate(); 479 480 virtual void Undo(); 481 virtual void Redo(); 482 virtual void Repeat(SfxRepeatTarget& rTarget); 483 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 484 485 virtual String GetComment() const; 486 487 private: 488 ScArea aDestArea; 489 ScDocument* pUndoDoc; 490 ScConsolidateParam aParam; 491 sal_Bool bInsRef; 492 SCSIZE nInsertCount; 493 ScOutlineTable* pUndoTab; 494 ScDBData* pUndoData; 495 }; 496 497 498 class ScUndoChartData: public ScSimpleUndo 499 { 500 public: 501 TYPEINFO(); 502 ScUndoChartData( ScDocShell* pNewDocShell, 503 const String& rName, const ScRange& rNew, 504 sal_Bool bColHdr, sal_Bool bRowHdr, sal_Bool bAdd ); 505 ScUndoChartData( ScDocShell* pNewDocShell, 506 const String& rName, const ScRangeListRef& rNew, 507 sal_Bool bColHdr, sal_Bool bRowHdr, sal_Bool bAdd ); 508 virtual ~ScUndoChartData(); 509 510 virtual void Undo(); 511 virtual void Redo(); 512 virtual void Repeat(SfxRepeatTarget& rTarget); 513 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 514 515 virtual String GetComment() const; 516 517 private: 518 String aChartName; 519 ScRangeListRef aOldRangeListRef; 520 sal_Bool bOldColHeaders; 521 sal_Bool bOldRowHeaders; 522 // ScRange aNewRange; 523 ScRangeListRef aNewRangeListRef; 524 sal_Bool bNewColHeaders; 525 sal_Bool bNewRowHeaders; 526 sal_Bool bAddRange; 527 528 void Init(); 529 }; 530 531 532 533 534 #endif 535 536