update dev300-m57
[ooovba.git] / sc / source / ui / inc / undotab.hxx
blob7f18fdbb32de2a60e7344a683d9ad6c03d071988
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: undotab.hxx,v $
10 * $Revision: 1.10.28.2 $
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_UNDOTAB_HXX
32 #define SC_UNDOTAB_HXX
34 #include "undobase.hxx"
35 #include "markdata.hxx"
36 #include "formula/grammar.hxx"
37 #include <tools/color.hxx>
39 #ifndef _SVSTDARR_SHORTS
41 #define _SVSTDARR_SHORTS
42 #include <svtools/svstdarr.hxx>
44 #endif
46 #ifndef _SVSTDARR_STRINGS
48 #define _SVSTDARR_STRINGS
49 #include <svtools/svstdarr.hxx>
51 #endif
53 #include <com/sun/star/uno/Sequence.hxx>
55 #include <memory>
57 class ScDocShell;
58 class ScDocument;
59 class SdrUndoAction;
60 class ScPrintRangeSaver;
61 class SdrObject;
62 class ScDocProtection;
63 class ScTableProtection;
65 //----------------------------------------------------------------------------
67 class ScUndoInsertTab : public ScSimpleUndo
69 public:
70 TYPEINFO();
71 ScUndoInsertTab(
72 ScDocShell* pNewDocShell,
73 SCTAB nTabNum,
74 BOOL bApp,
75 const String& rNewName);
76 virtual ~ScUndoInsertTab();
78 virtual void Undo();
79 virtual void Redo();
80 virtual void Repeat(SfxRepeatTarget& rTarget);
81 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
83 virtual String GetComment() const;
85 private:
86 String sNewName;
87 SdrUndoAction* pDrawUndo;
88 ULONG nEndChangeAction;
89 SCTAB nTab;
90 BOOL bAppend;
92 void SetChangeTrack();
95 class ScUndoInsertTables : public ScSimpleUndo
97 public:
98 TYPEINFO();
99 ScUndoInsertTables(
100 ScDocShell* pNewDocShell,
101 SCTAB nTabNum,
102 BOOL bApp,
103 SvStrings *pNewNameList);
104 virtual ~ScUndoInsertTables();
106 virtual void Undo();
107 virtual void Redo();
108 virtual void Repeat(SfxRepeatTarget& rTarget);
109 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
111 virtual String GetComment() const;
113 private:
115 SdrUndoAction* pDrawUndo;
116 SvStrings* pNameList;
117 ULONG nStartChangeAction;
118 ULONG nEndChangeAction;
119 SCTAB nTab;
120 BOOL bAppend;
122 void SetChangeTrack();
126 class ScUndoDeleteTab: public ScMoveUndo // Draw vom Move fuer geloeschte Tabelle
128 public:
129 TYPEINFO();
130 ScUndoDeleteTab(
131 ScDocShell* pNewDocShell,
132 const SvShorts &theTabs, //SCTAB nNewTab,
133 ScDocument* pUndoDocument,
134 ScRefUndoData* pRefData );
135 virtual ~ScUndoDeleteTab();
137 virtual void Undo();
138 virtual void Redo();
139 virtual void Repeat(SfxRepeatTarget& rTarget);
140 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
142 virtual String GetComment() const;
144 private:
145 SvShorts theTabs;
146 ULONG nStartChangeAction;
147 ULONG nEndChangeAction;
149 void SetChangeTrack();
153 class ScUndoRenameTab: public ScSimpleUndo
155 public:
156 TYPEINFO();
157 ScUndoRenameTab(
158 ScDocShell* pNewDocShell,
159 SCTAB nT,
160 const String& rOldName,
161 const String& rNewName);
162 virtual ~ScUndoRenameTab();
164 virtual void Undo();
165 virtual void Redo();
166 virtual void Repeat(SfxRepeatTarget& rTarget);
167 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
169 virtual String GetComment() const;
171 private:
172 SCTAB nTab;
173 String sOldName;
174 String sNewName;
176 void DoChange( SCTAB nTab, const String& rName ) const;
180 class ScUndoMoveTab: public ScSimpleUndo
182 public:
183 TYPEINFO();
184 ScUndoMoveTab( ScDocShell* pNewDocShell,
185 const SvShorts &aOldTab,
186 const SvShorts &aNewTab);
187 virtual ~ScUndoMoveTab();
189 virtual void Undo();
190 virtual void Redo();
191 virtual void Repeat(SfxRepeatTarget& rTarget);
192 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
194 virtual String GetComment() const;
196 private:
197 SvShorts theOldTabs;
198 SvShorts theNewTabs;
200 void DoChange( BOOL bUndo ) const;
204 class ScUndoCopyTab: public ScSimpleUndo
206 public:
207 TYPEINFO();
208 ScUndoCopyTab(ScDocShell* pNewDocShell,
209 const SvShorts &aOldTab,
210 const SvShorts &aNewTab);
212 virtual ~ScUndoCopyTab();
214 virtual void Undo();
215 virtual void Redo();
216 virtual void Repeat(SfxRepeatTarget& rTarget);
217 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
219 virtual String GetComment() const;
221 private:
222 SdrUndoAction* pDrawUndo;
223 SvShorts theOldTabs;
224 SvShorts theNewTabs;
226 void DoChange() const;
230 class ScUndoMakeScenario: public ScSimpleUndo
232 public:
233 TYPEINFO();
234 ScUndoMakeScenario(
235 ScDocShell* pNewDocShell,
236 SCTAB nSrc, SCTAB nDest,
237 const String& rN, const String& rC,
238 const Color& rCol, USHORT nF,
239 const ScMarkData& rMark );
240 virtual ~ScUndoMakeScenario();
242 virtual void Undo();
243 virtual void Redo();
244 virtual void Repeat(SfxRepeatTarget& rTarget);
245 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
247 virtual String GetComment() const;
249 private:
250 SCTAB nSrcTab;
251 SCTAB nDestTab;
252 String aName;
253 String aComment;
254 Color aColor;
255 USHORT nFlags;
256 ScMarkData aMarkData;
257 SdrUndoAction* pDrawUndo;
261 class ScUndoImportTab : public ScSimpleUndo
263 public:
264 TYPEINFO();
265 ScUndoImportTab(
266 ScDocShell* pShell,
267 SCTAB nNewTab, SCTAB nNewCount,
268 BOOL bNewLink );
269 virtual ~ScUndoImportTab();
271 virtual void Undo();
272 virtual void Redo();
273 virtual void Repeat(SfxRepeatTarget& rTarget);
274 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
276 virtual String GetComment() const;
278 private:
279 SCTAB nTab;
280 SCTAB nCount;
281 BOOL bLink;
282 ScDocument* pRedoDoc;
283 SdrUndoAction* pDrawUndo;
285 void DoChange() const;
289 class ScUndoRemoveLink : public ScSimpleUndo
291 public:
292 TYPEINFO();
293 ScUndoRemoveLink( // vor dem Loeschen aufrufen!
294 ScDocShell* pShell,
295 const String& rDoc );
296 virtual ~ScUndoRemoveLink();
298 virtual void Undo();
299 virtual void Redo();
300 virtual void Repeat(SfxRepeatTarget& rTarget);
301 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
303 virtual String GetComment() const;
305 private:
306 String aDocName;
307 String aFltName;
308 String aOptions;
309 ULONG nRefreshDelay;
310 USHORT nCount;
311 SCTAB* pTabs;
312 BYTE* pModes;
313 String* pTabNames;
315 void DoChange( BOOL bLink ) const;
319 class ScUndoShowHideTab : public ScSimpleUndo
321 public:
322 TYPEINFO();
323 ScUndoShowHideTab(
324 ScDocShell* pShell,
325 SCTAB nNewTab, BOOL bNewShow );
326 virtual ~ScUndoShowHideTab();
328 virtual void Undo();
329 virtual void Redo();
330 virtual void Repeat(SfxRepeatTarget& rTarget);
331 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
333 virtual String GetComment() const;
335 private:
336 SCTAB nTab;
337 BOOL bShow;
339 void DoChange( BOOL bShow ) const;
342 // ============================================================================
344 /** This class implements undo & redo of document protect & unprotect
345 operations. */
346 class ScUndoDocProtect : public ScSimpleUndo
348 public:
349 ScUndoDocProtect(ScDocShell* pShell, ::std::auto_ptr<ScDocProtection> pProtectSettings);
350 virtual ~ScUndoDocProtect();
352 virtual void Undo();
353 virtual void Redo();
354 virtual void Repeat(SfxRepeatTarget& rTarget);
355 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
357 virtual String GetComment() const;
359 private:
360 ::std::auto_ptr<ScDocProtection> mpProtectSettings;
362 void DoProtect(bool bProtect);
365 // ============================================================================
367 /** This class implements undo & redo of both protect and unprotect of
368 sheet. */
369 class ScUndoTabProtect : public ScSimpleUndo
371 public:
372 ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab,
373 ::std::auto_ptr<ScTableProtection> pProtectSettings);
374 virtual ~ScUndoTabProtect();
376 virtual void Undo();
377 virtual void Redo();
378 virtual void Repeat(SfxRepeatTarget& rTarget);
379 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
381 virtual String GetComment() const;
383 private:
384 SCTAB mnTab;
385 ::std::auto_ptr<ScTableProtection> mpProtectSettings;
387 void DoProtect(bool bProtect);
391 class ScUndoPrintRange : public ScSimpleUndo
393 public:
394 TYPEINFO();
395 ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
396 ScPrintRangeSaver* pOld, ScPrintRangeSaver* pNew );
397 virtual ~ScUndoPrintRange();
399 virtual void Undo();
400 virtual void Redo();
401 virtual void Repeat(SfxRepeatTarget& rTarget);
402 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
404 virtual String GetComment() const;
406 private:
407 SCTAB nTab;
408 ScPrintRangeSaver* pOldRanges;
409 ScPrintRangeSaver* pNewRanges;
411 void DoChange( BOOL bUndo );
415 class ScUndoScenarioFlags: public ScSimpleUndo
417 public:
418 TYPEINFO();
419 ScUndoScenarioFlags(
420 ScDocShell* pNewDocShell, SCTAB nT,
421 const String& rON, const String& rNN,
422 const String& rOC, const String& rNC,
423 const Color& rOCol, const Color& rNCol,
424 USHORT nOF, USHORT nNF );
426 virtual ~ScUndoScenarioFlags();
428 virtual void Undo();
429 virtual void Redo();
430 virtual void Repeat(SfxRepeatTarget& rTarget);
431 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
433 virtual String GetComment() const;
435 private:
436 SCTAB nTab;
437 String aOldName;
438 String aNewName;
439 String aOldComment;
440 String aNewComment;
441 Color aOldColor;
442 Color aNewColor;
443 USHORT nOldFlags;
444 USHORT nNewFlags;
448 class ScUndoRenameObject: public ScSimpleUndo
450 public:
451 TYPEINFO();
452 ScUndoRenameObject(
453 ScDocShell* pNewDocShell, const String& rPN,
454 const String& rON, const String& rNN );
456 virtual ~ScUndoRenameObject();
458 virtual void Undo();
459 virtual void Redo();
460 virtual void Repeat(SfxRepeatTarget& rTarget);
461 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
463 virtual String GetComment() const;
465 private:
466 String aPersistName; // to find object (works only for OLE objects)
467 String aOldName;
468 String aNewName;
470 SdrObject* GetObject();
474 class ScUndoLayoutRTL : public ScSimpleUndo
476 public:
477 TYPEINFO();
478 ScUndoLayoutRTL( ScDocShell* pShell, SCTAB nNewTab, BOOL bNewRTL );
479 virtual ~ScUndoLayoutRTL();
481 virtual void Undo();
482 virtual void Redo();
483 virtual void Repeat(SfxRepeatTarget& rTarget);
484 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
486 virtual String GetComment() const;
488 private:
489 SCTAB nTab;
490 BOOL bRTL;
492 void DoChange( BOOL bNew );
496 //UNUSED2009-05 class ScUndoSetGrammar : public ScSimpleUndo
497 //UNUSED2009-05 {
498 //UNUSED2009-05 public:
499 //UNUSED2009-05 TYPEINFO();
500 //UNUSED2009-05 ScUndoSetGrammar( ScDocShell* pShell,
501 //UNUSED2009-05 formula::FormulaGrammar::Grammar eGrammar );
502 //UNUSED2009-05 virtual ~ScUndoSetGrammar();
503 //UNUSED2009-05
504 //UNUSED2009-05 virtual void Undo();
505 //UNUSED2009-05 virtual void Redo();
506 //UNUSED2009-05 virtual void Repeat(SfxRepeatTarget& rTarget);
507 //UNUSED2009-05 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
508 //UNUSED2009-05
509 //UNUSED2009-05 virtual String GetComment() const;
510 //UNUSED2009-05
511 //UNUSED2009-05 private:
512 //UNUSED2009-05 formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar;
513 //UNUSED2009-05
514 //UNUSED2009-05 void DoChange( formula::FormulaGrammar::Grammar eGrammar );
515 //UNUSED2009-05 };
517 #endif