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