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>
39 #ifndef _SVSTDARR_SHORTS
41 #define _SVSTDARR_SHORTS
42 #include <svtools/svstdarr.hxx>
46 #ifndef _SVSTDARR_STRINGS
48 #define _SVSTDARR_STRINGS
49 #include <svtools/svstdarr.hxx>
53 #include <com/sun/star/uno/Sequence.hxx>
60 class ScPrintRangeSaver
;
62 class ScDocProtection
;
63 class ScTableProtection
;
65 //----------------------------------------------------------------------------
67 class ScUndoInsertTab
: public ScSimpleUndo
72 ScDocShell
* pNewDocShell
,
75 const String
& rNewName
);
76 virtual ~ScUndoInsertTab();
80 virtual void Repeat(SfxRepeatTarget
& rTarget
);
81 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
83 virtual String
GetComment() const;
87 SdrUndoAction
* pDrawUndo
;
88 ULONG nEndChangeAction
;
92 void SetChangeTrack();
95 class ScUndoInsertTables
: public ScSimpleUndo
100 ScDocShell
* pNewDocShell
,
103 SvStrings
*pNewNameList
);
104 virtual ~ScUndoInsertTables();
108 virtual void Repeat(SfxRepeatTarget
& rTarget
);
109 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
111 virtual String
GetComment() const;
115 SdrUndoAction
* pDrawUndo
;
116 SvStrings
* pNameList
;
117 ULONG nStartChangeAction
;
118 ULONG nEndChangeAction
;
122 void SetChangeTrack();
126 class ScUndoDeleteTab
: public ScMoveUndo
// Draw vom Move fuer geloeschte Tabelle
131 ScDocShell
* pNewDocShell
,
132 const SvShorts
&theTabs
, //SCTAB nNewTab,
133 ScDocument
* pUndoDocument
,
134 ScRefUndoData
* pRefData
);
135 virtual ~ScUndoDeleteTab();
139 virtual void Repeat(SfxRepeatTarget
& rTarget
);
140 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
142 virtual String
GetComment() const;
146 ULONG nStartChangeAction
;
147 ULONG nEndChangeAction
;
149 void SetChangeTrack();
153 class ScUndoRenameTab
: public ScSimpleUndo
158 ScDocShell
* pNewDocShell
,
160 const String
& rOldName
,
161 const String
& rNewName
);
162 virtual ~ScUndoRenameTab();
166 virtual void Repeat(SfxRepeatTarget
& rTarget
);
167 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
169 virtual String
GetComment() const;
176 void DoChange( SCTAB nTab
, const String
& rName
) const;
180 class ScUndoMoveTab
: public ScSimpleUndo
184 ScUndoMoveTab( ScDocShell
* pNewDocShell
,
185 const SvShorts
&aOldTab
,
186 const SvShorts
&aNewTab
);
187 virtual ~ScUndoMoveTab();
191 virtual void Repeat(SfxRepeatTarget
& rTarget
);
192 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
194 virtual String
GetComment() const;
200 void DoChange( BOOL bUndo
) const;
204 class ScUndoCopyTab
: public ScSimpleUndo
208 ScUndoCopyTab(ScDocShell
* pNewDocShell
,
209 const SvShorts
&aOldTab
,
210 const SvShorts
&aNewTab
);
212 virtual ~ScUndoCopyTab();
216 virtual void Repeat(SfxRepeatTarget
& rTarget
);
217 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
219 virtual String
GetComment() const;
222 SdrUndoAction
* pDrawUndo
;
226 void DoChange() const;
230 class ScUndoMakeScenario
: public ScSimpleUndo
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();
244 virtual void Repeat(SfxRepeatTarget
& rTarget
);
245 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
247 virtual String
GetComment() const;
256 ScMarkData aMarkData
;
257 SdrUndoAction
* pDrawUndo
;
261 class ScUndoImportTab
: public ScSimpleUndo
267 SCTAB nNewTab
, SCTAB nNewCount
,
269 virtual ~ScUndoImportTab();
273 virtual void Repeat(SfxRepeatTarget
& rTarget
);
274 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
276 virtual String
GetComment() const;
282 ScDocument
* pRedoDoc
;
283 SdrUndoAction
* pDrawUndo
;
285 void DoChange() const;
289 class ScUndoRemoveLink
: public ScSimpleUndo
293 ScUndoRemoveLink( // vor dem Loeschen aufrufen!
295 const String
& rDoc
);
296 virtual ~ScUndoRemoveLink();
300 virtual void Repeat(SfxRepeatTarget
& rTarget
);
301 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
303 virtual String
GetComment() const;
315 void DoChange( BOOL bLink
) const;
319 class ScUndoShowHideTab
: public ScSimpleUndo
325 SCTAB nNewTab
, BOOL bNewShow
);
326 virtual ~ScUndoShowHideTab();
330 virtual void Repeat(SfxRepeatTarget
& rTarget
);
331 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
333 virtual String
GetComment() const;
339 void DoChange( BOOL bShow
) const;
342 // ============================================================================
344 /** This class implements undo & redo of document protect & unprotect
346 class ScUndoDocProtect
: public ScSimpleUndo
349 ScUndoDocProtect(ScDocShell
* pShell
, ::std::auto_ptr
<ScDocProtection
> pProtectSettings
);
350 virtual ~ScUndoDocProtect();
354 virtual void Repeat(SfxRepeatTarget
& rTarget
);
355 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
357 virtual String
GetComment() const;
360 ::std::auto_ptr
<ScDocProtection
> mpProtectSettings
;
362 void DoProtect(bool bProtect
);
365 // ============================================================================
367 /** This class implements undo & redo of both protect and unprotect of
369 class ScUndoTabProtect
: public ScSimpleUndo
372 ScUndoTabProtect(ScDocShell
* pShell
, SCTAB nTab
,
373 ::std::auto_ptr
<ScTableProtection
> pProtectSettings
);
374 virtual ~ScUndoTabProtect();
378 virtual void Repeat(SfxRepeatTarget
& rTarget
);
379 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
381 virtual String
GetComment() const;
385 ::std::auto_ptr
<ScTableProtection
> mpProtectSettings
;
387 void DoProtect(bool bProtect
);
391 class ScUndoPrintRange
: public ScSimpleUndo
395 ScUndoPrintRange( ScDocShell
* pShell
, SCTAB nNewTab
,
396 ScPrintRangeSaver
* pOld
, ScPrintRangeSaver
* pNew
);
397 virtual ~ScUndoPrintRange();
401 virtual void Repeat(SfxRepeatTarget
& rTarget
);
402 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
404 virtual String
GetComment() const;
408 ScPrintRangeSaver
* pOldRanges
;
409 ScPrintRangeSaver
* pNewRanges
;
411 void DoChange( BOOL bUndo
);
415 class ScUndoScenarioFlags
: public ScSimpleUndo
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();
430 virtual void Repeat(SfxRepeatTarget
& rTarget
);
431 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
433 virtual String
GetComment() const;
448 class ScUndoRenameObject
: public ScSimpleUndo
453 ScDocShell
* pNewDocShell
, const String
& rPN
,
454 const String
& rON
, const String
& rNN
);
456 virtual ~ScUndoRenameObject();
460 virtual void Repeat(SfxRepeatTarget
& rTarget
);
461 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
463 virtual String
GetComment() const;
466 String aPersistName
; // to find object (works only for OLE objects)
470 SdrObject
* GetObject();
474 class ScUndoLayoutRTL
: public ScSimpleUndo
478 ScUndoLayoutRTL( ScDocShell
* pShell
, SCTAB nNewTab
, BOOL bNewRTL
);
479 virtual ~ScUndoLayoutRTL();
483 virtual void Repeat(SfxRepeatTarget
& rTarget
);
484 virtual BOOL
CanRepeat(SfxRepeatTarget
& rTarget
) const;
486 virtual String
GetComment() const;
492 void DoChange( BOOL bNew
);
496 //UNUSED2009-05 class ScUndoSetGrammar : public ScSimpleUndo
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();
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;
509 //UNUSED2009-05 virtual String GetComment() const;
511 //UNUSED2009-05 private:
512 //UNUSED2009-05 formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar;
514 //UNUSED2009-05 void DoChange( formula::FormulaGrammar::Grammar eGrammar );