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: 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>
47 #ifndef _SVSTDARR_STRINGS
49 #define _SVSTDARR_STRINGS
50 #include <svtools/svstdarr.hxx>
54 #include <com/sun/star/uno/Sequence.hxx>
61 class ScPrintRangeSaver
;
63 class ScDocProtection
;
64 class ScTableProtection
;
66 //----------------------------------------------------------------------------
68 class ScUndoInsertTab
: public ScSimpleUndo
73 ScDocShell
* pNewDocShell
,
76 const String
& rNewName
);
77 virtual ~ScUndoInsertTab();
81 virtual void Repeat(SfxRepeatTarget
& rTarget
);
82 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
84 virtual String
GetComment() const;
88 SdrUndoAction
* pDrawUndo
;
89 ULONG nEndChangeAction
;
93 void SetChangeTrack();
96 class ScUndoInsertTables
: public ScSimpleUndo
101 ScDocShell
* pNewDocShell
,
104 SvStrings
*pNewNameList
);
105 virtual ~ScUndoInsertTables();
109 virtual void Repeat(SfxRepeatTarget
& rTarget
);
110 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
112 virtual String
GetComment() const;
116 SdrUndoAction
* pDrawUndo
;
117 SvStrings
* pNameList
;
118 ULONG nStartChangeAction
;
119 ULONG nEndChangeAction
;
123 void SetChangeTrack();
127 class ScUndoDeleteTab
: public ScMoveUndo
// Draw vom Move fuer geloeschte Tabelle
132 ScDocShell
* pNewDocShell
,
133 const SvShorts
&theTabs
, //SCTAB nNewTab,
134 ScDocument
* pUndoDocument
,
135 ScRefUndoData
* pRefData
);
136 virtual ~ScUndoDeleteTab();
140 virtual void Repeat(SfxRepeatTarget
& rTarget
);
141 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
143 virtual String
GetComment() const;
147 ULONG nStartChangeAction
;
148 ULONG nEndChangeAction
;
150 void SetChangeTrack();
154 class ScUndoRenameTab
: public ScSimpleUndo
159 ScDocShell
* pNewDocShell
,
161 const String
& rOldName
,
162 const String
& rNewName
);
163 virtual ~ScUndoRenameTab();
167 virtual void Repeat(SfxRepeatTarget
& rTarget
);
168 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
170 virtual String
GetComment() const;
177 void DoChange( SCTAB nTab
, const String
& rName
) const;
181 class ScUndoMoveTab
: public ScSimpleUndo
185 ScUndoMoveTab( ScDocShell
* pNewDocShell
,
186 const SvShorts
&aOldTab
,
187 const SvShorts
&aNewTab
);
188 virtual ~ScUndoMoveTab();
192 virtual void Repeat(SfxRepeatTarget
& rTarget
);
193 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
195 virtual String
GetComment() const;
201 void DoChange( BOOL bUndo
) const;
205 class ScUndoCopyTab
: public ScSimpleUndo
209 ScUndoCopyTab(ScDocShell
* pNewDocShell
,
210 const SvShorts
&aOldTab
,
211 const SvShorts
&aNewTab
);
213 virtual ~ScUndoCopyTab();
217 virtual void Repeat(SfxRepeatTarget
& rTarget
);
218 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
220 virtual String
GetComment() const;
223 SdrUndoAction
* pDrawUndo
;
227 void DoChange() const;
230 class ScUndoSetTabBgColor
: public ScSimpleUndo
235 ScDocShell
* pNewDocShell
,
237 const Color
& aOTabBgColor
,
238 const Color
& aNTabBgColor
);
240 ScDocShell
* pNewDocShell
,
241 ScUndoSetTabBgColorInfoList
* pUndoSetTabBgColorInfoList
);
242 virtual ~ScUndoSetTabBgColor();
246 virtual void Repeat(SfxRepeatTarget
& rTarget
);
247 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
249 virtual String
GetComment() const;
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
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();
276 virtual void Repeat(SfxRepeatTarget
& rTarget
);
277 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
279 virtual String
GetComment() const;
288 ScMarkData aMarkData
;
289 SdrUndoAction
* pDrawUndo
;
293 class ScUndoImportTab
: public ScSimpleUndo
299 SCTAB nNewTab
, SCTAB nNewCount
,
301 virtual ~ScUndoImportTab();
305 virtual void Repeat(SfxRepeatTarget
& rTarget
);
306 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
308 virtual String
GetComment() const;
314 ScDocument
* pRedoDoc
;
315 SdrUndoAction
* pDrawUndo
;
317 void DoChange() const;
321 class ScUndoRemoveLink
: public ScSimpleUndo
325 ScUndoRemoveLink( // vor dem Loeschen aufrufen!
327 const String
& rDoc
);
328 virtual ~ScUndoRemoveLink();
332 virtual void Repeat(SfxRepeatTarget
& rTarget
);
333 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
335 virtual String
GetComment() const;
347 void DoChange( BOOL bLink
) const;
351 class ScUndoShowHideTab
: public ScSimpleUndo
357 SCTAB nNewTab
, BOOL bNewShow
);
358 virtual ~ScUndoShowHideTab();
362 virtual void Repeat(SfxRepeatTarget
& rTarget
);
363 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
365 virtual String
GetComment() const;
371 void DoChange( BOOL bShow
) const;
374 // ============================================================================
376 /** This class implements undo & redo of document protect & unprotect
378 class ScUndoDocProtect
: public ScSimpleUndo
381 ScUndoDocProtect(ScDocShell
* pShell
, ::std::auto_ptr
<ScDocProtection
> pProtectSettings
);
382 virtual ~ScUndoDocProtect();
386 virtual void Repeat(SfxRepeatTarget
& rTarget
);
387 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
389 virtual String
GetComment() const;
392 ::std::auto_ptr
<ScDocProtection
> mpProtectSettings
;
394 void DoProtect(bool bProtect
);
397 // ============================================================================
399 /** This class implements undo & redo of both protect and unprotect of
401 class ScUndoTabProtect
: public ScSimpleUndo
404 ScUndoTabProtect(ScDocShell
* pShell
, SCTAB nTab
,
405 ::std::auto_ptr
<ScTableProtection
> pProtectSettings
);
406 virtual ~ScUndoTabProtect();
410 virtual void Repeat(SfxRepeatTarget
& rTarget
);
411 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
413 virtual String
GetComment() const;
417 ::std::auto_ptr
<ScTableProtection
> mpProtectSettings
;
419 void DoProtect(bool bProtect
);
423 class ScUndoPrintRange
: public ScSimpleUndo
427 ScUndoPrintRange( ScDocShell
* pShell
, SCTAB nNewTab
,
428 ScPrintRangeSaver
* pOld
, ScPrintRangeSaver
* pNew
);
429 virtual ~ScUndoPrintRange();
433 virtual void Repeat(SfxRepeatTarget
& rTarget
);
434 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
436 virtual String
GetComment() const;
440 ScPrintRangeSaver
* pOldRanges
;
441 ScPrintRangeSaver
* pNewRanges
;
443 void DoChange( BOOL bUndo
);
447 class ScUndoScenarioFlags
: public ScSimpleUndo
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();
462 virtual void Repeat(SfxRepeatTarget
& rTarget
);
463 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
465 virtual String
GetComment() const;
480 class ScUndoRenameObject
: public ScSimpleUndo
485 ScDocShell
* pNewDocShell
, const String
& rPN
,
486 const String
& rON
, const String
& rNN
);
488 virtual ~ScUndoRenameObject();
492 virtual void Repeat(SfxRepeatTarget
& rTarget
);
493 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
495 virtual String
GetComment() const;
498 String aPersistName
; // to find object (works only for OLE objects)
502 SdrObject
* GetObject();
506 class ScUndoLayoutRTL
: public ScSimpleUndo
510 ScUndoLayoutRTL( ScDocShell
* pShell
, SCTAB nNewTab
, BOOL bNewRTL
);
511 virtual ~ScUndoLayoutRTL();
515 virtual void Repeat(SfxRepeatTarget
& rTarget
);
516 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
518 virtual String
GetComment() const;
524 void DoChange( BOOL bNew
);
528 //UNUSED2009-05 class ScUndoSetGrammar : public ScSimpleUndo
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();
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;
541 //UNUSED2009-05 virtual String GetComment() const;
543 //UNUSED2009-05 private:
544 //UNUSED2009-05 formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar;
546 //UNUSED2009-05 void DoChange( formula::FormulaGrammar::Grammar eGrammar );