Update ooo320-m1
[ooovba.git] / sc / source / ui / inc / undotab.hxx
bloba0e954b67de6d9f9c2d40bbfdf8de90816b1bc42
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>
38 #include "tabbgcolor.hxx"
40 #ifndef _SVSTDARR_SHORTS
42 #define _SVSTDARR_SHORTS
43 #include <svtools/svstdarr.hxx>
45 #endif
47 #ifndef _SVSTDARR_STRINGS
49 #define _SVSTDARR_STRINGS
50 #include <svtools/svstdarr.hxx>
52 #endif
54 #include <com/sun/star/uno/Sequence.hxx>
56 #include <memory>
58 class ScDocShell;
59 class ScDocument;
60 class SdrUndoAction;
61 class ScPrintRangeSaver;
62 class SdrObject;
63 class ScDocProtection;
64 class ScTableProtection;
66 //----------------------------------------------------------------------------
68 class ScUndoInsertTab : public ScSimpleUndo
70 public:
71 TYPEINFO();
72 ScUndoInsertTab(
73 ScDocShell* pNewDocShell,
74 SCTAB nTabNum,
75 BOOL bApp,
76 const String& rNewName);
77 virtual ~ScUndoInsertTab();
79 virtual void Undo();
80 virtual void Redo();
81 virtual void Repeat(SfxRepeatTarget& rTarget);
82 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
84 virtual String GetComment() const;
86 private:
87 String sNewName;
88 SdrUndoAction* pDrawUndo;
89 ULONG nEndChangeAction;
90 SCTAB nTab;
91 BOOL bAppend;
93 void SetChangeTrack();
96 class ScUndoInsertTables : public ScSimpleUndo
98 public:
99 TYPEINFO();
100 ScUndoInsertTables(
101 ScDocShell* pNewDocShell,
102 SCTAB nTabNum,
103 BOOL bApp,
104 SvStrings *pNewNameList);
105 virtual ~ScUndoInsertTables();
107 virtual void Undo();
108 virtual void Redo();
109 virtual void Repeat(SfxRepeatTarget& rTarget);
110 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
112 virtual String GetComment() const;
114 private:
116 SdrUndoAction* pDrawUndo;
117 SvStrings* pNameList;
118 ULONG nStartChangeAction;
119 ULONG nEndChangeAction;
120 SCTAB nTab;
121 BOOL bAppend;
123 void SetChangeTrack();
127 class ScUndoDeleteTab: public ScMoveUndo // Draw vom Move fuer geloeschte Tabelle
129 public:
130 TYPEINFO();
131 ScUndoDeleteTab(
132 ScDocShell* pNewDocShell,
133 const SvShorts &theTabs, //SCTAB nNewTab,
134 ScDocument* pUndoDocument,
135 ScRefUndoData* pRefData );
136 virtual ~ScUndoDeleteTab();
138 virtual void Undo();
139 virtual void Redo();
140 virtual void Repeat(SfxRepeatTarget& rTarget);
141 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
143 virtual String GetComment() const;
145 private:
146 SvShorts theTabs;
147 ULONG nStartChangeAction;
148 ULONG nEndChangeAction;
150 void SetChangeTrack();
154 class ScUndoRenameTab: public ScSimpleUndo
156 public:
157 TYPEINFO();
158 ScUndoRenameTab(
159 ScDocShell* pNewDocShell,
160 SCTAB nT,
161 const String& rOldName,
162 const String& rNewName);
163 virtual ~ScUndoRenameTab();
165 virtual void Undo();
166 virtual void Redo();
167 virtual void Repeat(SfxRepeatTarget& rTarget);
168 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
170 virtual String GetComment() const;
172 private:
173 SCTAB nTab;
174 String sOldName;
175 String sNewName;
177 void DoChange( SCTAB nTab, const String& rName ) const;
181 class ScUndoMoveTab: public ScSimpleUndo
183 public:
184 TYPEINFO();
185 ScUndoMoveTab( ScDocShell* pNewDocShell,
186 const SvShorts &aOldTab,
187 const SvShorts &aNewTab);
188 virtual ~ScUndoMoveTab();
190 virtual void Undo();
191 virtual void Redo();
192 virtual void Repeat(SfxRepeatTarget& rTarget);
193 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
195 virtual String GetComment() const;
197 private:
198 SvShorts theOldTabs;
199 SvShorts theNewTabs;
201 void DoChange( BOOL bUndo ) const;
205 class ScUndoCopyTab: public ScSimpleUndo
207 public:
208 TYPEINFO();
209 ScUndoCopyTab(ScDocShell* pNewDocShell,
210 const SvShorts &aOldTab,
211 const SvShorts &aNewTab);
213 virtual ~ScUndoCopyTab();
215 virtual void Undo();
216 virtual void Redo();
217 virtual void Repeat(SfxRepeatTarget& rTarget);
218 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
220 virtual String GetComment() const;
222 private:
223 SdrUndoAction* pDrawUndo;
224 SvShorts theOldTabs;
225 SvShorts theNewTabs;
227 void DoChange() const;
230 class ScUndoSetTabBgColor: public ScSimpleUndo
232 public:
233 TYPEINFO();
234 ScUndoSetTabBgColor(
235 ScDocShell* pNewDocShell,
236 SCTAB nT,
237 const Color& aOTabBgColor,
238 const Color& aNTabBgColor);
239 ScUndoSetTabBgColor(
240 ScDocShell* pNewDocShell,
241 ScUndoSetTabBgColorInfoList* pUndoSetTabBgColorInfoList);
242 virtual ~ScUndoSetTabBgColor();
244 virtual void Undo();
245 virtual void Redo();
246 virtual void Repeat(SfxRepeatTarget& rTarget);
247 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
249 virtual String GetComment() const;
251 private:
252 SCTAB nTab;
253 Color aOldTabBgColor;
254 Color aNewTabBgColor;
255 ScUndoSetTabBgColorInfoList* aUndoSetTabBgColorInfoList;
256 BOOL bIsMultipleUndo;
258 void DoChange( SCTAB nTab, const Color& rTabBgColor ) const;
259 void DoChange( BOOL bUndoType ) const;
262 class ScUndoMakeScenario: public ScSimpleUndo
264 public:
265 TYPEINFO();
266 ScUndoMakeScenario(
267 ScDocShell* pNewDocShell,
268 SCTAB nSrc, SCTAB nDest,
269 const String& rN, const String& rC,
270 const Color& rCol, USHORT nF,
271 const ScMarkData& rMark );
272 virtual ~ScUndoMakeScenario();
274 virtual void Undo();
275 virtual void Redo();
276 virtual void Repeat(SfxRepeatTarget& rTarget);
277 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
279 virtual String GetComment() const;
281 private:
282 SCTAB nSrcTab;
283 SCTAB nDestTab;
284 String aName;
285 String aComment;
286 Color aColor;
287 USHORT nFlags;
288 ScMarkData aMarkData;
289 SdrUndoAction* pDrawUndo;
293 class ScUndoImportTab : public ScSimpleUndo
295 public:
296 TYPEINFO();
297 ScUndoImportTab(
298 ScDocShell* pShell,
299 SCTAB nNewTab, SCTAB nNewCount,
300 BOOL bNewLink );
301 virtual ~ScUndoImportTab();
303 virtual void Undo();
304 virtual void Redo();
305 virtual void Repeat(SfxRepeatTarget& rTarget);
306 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
308 virtual String GetComment() const;
310 private:
311 SCTAB nTab;
312 SCTAB nCount;
313 BOOL bLink;
314 ScDocument* pRedoDoc;
315 SdrUndoAction* pDrawUndo;
317 void DoChange() const;
321 class ScUndoRemoveLink : public ScSimpleUndo
323 public:
324 TYPEINFO();
325 ScUndoRemoveLink( // vor dem Loeschen aufrufen!
326 ScDocShell* pShell,
327 const String& rDoc );
328 virtual ~ScUndoRemoveLink();
330 virtual void Undo();
331 virtual void Redo();
332 virtual void Repeat(SfxRepeatTarget& rTarget);
333 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
335 virtual String GetComment() const;
337 private:
338 String aDocName;
339 String aFltName;
340 String aOptions;
341 ULONG nRefreshDelay;
342 USHORT nCount;
343 SCTAB* pTabs;
344 BYTE* pModes;
345 String* pTabNames;
347 void DoChange( BOOL bLink ) const;
351 class ScUndoShowHideTab : public ScSimpleUndo
353 public:
354 TYPEINFO();
355 ScUndoShowHideTab(
356 ScDocShell* pShell,
357 SCTAB nNewTab, BOOL bNewShow );
358 virtual ~ScUndoShowHideTab();
360 virtual void Undo();
361 virtual void Redo();
362 virtual void Repeat(SfxRepeatTarget& rTarget);
363 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
365 virtual String GetComment() const;
367 private:
368 SCTAB nTab;
369 BOOL bShow;
371 void DoChange( BOOL bShow ) const;
374 // ============================================================================
376 /** This class implements undo & redo of document protect & unprotect
377 operations. */
378 class ScUndoDocProtect : public ScSimpleUndo
380 public:
381 ScUndoDocProtect(ScDocShell* pShell, ::std::auto_ptr<ScDocProtection> pProtectSettings);
382 virtual ~ScUndoDocProtect();
384 virtual void Undo();
385 virtual void Redo();
386 virtual void Repeat(SfxRepeatTarget& rTarget);
387 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
389 virtual String GetComment() const;
391 private:
392 ::std::auto_ptr<ScDocProtection> mpProtectSettings;
394 void DoProtect(bool bProtect);
397 // ============================================================================
399 /** This class implements undo & redo of both protect and unprotect of
400 sheet. */
401 class ScUndoTabProtect : public ScSimpleUndo
403 public:
404 ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab,
405 ::std::auto_ptr<ScTableProtection> pProtectSettings);
406 virtual ~ScUndoTabProtect();
408 virtual void Undo();
409 virtual void Redo();
410 virtual void Repeat(SfxRepeatTarget& rTarget);
411 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
413 virtual String GetComment() const;
415 private:
416 SCTAB mnTab;
417 ::std::auto_ptr<ScTableProtection> mpProtectSettings;
419 void DoProtect(bool bProtect);
423 class ScUndoPrintRange : public ScSimpleUndo
425 public:
426 TYPEINFO();
427 ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
428 ScPrintRangeSaver* pOld, ScPrintRangeSaver* pNew );
429 virtual ~ScUndoPrintRange();
431 virtual void Undo();
432 virtual void Redo();
433 virtual void Repeat(SfxRepeatTarget& rTarget);
434 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
436 virtual String GetComment() const;
438 private:
439 SCTAB nTab;
440 ScPrintRangeSaver* pOldRanges;
441 ScPrintRangeSaver* pNewRanges;
443 void DoChange( BOOL bUndo );
447 class ScUndoScenarioFlags: public ScSimpleUndo
449 public:
450 TYPEINFO();
451 ScUndoScenarioFlags(
452 ScDocShell* pNewDocShell, SCTAB nT,
453 const String& rON, const String& rNN,
454 const String& rOC, const String& rNC,
455 const Color& rOCol, const Color& rNCol,
456 USHORT nOF, USHORT nNF );
458 virtual ~ScUndoScenarioFlags();
460 virtual void Undo();
461 virtual void Redo();
462 virtual void Repeat(SfxRepeatTarget& rTarget);
463 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
465 virtual String GetComment() const;
467 private:
468 SCTAB nTab;
469 String aOldName;
470 String aNewName;
471 String aOldComment;
472 String aNewComment;
473 Color aOldColor;
474 Color aNewColor;
475 USHORT nOldFlags;
476 USHORT nNewFlags;
480 class ScUndoRenameObject: public ScSimpleUndo
482 public:
483 TYPEINFO();
484 ScUndoRenameObject(
485 ScDocShell* pNewDocShell, const String& rPN,
486 const String& rON, const String& rNN );
488 virtual ~ScUndoRenameObject();
490 virtual void Undo();
491 virtual void Redo();
492 virtual void Repeat(SfxRepeatTarget& rTarget);
493 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
495 virtual String GetComment() const;
497 private:
498 String aPersistName; // to find object (works only for OLE objects)
499 String aOldName;
500 String aNewName;
502 SdrObject* GetObject();
506 class ScUndoLayoutRTL : public ScSimpleUndo
508 public:
509 TYPEINFO();
510 ScUndoLayoutRTL( ScDocShell* pShell, SCTAB nNewTab, BOOL bNewRTL );
511 virtual ~ScUndoLayoutRTL();
513 virtual void Undo();
514 virtual void Redo();
515 virtual void Repeat(SfxRepeatTarget& rTarget);
516 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
518 virtual String GetComment() const;
520 private:
521 SCTAB nTab;
522 BOOL bRTL;
524 void DoChange( BOOL bNew );
528 //UNUSED2009-05 class ScUndoSetGrammar : public ScSimpleUndo
529 //UNUSED2009-05 {
530 //UNUSED2009-05 public:
531 //UNUSED2009-05 TYPEINFO();
532 //UNUSED2009-05 ScUndoSetGrammar( ScDocShell* pShell,
533 //UNUSED2009-05 formula::FormulaGrammar::Grammar eGrammar );
534 //UNUSED2009-05 virtual ~ScUndoSetGrammar();
535 //UNUSED2009-05
536 //UNUSED2009-05 virtual void Undo();
537 //UNUSED2009-05 virtual void Redo();
538 //UNUSED2009-05 virtual void Repeat(SfxRepeatTarget& rTarget);
539 //UNUSED2009-05 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
540 //UNUSED2009-05
541 //UNUSED2009-05 virtual String GetComment() const;
542 //UNUSED2009-05
543 //UNUSED2009-05 private:
544 //UNUSED2009-05 formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar;
545 //UNUSED2009-05
546 //UNUSED2009-05 void DoChange( formula::FormulaGrammar::Grammar eGrammar );
547 //UNUSED2009-05 };
549 #endif