1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SC_UNDOBASE_HXX 25 #define SC_UNDOBASE_HXX 26 27 #include <svl/undo.hxx> 28 #include "global.hxx" 29 #include "address.hxx" 30 #include "docsh.hxx" 31 32 class ScDocument; 33 class ScDocShell; 34 class SdrUndoAction; 35 class ScRefUndoData; 36 class ScDBData; 37 38 //---------------------------------------------------------------------------- 39 40 class ScSimpleUndo: public SfxUndoAction 41 { 42 public: 43 TYPEINFO(); 44 ScSimpleUndo( ScDocShell* pDocSh ); 45 virtual ~ScSimpleUndo(); 46 47 virtual sal_Bool Merge( SfxUndoAction *pNextAction ); 48 49 protected: 50 ScDocShell* pDocShell; 51 SfxUndoAction* pDetectiveUndo; 52 IsPaintLocked() const53 bool IsPaintLocked() const { return pDocShell->IsPaintLocked(); } 54 55 bool SetViewMarkData( const ScMarkData& rMarkData ); 56 57 void BeginUndo(); 58 void EndUndo(); 59 void BeginRedo(); 60 void EndRedo(); 61 62 static void ShowTable( SCTAB nTab ); 63 static void ShowTable( const ScRange& rRange ); 64 }; 65 66 //---------------------------------------------------------------------------- 67 68 enum ScBlockUndoMode { SC_UNDO_SIMPLE, SC_UNDO_MANUALHEIGHT, SC_UNDO_AUTOHEIGHT }; 69 70 class ScBlockUndo: public ScSimpleUndo 71 { 72 public: 73 TYPEINFO(); 74 ScBlockUndo( ScDocShell* pDocSh, const ScRange& rRange, 75 ScBlockUndoMode eBlockMode ); 76 virtual ~ScBlockUndo(); 77 78 protected: 79 ScRange aBlockRange; 80 SdrUndoAction* pDrawUndo; 81 ScBlockUndoMode eMode; 82 83 void BeginUndo(); 84 void EndUndo(); 85 // void BeginRedo(); 86 void EndRedo(); 87 88 sal_Bool AdjustHeight(); 89 void ShowBlock(); 90 }; 91 92 //---------------------------------------------------------------------------- 93 94 // for functions that act on a database range - takes care of the unnamed database range 95 // (collected separately, before the undo action, for showing dialogs etc.) 96 97 class ScDBFuncUndo: public ScSimpleUndo 98 { 99 ScDBData* pAutoDBRange; 100 ScRange aOriginalRange; 101 SdrUndoAction* mpDrawUndo; 102 103 public: 104 TYPEINFO(); 105 ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal, SdrUndoAction* pDrawUndo = 0 ); 106 virtual ~ScDBFuncUndo(); 107 108 void SetDrawUndoAction( SdrUndoAction* pDrawUndo ); 109 110 void BeginUndo(); 111 void EndUndo(); 112 void BeginRedo(); 113 void EndRedo(); 114 }; 115 116 //---------------------------------------------------------------------------- 117 118 enum ScMoveUndoMode { SC_UNDO_REFFIRST, SC_UNDO_REFLAST }; 119 120 class ScMoveUndo: public ScSimpleUndo // mit Referenzen 121 { 122 public: 123 TYPEINFO(); 124 ScMoveUndo( ScDocShell* pDocSh, 125 ScDocument* pRefDoc, ScRefUndoData* pRefData, 126 ScMoveUndoMode eRefMode ); 127 virtual ~ScMoveUndo(); 128 129 protected: 130 SdrUndoAction* pDrawUndo; 131 ScDocument* pRefUndoDoc; 132 ScRefUndoData* pRefUndoData; 133 ScMoveUndoMode eMode; 134 135 void BeginUndo(); 136 void EndUndo(); 137 // void BeginRedo(); 138 // void EndRedo(); 139 140 private: 141 void UndoRef(); 142 }; 143 144 //---------------------------------------------------------------------------- 145 146 class ScUndoWrapper: public SfxUndoAction // for manual merging of actions 147 { 148 SfxUndoAction* pWrappedUndo; 149 150 public: 151 TYPEINFO(); 152 ScUndoWrapper( SfxUndoAction* pUndo ); 153 virtual ~ScUndoWrapper(); 154 GetWrappedUndo()155 SfxUndoAction* GetWrappedUndo() { return pWrappedUndo; } 156 void ForgetWrappedUndo(); 157 158 virtual void SetLinkToSfxLinkUndoAction(SfxLinkUndoAction* pSfxLinkUndoAction); 159 160 virtual void Undo(); 161 virtual void Redo(); 162 virtual void Repeat(SfxRepeatTarget& rTarget); 163 virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; 164 virtual sal_Bool Merge( SfxUndoAction *pNextAction ); 165 virtual String GetComment() const; 166 virtual String GetRepeatComment(SfxRepeatTarget&) const; 167 virtual sal_uInt16 GetId() const; 168 }; 169 170 171 #endif 172 173