update dev300-m58
[ooovba.git] / sc / source / ui / inc / undocell.hxx
blob72d4f98ce6dc030844215639195002a16ce7d9ab
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: undocell.hxx,v $
10 * $Revision: 1.5.128.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_UNDOCELL_HXX
32 #define SC_UNDOCELL_HXX
34 #include "undobase.hxx"
35 #include "postit.hxx"
37 #include <boost/shared_ptr.hpp>
39 class ScDocShell;
40 class ScBaseCell;
41 class ScPatternAttr;
42 class EditTextObject;
43 class SdrUndoAction;
44 class ScDetOpList;
45 class ScDetOpData;
46 class ScRangeName;
48 //----------------------------------------------------------------------------
50 class ScUndoCursorAttr: public ScSimpleUndo
52 public:
53 TYPEINFO();
54 ScUndoCursorAttr( ScDocShell* pNewDocShell,
55 SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
56 const ScPatternAttr* pOldPat, const ScPatternAttr* pNewPat,
57 const ScPatternAttr* pApplyPat, BOOL bAutomatic );
58 virtual ~ScUndoCursorAttr();
60 virtual void Undo();
61 virtual void Redo();
62 virtual void Repeat(SfxRepeatTarget& rTarget);
63 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
65 virtual String GetComment() const;
67 /** once the objects are passed to this class, their life-cycle is
68 managed by this class; the calling function must pass new'ed
69 objects to this method. */
70 void SetEditData( EditTextObject* pOld, EditTextObject* pNew );
72 private:
73 SCCOL nCol;
74 SCROW nRow;
75 SCTAB nTab;
76 ScPatternAttr* pOldPattern;
77 ScPatternAttr* pNewPattern;
78 ScPatternAttr* pApplyPattern;
79 ::boost::shared_ptr<EditTextObject> pOldEditData;
80 ::boost::shared_ptr<EditTextObject> pNewEditData;
81 BOOL bIsAutomatic;
83 void DoChange( const ScPatternAttr* pWhichPattern, const ::boost::shared_ptr<EditTextObject>& pEditData ) const;
87 class ScUndoEnterData: public ScSimpleUndo
89 public:
90 TYPEINFO();
91 ScUndoEnterData( ScDocShell* pNewDocShell,
92 SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
93 SCTAB nNewCount, SCTAB* pNewTabs,
94 ScBaseCell** ppOldData, BOOL* pHasForm, ULONG* pOldForm,
95 const String& rNewStr, EditTextObject* pObj = NULL );
96 virtual ~ScUndoEnterData();
98 virtual void Undo();
99 virtual void Redo();
100 virtual void Repeat(SfxRepeatTarget& rTarget);
101 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
103 virtual String GetComment() const;
105 private:
106 String aNewString;
107 SCTAB* pTabs;
108 ScBaseCell** ppOldCells;
109 BOOL* pHasFormat;
110 ULONG* pOldFormats;
111 EditTextObject* pNewEditData;
112 ULONG nEndChangeAction;
113 SCCOL nCol;
114 SCROW nRow;
115 SCTAB nTab;
116 SCTAB nCount; // markierte Tabellen
118 void DoChange() const;
119 void SetChangeTrack();
123 class ScUndoEnterValue: public ScSimpleUndo
125 public:
126 TYPEINFO();
127 ScUndoEnterValue( ScDocShell* pNewDocShell,
128 const ScAddress& rNewPos,
129 ScBaseCell* pUndoCell, double nVal, BOOL bHeight );
130 virtual ~ScUndoEnterValue();
132 virtual void Undo();
133 virtual void Redo();
134 virtual void Repeat(SfxRepeatTarget& rTarget);
135 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
137 virtual String GetComment() const;
139 private:
140 ScAddress aPos;
141 ScBaseCell* pOldCell;
142 double nValue;
143 ULONG nEndChangeAction;
144 BOOL bNeedHeight;
146 void SetChangeTrack();
150 class ScUndoPutCell: public ScSimpleUndo
152 public:
153 TYPEINFO();
154 ScUndoPutCell( ScDocShell* pNewDocShell,
155 const ScAddress& rNewPos,
156 ScBaseCell* pUndoCell, ScBaseCell* pRedoCell, BOOL bHeight );
157 virtual ~ScUndoPutCell();
159 virtual void Undo();
160 virtual void Redo();
161 virtual void Repeat(SfxRepeatTarget& rTarget);
162 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
164 virtual String GetComment() const;
166 private:
167 ScAddress aPos;
168 ScBaseCell* pOldCell;
169 ScBaseCell* pEnteredCell;
170 ULONG nEndChangeAction;
171 BOOL bNeedHeight;
173 void SetChangeTrack();
177 class ScUndoPageBreak: public ScSimpleUndo
179 public:
180 TYPEINFO();
181 ScUndoPageBreak( ScDocShell* pNewDocShell,
182 SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
183 BOOL bNewColumn, BOOL bNewInsert );
184 virtual ~ScUndoPageBreak();
186 virtual void Undo();
187 virtual void Redo();
188 virtual void Repeat(SfxRepeatTarget& rTarget);
189 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
191 virtual String GetComment() const;
193 private:
194 SCCOL nCol;
195 SCROW nRow;
196 SCTAB nTab;
197 BOOL bColumn; // Spalten- oder Zeilenumbruch
198 BOOL bInsert; // Einfuegen oder Loeschen
200 void DoChange( BOOL bInsert ) const;
203 class ScUndoPrintZoom: public ScSimpleUndo
205 public:
206 TYPEINFO();
207 ScUndoPrintZoom( ScDocShell* pNewDocShell, SCTAB nT,
208 USHORT nOS, USHORT nOP, USHORT nNS, USHORT nNP );
209 virtual ~ScUndoPrintZoom();
211 virtual void Undo();
212 virtual void Redo();
213 virtual void Repeat(SfxRepeatTarget& rTarget);
214 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
216 virtual String GetComment() const;
218 private:
219 SCTAB nTab;
220 USHORT nOldScale;
221 USHORT nOldPages;
222 USHORT nNewScale;
223 USHORT nNewPages;
225 void DoChange( BOOL bUndo );
228 class ScUndoThesaurus: public ScSimpleUndo
230 public:
231 TYPEINFO();
232 ScUndoThesaurus( ScDocShell* pNewDocShell,
233 SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
234 const String& rNewUndoStr, const EditTextObject* pUndoTObj,
235 const String& rNewRedoStr, const EditTextObject* pRedoTObj);
236 virtual ~ScUndoThesaurus();
238 virtual void Undo();
239 virtual void Redo();
240 virtual void Repeat(SfxRepeatTarget& rTarget);
241 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
243 virtual String GetComment() const;
245 private:
246 SCCOL nCol;
247 SCROW nRow;
248 SCTAB nTab;
249 String aUndoStr; // Daten bei StringZelle
250 EditTextObject* pUndoTObject; // bei EditZelle
251 String aRedoStr;
252 EditTextObject* pRedoTObject;
253 ULONG nEndChangeAction;
255 void DoChange( BOOL bUndo, const String& rStr,
256 const EditTextObject* pTObj );
257 void SetChangeTrack( ScBaseCell* pOldCell );
260 // ============================================================================
262 /** Undo action for inserting, removing, and replacing a cell note. */
263 class ScUndoReplaceNote : public ScSimpleUndo
265 public:
266 TYPEINFO();
268 /** Constructs an undo action for inserting or removing a cell note. */
269 ScUndoReplaceNote(
270 ScDocShell& rDocShell,
271 const ScAddress& rPos,
272 const ScNoteData& rNoteData,
273 bool bInsert,
274 SdrUndoAction* pDrawUndo );
276 /** Constructs an undo action for replacing a cell note with another. */
277 ScUndoReplaceNote(
278 ScDocShell& rDocShell,
279 const ScAddress& rPos,
280 const ScNoteData& rOldData,
281 const ScNoteData& rNewData,
282 SdrUndoAction* pDrawUndo );
284 virtual ~ScUndoReplaceNote();
286 virtual void Undo();
287 virtual void Redo();
288 virtual void Repeat( SfxRepeatTarget& rTarget );
289 virtual BOOL CanRepeat( SfxRepeatTarget& rTarget ) const;
291 virtual String GetComment() const;
293 private:
294 void DoInsertNote( const ScNoteData& rNoteData );
295 void DoRemoveNote( const ScNoteData& rNoteData );
297 private:
298 ScAddress maPos;
299 ScNoteData maOldData;
300 ScNoteData maNewData;
301 SdrUndoAction* mpDrawUndo;
304 // ============================================================================
306 /** Undo action for showing or hiding a cell note caption. */
307 class ScUndoShowHideNote : public ScSimpleUndo
309 public:
310 TYPEINFO();
311 ScUndoShowHideNote( ScDocShell& rDocShell, const ScAddress& rPos, bool bShow );
312 virtual ~ScUndoShowHideNote();
314 virtual void Undo();
315 virtual void Redo();
316 virtual void Repeat( SfxRepeatTarget& rTarget );
317 virtual BOOL CanRepeat( SfxRepeatTarget& rTarget ) const;
319 virtual String GetComment() const;
321 private:
322 ScAddress maPos;
323 bool mbShown;
326 // ============================================================================
328 class ScUndoDetective: public ScSimpleUndo
330 public:
331 TYPEINFO();
332 ScUndoDetective( ScDocShell* pNewDocShell,
333 SdrUndoAction* pDraw, const ScDetOpData* pOperation,
334 ScDetOpList* pUndoList = NULL );
335 virtual ~ScUndoDetective();
337 virtual void Undo();
338 virtual void Redo();
339 virtual void Repeat(SfxRepeatTarget& rTarget);
340 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
342 virtual String GetComment() const;
344 private:
345 BOOL bIsDelete;
346 ScDetOpList* pOldList;
347 USHORT nAction;
348 ScAddress aPos;
349 SdrUndoAction* pDrawUndo;
353 class ScUndoRangeNames: public ScSimpleUndo
355 public:
356 TYPEINFO();
357 ScUndoRangeNames( ScDocShell* pNewDocShell,
358 ScRangeName* pOld, ScRangeName* pNew );
359 virtual ~ScUndoRangeNames();
361 virtual void Undo();
362 virtual void Redo();
363 virtual void Repeat(SfxRepeatTarget& rTarget);
364 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
366 virtual String GetComment() const;
368 private:
369 ScRangeName* pOldRanges;
370 ScRangeName* pNewRanges;
372 void DoChange( BOOL bUndo );
377 #endif