1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SC_UNDOCELL_HXX 29*cdf0e10cSrcweir #define SC_UNDOCELL_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "undobase.hxx" 32*cdf0e10cSrcweir #include "postit.hxx" 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir class ScDocShell; 35*cdf0e10cSrcweir class ScBaseCell; 36*cdf0e10cSrcweir class ScPatternAttr; 37*cdf0e10cSrcweir class EditTextObject; 38*cdf0e10cSrcweir class SdrUndoAction; 39*cdf0e10cSrcweir class ScDetOpList; 40*cdf0e10cSrcweir class ScDetOpData; 41*cdf0e10cSrcweir class ScRangeName; 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir //---------------------------------------------------------------------------- 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir class ScUndoCursorAttr: public ScSimpleUndo 46*cdf0e10cSrcweir { 47*cdf0e10cSrcweir public: 48*cdf0e10cSrcweir TYPEINFO(); 49*cdf0e10cSrcweir ScUndoCursorAttr( ScDocShell* pNewDocShell, 50*cdf0e10cSrcweir SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, 51*cdf0e10cSrcweir const ScPatternAttr* pOldPat, const ScPatternAttr* pNewPat, 52*cdf0e10cSrcweir const ScPatternAttr* pApplyPat, sal_Bool bAutomatic ); 53*cdf0e10cSrcweir virtual ~ScUndoCursorAttr(); 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir virtual void Undo(); 56*cdf0e10cSrcweir virtual void Redo(); 57*cdf0e10cSrcweir virtual void Repeat(SfxRepeatTarget& rTarget); 58*cdf0e10cSrcweir virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir virtual String GetComment() const; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir private: 63*cdf0e10cSrcweir SCCOL nCol; 64*cdf0e10cSrcweir SCROW nRow; 65*cdf0e10cSrcweir SCTAB nTab; 66*cdf0e10cSrcweir ScPatternAttr* pOldPattern; 67*cdf0e10cSrcweir ScPatternAttr* pNewPattern; 68*cdf0e10cSrcweir ScPatternAttr* pApplyPattern; 69*cdf0e10cSrcweir sal_Bool bIsAutomatic; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir void DoChange( const ScPatternAttr* pWhichPattern ) const; 72*cdf0e10cSrcweir }; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir class ScUndoEnterData: public ScSimpleUndo 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir public: 78*cdf0e10cSrcweir TYPEINFO(); 79*cdf0e10cSrcweir ScUndoEnterData( ScDocShell* pNewDocShell, 80*cdf0e10cSrcweir SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, 81*cdf0e10cSrcweir SCTAB nNewCount, SCTAB* pNewTabs, 82*cdf0e10cSrcweir ScBaseCell** ppOldData, sal_Bool* pHasForm, sal_uLong* pOldForm, 83*cdf0e10cSrcweir const String& rNewStr, EditTextObject* pObj = NULL ); 84*cdf0e10cSrcweir virtual ~ScUndoEnterData(); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir virtual void Undo(); 87*cdf0e10cSrcweir virtual void Redo(); 88*cdf0e10cSrcweir virtual void Repeat(SfxRepeatTarget& rTarget); 89*cdf0e10cSrcweir virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir virtual String GetComment() const; 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir private: 94*cdf0e10cSrcweir String aNewString; 95*cdf0e10cSrcweir SCTAB* pTabs; 96*cdf0e10cSrcweir ScBaseCell** ppOldCells; 97*cdf0e10cSrcweir sal_Bool* pHasFormat; 98*cdf0e10cSrcweir sal_uLong* pOldFormats; 99*cdf0e10cSrcweir EditTextObject* pNewEditData; 100*cdf0e10cSrcweir sal_uLong nEndChangeAction; 101*cdf0e10cSrcweir SCCOL nCol; 102*cdf0e10cSrcweir SCROW nRow; 103*cdf0e10cSrcweir SCTAB nTab; 104*cdf0e10cSrcweir SCTAB nCount; // markierte Tabellen 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir void DoChange() const; 107*cdf0e10cSrcweir void SetChangeTrack(); 108*cdf0e10cSrcweir }; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir class ScUndoEnterValue: public ScSimpleUndo 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir public: 114*cdf0e10cSrcweir TYPEINFO(); 115*cdf0e10cSrcweir ScUndoEnterValue( ScDocShell* pNewDocShell, 116*cdf0e10cSrcweir const ScAddress& rNewPos, 117*cdf0e10cSrcweir ScBaseCell* pUndoCell, double nVal, sal_Bool bHeight ); 118*cdf0e10cSrcweir virtual ~ScUndoEnterValue(); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir virtual void Undo(); 121*cdf0e10cSrcweir virtual void Redo(); 122*cdf0e10cSrcweir virtual void Repeat(SfxRepeatTarget& rTarget); 123*cdf0e10cSrcweir virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir virtual String GetComment() const; 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir private: 128*cdf0e10cSrcweir ScAddress aPos; 129*cdf0e10cSrcweir ScBaseCell* pOldCell; 130*cdf0e10cSrcweir double nValue; 131*cdf0e10cSrcweir sal_uLong nEndChangeAction; 132*cdf0e10cSrcweir sal_Bool bNeedHeight; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir void SetChangeTrack(); 135*cdf0e10cSrcweir }; 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir class ScUndoPutCell: public ScSimpleUndo 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir public: 141*cdf0e10cSrcweir TYPEINFO(); 142*cdf0e10cSrcweir ScUndoPutCell( ScDocShell* pNewDocShell, 143*cdf0e10cSrcweir const ScAddress& rNewPos, 144*cdf0e10cSrcweir ScBaseCell* pUndoCell, ScBaseCell* pRedoCell, sal_Bool bHeight ); 145*cdf0e10cSrcweir virtual ~ScUndoPutCell(); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir virtual void Undo(); 148*cdf0e10cSrcweir virtual void Redo(); 149*cdf0e10cSrcweir virtual void Repeat(SfxRepeatTarget& rTarget); 150*cdf0e10cSrcweir virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir virtual String GetComment() const; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir private: 155*cdf0e10cSrcweir ScAddress aPos; 156*cdf0e10cSrcweir ScBaseCell* pOldCell; 157*cdf0e10cSrcweir ScBaseCell* pEnteredCell; 158*cdf0e10cSrcweir sal_uLong nEndChangeAction; 159*cdf0e10cSrcweir sal_Bool bNeedHeight; 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir void SetChangeTrack(); 162*cdf0e10cSrcweir }; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir class ScUndoPageBreak: public ScSimpleUndo 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir public: 168*cdf0e10cSrcweir TYPEINFO(); 169*cdf0e10cSrcweir ScUndoPageBreak( ScDocShell* pNewDocShell, 170*cdf0e10cSrcweir SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, 171*cdf0e10cSrcweir sal_Bool bNewColumn, sal_Bool bNewInsert ); 172*cdf0e10cSrcweir virtual ~ScUndoPageBreak(); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir virtual void Undo(); 175*cdf0e10cSrcweir virtual void Redo(); 176*cdf0e10cSrcweir virtual void Repeat(SfxRepeatTarget& rTarget); 177*cdf0e10cSrcweir virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir virtual String GetComment() const; 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir private: 182*cdf0e10cSrcweir SCCOL nCol; 183*cdf0e10cSrcweir SCROW nRow; 184*cdf0e10cSrcweir SCTAB nTab; 185*cdf0e10cSrcweir sal_Bool bColumn; // Spalten- oder Zeilenumbruch 186*cdf0e10cSrcweir sal_Bool bInsert; // Einfuegen oder Loeschen 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir void DoChange( sal_Bool bInsert ) const; 189*cdf0e10cSrcweir }; 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir class ScUndoPrintZoom: public ScSimpleUndo 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir public: 194*cdf0e10cSrcweir TYPEINFO(); 195*cdf0e10cSrcweir ScUndoPrintZoom( ScDocShell* pNewDocShell, SCTAB nT, 196*cdf0e10cSrcweir sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP ); 197*cdf0e10cSrcweir virtual ~ScUndoPrintZoom(); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir virtual void Undo(); 200*cdf0e10cSrcweir virtual void Redo(); 201*cdf0e10cSrcweir virtual void Repeat(SfxRepeatTarget& rTarget); 202*cdf0e10cSrcweir virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir virtual String GetComment() const; 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir private: 207*cdf0e10cSrcweir SCTAB nTab; 208*cdf0e10cSrcweir sal_uInt16 nOldScale; 209*cdf0e10cSrcweir sal_uInt16 nOldPages; 210*cdf0e10cSrcweir sal_uInt16 nNewScale; 211*cdf0e10cSrcweir sal_uInt16 nNewPages; 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir void DoChange( sal_Bool bUndo ); 214*cdf0e10cSrcweir }; 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir class ScUndoThesaurus: public ScSimpleUndo 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir public: 219*cdf0e10cSrcweir TYPEINFO(); 220*cdf0e10cSrcweir ScUndoThesaurus( ScDocShell* pNewDocShell, 221*cdf0e10cSrcweir SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, 222*cdf0e10cSrcweir const String& rNewUndoStr, const EditTextObject* pUndoTObj, 223*cdf0e10cSrcweir const String& rNewRedoStr, const EditTextObject* pRedoTObj); 224*cdf0e10cSrcweir virtual ~ScUndoThesaurus(); 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir virtual void Undo(); 227*cdf0e10cSrcweir virtual void Redo(); 228*cdf0e10cSrcweir virtual void Repeat(SfxRepeatTarget& rTarget); 229*cdf0e10cSrcweir virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir virtual String GetComment() const; 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir private: 234*cdf0e10cSrcweir SCCOL nCol; 235*cdf0e10cSrcweir SCROW nRow; 236*cdf0e10cSrcweir SCTAB nTab; 237*cdf0e10cSrcweir String aUndoStr; // Daten bei StringZelle 238*cdf0e10cSrcweir EditTextObject* pUndoTObject; // bei EditZelle 239*cdf0e10cSrcweir String aRedoStr; 240*cdf0e10cSrcweir EditTextObject* pRedoTObject; 241*cdf0e10cSrcweir sal_uLong nEndChangeAction; 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir void DoChange( sal_Bool bUndo, const String& rStr, 244*cdf0e10cSrcweir const EditTextObject* pTObj ); 245*cdf0e10cSrcweir void SetChangeTrack( ScBaseCell* pOldCell ); 246*cdf0e10cSrcweir }; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir // ============================================================================ 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir /** Undo action for inserting, removing, and replacing a cell note. */ 251*cdf0e10cSrcweir class ScUndoReplaceNote : public ScSimpleUndo 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir public: 254*cdf0e10cSrcweir TYPEINFO(); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir /** Constructs an undo action for inserting or removing a cell note. */ 257*cdf0e10cSrcweir ScUndoReplaceNote( 258*cdf0e10cSrcweir ScDocShell& rDocShell, 259*cdf0e10cSrcweir const ScAddress& rPos, 260*cdf0e10cSrcweir const ScNoteData& rNoteData, 261*cdf0e10cSrcweir bool bInsert, 262*cdf0e10cSrcweir SdrUndoAction* pDrawUndo ); 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir /** Constructs an undo action for replacing a cell note with another. */ 265*cdf0e10cSrcweir ScUndoReplaceNote( 266*cdf0e10cSrcweir ScDocShell& rDocShell, 267*cdf0e10cSrcweir const ScAddress& rPos, 268*cdf0e10cSrcweir const ScNoteData& rOldData, 269*cdf0e10cSrcweir const ScNoteData& rNewData, 270*cdf0e10cSrcweir SdrUndoAction* pDrawUndo ); 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir virtual ~ScUndoReplaceNote(); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir virtual void Undo(); 275*cdf0e10cSrcweir virtual void Redo(); 276*cdf0e10cSrcweir virtual void Repeat( SfxRepeatTarget& rTarget ); 277*cdf0e10cSrcweir virtual sal_Bool CanRepeat( SfxRepeatTarget& rTarget ) const; 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir virtual String GetComment() const; 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir private: 282*cdf0e10cSrcweir void DoInsertNote( const ScNoteData& rNoteData ); 283*cdf0e10cSrcweir void DoRemoveNote( const ScNoteData& rNoteData ); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir private: 286*cdf0e10cSrcweir ScAddress maPos; 287*cdf0e10cSrcweir ScNoteData maOldData; 288*cdf0e10cSrcweir ScNoteData maNewData; 289*cdf0e10cSrcweir SdrUndoAction* mpDrawUndo; 290*cdf0e10cSrcweir }; 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir // ============================================================================ 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir /** Undo action for showing or hiding a cell note caption. */ 295*cdf0e10cSrcweir class ScUndoShowHideNote : public ScSimpleUndo 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir public: 298*cdf0e10cSrcweir TYPEINFO(); 299*cdf0e10cSrcweir ScUndoShowHideNote( ScDocShell& rDocShell, const ScAddress& rPos, bool bShow ); 300*cdf0e10cSrcweir virtual ~ScUndoShowHideNote(); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir virtual void Undo(); 303*cdf0e10cSrcweir virtual void Redo(); 304*cdf0e10cSrcweir virtual void Repeat( SfxRepeatTarget& rTarget ); 305*cdf0e10cSrcweir virtual sal_Bool CanRepeat( SfxRepeatTarget& rTarget ) const; 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir virtual String GetComment() const; 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir private: 310*cdf0e10cSrcweir ScAddress maPos; 311*cdf0e10cSrcweir bool mbShown; 312*cdf0e10cSrcweir }; 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir // ============================================================================ 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir class ScUndoDetective: public ScSimpleUndo 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir public: 319*cdf0e10cSrcweir TYPEINFO(); 320*cdf0e10cSrcweir ScUndoDetective( ScDocShell* pNewDocShell, 321*cdf0e10cSrcweir SdrUndoAction* pDraw, const ScDetOpData* pOperation, 322*cdf0e10cSrcweir ScDetOpList* pUndoList = NULL ); 323*cdf0e10cSrcweir virtual ~ScUndoDetective(); 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir virtual void Undo(); 326*cdf0e10cSrcweir virtual void Redo(); 327*cdf0e10cSrcweir virtual void Repeat(SfxRepeatTarget& rTarget); 328*cdf0e10cSrcweir virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir virtual String GetComment() const; 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir private: 333*cdf0e10cSrcweir sal_Bool bIsDelete; 334*cdf0e10cSrcweir ScDetOpList* pOldList; 335*cdf0e10cSrcweir sal_uInt16 nAction; 336*cdf0e10cSrcweir ScAddress aPos; 337*cdf0e10cSrcweir SdrUndoAction* pDrawUndo; 338*cdf0e10cSrcweir }; 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir class ScUndoRangeNames: public ScSimpleUndo 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir public: 344*cdf0e10cSrcweir TYPEINFO(); 345*cdf0e10cSrcweir ScUndoRangeNames( ScDocShell* pNewDocShell, 346*cdf0e10cSrcweir ScRangeName* pOld, ScRangeName* pNew ); 347*cdf0e10cSrcweir virtual ~ScUndoRangeNames(); 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir virtual void Undo(); 350*cdf0e10cSrcweir virtual void Redo(); 351*cdf0e10cSrcweir virtual void Repeat(SfxRepeatTarget& rTarget); 352*cdf0e10cSrcweir virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir virtual String GetComment() const; 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir private: 357*cdf0e10cSrcweir ScRangeName* pOldRanges; 358*cdf0e10cSrcweir ScRangeName* pNewRanges; 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir void DoChange( sal_Bool bUndo ); 361*cdf0e10cSrcweir }; 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir #endif 366*cdf0e10cSrcweir 367