1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_UNDOTAB_HXX
21 #define SC_UNDOTAB_HXX
23 #include "undobase.hxx"
24 #include "formula/grammar.hxx"
25 #include <tools/color.hxx>
26 #include "tabbgcolor.hxx"
28 #include <com/sun/star/uno/Sequence.hxx>
30 #include <boost/shared_ptr.hpp>
31 #include <boost/scoped_ptr.hpp>
39 class ScPrintRangeSaver
;
41 class ScDocProtection
;
42 class ScTableProtection
;
45 //----------------------------------------------------------------------------
47 class ScUndoInsertTab
: public ScSimpleUndo
52 ScDocShell
* pNewDocShell
,
55 const OUString
& rNewName
);
56 virtual ~ScUndoInsertTab();
60 virtual void Repeat(SfxRepeatTarget
& rTarget
);
61 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
63 virtual OUString
GetComment() const;
67 SdrUndoAction
* pDrawUndo
;
68 sal_uLong nEndChangeAction
;
72 void SetChangeTrack();
75 class ScUndoInsertTables
: public ScSimpleUndo
80 ScDocShell
* pNewDocShell
,
82 std::vector
<OUString
>& newNameList
);
83 virtual ~ScUndoInsertTables();
87 virtual void Repeat(SfxRepeatTarget
& rTarget
);
88 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
90 virtual OUString
GetComment() const;
94 SdrUndoAction
* pDrawUndo
;
95 std::vector
<OUString
> aNameList
;
96 sal_uLong nStartChangeAction
;
97 sal_uLong nEndChangeAction
;
100 void SetChangeTrack();
104 class ScUndoDeleteTab
: public ScMoveUndo
109 ScDocShell
* pNewDocShell
,
110 const std::vector
<SCTAB
> &theTabs
, //SCTAB nNewTab,
111 ScDocument
* pUndoDocument
,
112 ScRefUndoData
* pRefData
);
113 virtual ~ScUndoDeleteTab();
117 virtual void Repeat(SfxRepeatTarget
& rTarget
);
118 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
120 virtual OUString
GetComment() const;
123 std::vector
<SCTAB
> theTabs
;
124 sal_uLong nStartChangeAction
;
125 sal_uLong nEndChangeAction
;
127 void SetChangeTrack();
131 class ScUndoRenameTab
: public ScSimpleUndo
136 ScDocShell
* pNewDocShell
,
138 const OUString
& rOldName
,
139 const OUString
& rNewName
);
140 virtual ~ScUndoRenameTab();
144 virtual void Repeat(SfxRepeatTarget
& rTarget
);
145 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
147 virtual OUString
GetComment() const;
154 void DoChange( SCTAB nTab
, const OUString
& rName
) const;
158 class ScUndoMoveTab
: public ScSimpleUndo
163 ScDocShell
* pNewDocShell
,
164 ::std::vector
<SCTAB
>* pOldTabs
,
165 ::std::vector
<SCTAB
>* pNewTabs
,
166 ::std::vector
< OUString
>* pOldNames
= NULL
,
167 ::std::vector
< OUString
>* pNewNames
= NULL
);
169 virtual ~ScUndoMoveTab();
173 virtual void Repeat(SfxRepeatTarget
& rTarget
);
174 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
176 virtual OUString
GetComment() const;
179 ::boost::shared_ptr
< ::std::vector
<SCTAB
> > mpOldTabs
;
180 ::boost::shared_ptr
< ::std::vector
<SCTAB
> > mpNewTabs
;
181 ::boost::shared_ptr
< ::std::vector
< OUString
> > mpOldNames
;
182 ::boost::shared_ptr
< ::std::vector
< OUString
> > mpNewNames
;
184 void DoChange( sal_Bool bUndo
) const;
188 class ScUndoCopyTab
: public ScSimpleUndo
193 ScDocShell
* pNewDocShell
,
194 ::std::vector
<SCTAB
>* pOldTabs
,
195 ::std::vector
<SCTAB
>* pNewTabs
,
196 ::std::vector
< OUString
>* pNewNames
= NULL
);
198 virtual ~ScUndoCopyTab();
202 virtual void Repeat(SfxRepeatTarget
& rTarget
);
203 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
205 virtual OUString
GetComment() const;
208 ::boost::shared_ptr
< ::std::vector
<SCTAB
> > mpOldTabs
;
209 ::boost::shared_ptr
< ::std::vector
<SCTAB
> > mpNewTabs
;
210 ::boost::shared_ptr
< ::std::vector
< OUString
> > mpNewNames
;
211 SdrUndoAction
* pDrawUndo
;
213 void DoChange() const;
216 class ScUndoTabColor
: public ScSimpleUndo
221 ScDocShell
* pNewDocShell
,
223 const Color
& aOTabBgColor
,
224 const Color
& aNTabBgColor
);
226 ScDocShell
* pNewDocShell
,
227 const ScUndoTabColorInfo::List
& rUndoTabColorList
);
228 virtual ~ScUndoTabColor();
232 virtual void Repeat(SfxRepeatTarget
& rTarget
);
233 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
235 virtual OUString
GetComment() const;
238 ScUndoTabColorInfo::List aTabColorList
;
240 void DoChange(bool bUndoType
) const;
243 class ScUndoMakeScenario
: public ScSimpleUndo
248 ScDocShell
* pNewDocShell
,
249 SCTAB nSrc
, SCTAB nDest
,
250 const OUString
& rN
, const OUString
& rC
,
251 const Color
& rCol
, sal_uInt16 nF
,
252 const ScMarkData
& rMark
);
253 virtual ~ScUndoMakeScenario();
257 virtual void Repeat(SfxRepeatTarget
& rTarget
);
258 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
260 virtual OUString
GetComment() const;
263 boost::scoped_ptr
<ScMarkData
> mpMarkData
;
270 SdrUndoAction
* pDrawUndo
;
274 class ScUndoImportTab
: public ScSimpleUndo
280 SCTAB nNewTab
, SCTAB nNewCount
);
281 virtual ~ScUndoImportTab();
285 virtual void Repeat(SfxRepeatTarget
& rTarget
);
286 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
288 virtual OUString
GetComment() const;
293 ScDocument
* pRedoDoc
;
294 SdrUndoAction
* pDrawUndo
;
296 void DoChange() const;
300 class ScUndoRemoveLink
: public ScSimpleUndo
304 ScUndoRemoveLink( // Call before delete!
306 const OUString
& rDoc
);
307 virtual ~ScUndoRemoveLink();
311 virtual void Repeat(SfxRepeatTarget
& rTarget
);
312 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
314 virtual OUString
GetComment() const;
320 sal_uLong nRefreshDelay
;
326 void DoChange( sal_Bool bLink
) const;
330 class ScUndoShowHideTab
: public ScSimpleUndo
336 const std::vector
<SCTAB
>& newUndoTabs
,
338 virtual ~ScUndoShowHideTab();
342 virtual void Repeat(SfxRepeatTarget
& rTarget
);
343 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
345 virtual OUString
GetComment() const;
348 std::vector
<SCTAB
> undoTabs
;
351 void DoChange( sal_Bool bShow
) const;
354 // ============================================================================
356 /** This class implements undo & redo of document protect & unprotect
358 class ScUndoDocProtect
: public ScSimpleUndo
361 SAL_WNODEPRECATED_DECLARATIONS_PUSH
362 ScUndoDocProtect(ScDocShell
* pShell
, ::std::auto_ptr
<ScDocProtection
> pProtectSettings
);
363 SAL_WNODEPRECATED_DECLARATIONS_POP
364 virtual ~ScUndoDocProtect();
368 virtual void Repeat(SfxRepeatTarget
& rTarget
);
369 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
371 virtual OUString
GetComment() const;
374 SAL_WNODEPRECATED_DECLARATIONS_PUSH
375 ::std::auto_ptr
<ScDocProtection
> mpProtectSettings
;
376 SAL_WNODEPRECATED_DECLARATIONS_POP
378 void DoProtect(bool bProtect
);
381 // ============================================================================
383 /** This class implements undo & redo of both protect and unprotect of
385 class ScUndoTabProtect
: public ScSimpleUndo
388 SAL_WNODEPRECATED_DECLARATIONS_PUSH
389 ScUndoTabProtect(ScDocShell
* pShell
, SCTAB nTab
,
390 ::std::auto_ptr
<ScTableProtection
> pProtectSettings
);
391 SAL_WNODEPRECATED_DECLARATIONS_POP
392 virtual ~ScUndoTabProtect();
396 virtual void Repeat(SfxRepeatTarget
& rTarget
);
397 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
399 virtual OUString
GetComment() const;
403 SAL_WNODEPRECATED_DECLARATIONS_PUSH
404 ::std::auto_ptr
<ScTableProtection
> mpProtectSettings
;
405 SAL_WNODEPRECATED_DECLARATIONS_POP
407 void DoProtect(bool bProtect
);
411 class ScUndoPrintRange
: public ScSimpleUndo
415 ScUndoPrintRange( ScDocShell
* pShell
, SCTAB nNewTab
,
416 ScPrintRangeSaver
* pOld
, ScPrintRangeSaver
* pNew
);
417 virtual ~ScUndoPrintRange();
421 virtual void Repeat(SfxRepeatTarget
& rTarget
);
422 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
424 virtual OUString
GetComment() const;
428 ScPrintRangeSaver
* pOldRanges
;
429 ScPrintRangeSaver
* pNewRanges
;
431 void DoChange( sal_Bool bUndo
);
435 class ScUndoScenarioFlags
: public ScSimpleUndo
440 ScDocShell
* pNewDocShell
, SCTAB nT
,
441 const OUString
& rON
, const OUString
& rNN
,
442 const OUString
& rOC
, const OUString
& rNC
,
443 const Color
& rOCol
, const Color
& rNCol
,
444 sal_uInt16 nOF
, sal_uInt16 nNF
);
446 virtual ~ScUndoScenarioFlags();
450 virtual void Repeat(SfxRepeatTarget
& rTarget
);
451 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
453 virtual OUString
GetComment() const;
459 OUString aOldComment
;
460 OUString aNewComment
;
463 sal_uInt16 nOldFlags
;
464 sal_uInt16 nNewFlags
;
468 class ScUndoRenameObject
: public ScSimpleUndo
473 ScDocShell
* pNewDocShell
, const OUString
& rPN
,
474 const OUString
& rON
, const OUString
& rNN
);
476 virtual ~ScUndoRenameObject();
480 virtual void Repeat(SfxRepeatTarget
& rTarget
);
481 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
483 virtual OUString
GetComment() const;
486 OUString aPersistName
; // to find object (works only for OLE objects)
490 SdrObject
* GetObject();
494 class ScUndoLayoutRTL
: public ScSimpleUndo
498 ScUndoLayoutRTL( ScDocShell
* pShell
, SCTAB nNewTab
, sal_Bool bNewRTL
);
499 virtual ~ScUndoLayoutRTL();
503 virtual void Repeat(SfxRepeatTarget
& rTarget
);
504 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const;
506 virtual OUString
GetComment() const;
512 void DoChange( sal_Bool bNew
);
517 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */