fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / inc / undotab.hxx
blobfe43d95b16e3b12d703d1f495e68a6cb5c775678
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SC_SOURCE_UI_INC_UNDOTAB_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_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>
33 #include <memory>
34 #include <vector>
36 class ScDocShell;
37 class ScDocument;
38 class SdrUndoAction;
39 class ScPrintRangeSaver;
40 class SdrObject;
41 class ScDocProtection;
42 class ScTableProtection;
43 class ScMarkData;
45 class ScUndoInsertTab : public ScSimpleUndo
47 public:
48 TYPEINFO_OVERRIDE();
49 ScUndoInsertTab(
50 ScDocShell* pNewDocShell,
51 SCTAB nTabNum,
52 bool bApp,
53 const OUString& rNewName);
54 virtual ~ScUndoInsertTab();
56 virtual void Undo() SAL_OVERRIDE;
57 virtual void Redo() SAL_OVERRIDE;
58 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
59 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
61 virtual OUString GetComment() const SAL_OVERRIDE;
63 private:
64 OUString sNewName;
65 SdrUndoAction* pDrawUndo;
66 sal_uLong nEndChangeAction;
67 SCTAB nTab;
68 bool bAppend;
70 void SetChangeTrack();
73 class ScUndoInsertTables : public ScSimpleUndo
75 public:
76 TYPEINFO_OVERRIDE();
77 ScUndoInsertTables(
78 ScDocShell* pNewDocShell,
79 SCTAB nTabNum,
80 std::vector<OUString>& newNameList);
81 virtual ~ScUndoInsertTables();
83 virtual void Undo() SAL_OVERRIDE;
84 virtual void Redo() SAL_OVERRIDE;
85 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
86 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
88 virtual OUString GetComment() const SAL_OVERRIDE;
90 private:
92 SdrUndoAction* pDrawUndo;
93 std::vector<OUString> aNameList;
94 sal_uLong nStartChangeAction;
95 sal_uLong nEndChangeAction;
96 SCTAB nTab;
98 void SetChangeTrack();
101 class ScUndoDeleteTab: public ScMoveUndo
103 public:
104 TYPEINFO_OVERRIDE();
105 ScUndoDeleteTab(
106 ScDocShell* pNewDocShell,
107 const std::vector<SCTAB> &theTabs, //SCTAB nNewTab,
108 ScDocument* pUndoDocument,
109 ScRefUndoData* pRefData );
110 virtual ~ScUndoDeleteTab();
112 virtual void Undo() SAL_OVERRIDE;
113 virtual void Redo() SAL_OVERRIDE;
114 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
115 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
117 virtual OUString GetComment() const SAL_OVERRIDE;
119 private:
120 std::vector<SCTAB> theTabs;
121 sal_uLong nStartChangeAction;
122 sal_uLong nEndChangeAction;
124 void SetChangeTrack();
127 class ScUndoRenameTab: public ScSimpleUndo
129 public:
130 TYPEINFO_OVERRIDE();
131 ScUndoRenameTab(
132 ScDocShell* pNewDocShell,
133 SCTAB nT,
134 const OUString& rOldName,
135 const OUString& rNewName);
136 virtual ~ScUndoRenameTab();
138 virtual void Undo() SAL_OVERRIDE;
139 virtual void Redo() SAL_OVERRIDE;
140 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
141 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
143 virtual OUString GetComment() const SAL_OVERRIDE;
145 private:
146 SCTAB nTab;
147 OUString sOldName;
148 OUString sNewName;
150 void DoChange( SCTAB nTab, const OUString& rName ) const;
153 class ScUndoMoveTab: public ScSimpleUndo
155 public:
156 TYPEINFO_OVERRIDE();
157 ScUndoMoveTab(
158 ScDocShell* pNewDocShell,
159 ::std::vector<SCTAB>* pOldTabs,
160 ::std::vector<SCTAB>* pNewTabs,
161 ::std::vector< OUString>* pOldNames = NULL,
162 ::std::vector< OUString>* pNewNames = NULL );
164 virtual ~ScUndoMoveTab();
166 virtual void Undo() SAL_OVERRIDE;
167 virtual void Redo() SAL_OVERRIDE;
168 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
169 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
171 virtual OUString GetComment() const SAL_OVERRIDE;
173 private:
174 ::boost::shared_ptr< ::std::vector<SCTAB> > mpOldTabs;
175 ::boost::shared_ptr< ::std::vector<SCTAB> > mpNewTabs;
176 ::boost::shared_ptr< ::std::vector< OUString> > mpOldNames;
177 ::boost::shared_ptr< ::std::vector< OUString> > mpNewNames;
179 void DoChange( bool bUndo ) const;
182 class ScUndoCopyTab: public ScSimpleUndo
184 public:
185 TYPEINFO_OVERRIDE();
186 ScUndoCopyTab(
187 ScDocShell* pNewDocShell,
188 ::std::vector<SCTAB>* pOldTabs,
189 ::std::vector<SCTAB>* pNewTabs,
190 ::std::vector< OUString>* pNewNames = NULL );
192 virtual ~ScUndoCopyTab();
194 virtual void Undo() SAL_OVERRIDE;
195 virtual void Redo() SAL_OVERRIDE;
196 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
197 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
199 virtual OUString GetComment() const SAL_OVERRIDE;
201 private:
202 ::boost::shared_ptr< ::std::vector<SCTAB> > mpOldTabs;
203 ::boost::shared_ptr< ::std::vector<SCTAB> > mpNewTabs;
204 ::boost::shared_ptr< ::std::vector< OUString> > mpNewNames;
205 SdrUndoAction* pDrawUndo;
207 void DoChange() const;
210 class ScUndoTabColor: public ScSimpleUndo
212 public:
213 TYPEINFO_OVERRIDE();
214 ScUndoTabColor(
215 ScDocShell* pNewDocShell,
216 SCTAB nT,
217 const Color& aOTabBgColor,
218 const Color& aNTabBgColor);
219 ScUndoTabColor(
220 ScDocShell* pNewDocShell,
221 const ScUndoTabColorInfo::List& rUndoTabColorList);
222 virtual ~ScUndoTabColor();
224 virtual void Undo() SAL_OVERRIDE;
225 virtual void Redo() SAL_OVERRIDE;
226 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
227 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
229 virtual OUString GetComment() const SAL_OVERRIDE;
231 private:
232 ScUndoTabColorInfo::List aTabColorList;
234 void DoChange(bool bUndoType) const;
237 class ScUndoMakeScenario: public ScSimpleUndo
239 public:
240 TYPEINFO_OVERRIDE();
241 ScUndoMakeScenario(
242 ScDocShell* pNewDocShell,
243 SCTAB nSrc, SCTAB nDest,
244 const OUString& rN, const OUString& rC,
245 const Color& rCol, sal_uInt16 nF,
246 const ScMarkData& rMark );
247 virtual ~ScUndoMakeScenario();
249 virtual void Undo() SAL_OVERRIDE;
250 virtual void Redo() SAL_OVERRIDE;
251 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
252 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
254 virtual OUString GetComment() const SAL_OVERRIDE;
256 private:
257 boost::scoped_ptr<ScMarkData> mpMarkData;
258 SCTAB nSrcTab;
259 SCTAB nDestTab;
260 OUString aName;
261 OUString aComment;
262 Color aColor;
263 sal_uInt16 nFlags;
264 SdrUndoAction* pDrawUndo;
267 class ScUndoImportTab : public ScSimpleUndo
269 public:
270 TYPEINFO_OVERRIDE();
271 ScUndoImportTab(
272 ScDocShell* pShell,
273 SCTAB nNewTab, SCTAB nNewCount );
274 virtual ~ScUndoImportTab();
276 virtual void Undo() SAL_OVERRIDE;
277 virtual void Redo() SAL_OVERRIDE;
278 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
279 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
281 virtual OUString GetComment() const SAL_OVERRIDE;
283 private:
284 SCTAB nTab;
285 SCTAB nCount;
286 ScDocument* pRedoDoc;
287 SdrUndoAction* pDrawUndo;
289 void DoChange() const;
292 class ScUndoRemoveLink : public ScSimpleUndo
294 public:
295 TYPEINFO_OVERRIDE();
296 ScUndoRemoveLink( // Call before delete!
297 ScDocShell* pShell,
298 const OUString& rDoc );
299 virtual ~ScUndoRemoveLink();
301 virtual void Undo() SAL_OVERRIDE;
302 virtual void Redo() SAL_OVERRIDE;
303 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
304 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
306 virtual OUString GetComment() const SAL_OVERRIDE;
308 private:
309 OUString aDocName;
310 OUString aFltName;
311 OUString aOptions;
312 sal_uLong nRefreshDelay;
313 sal_uInt16 nCount;
314 SCTAB* pTabs;
315 sal_uInt8* pModes;
316 OUString* pTabNames;
318 void DoChange( bool bLink ) const;
321 class ScUndoShowHideTab : public ScSimpleUndo
323 public:
324 TYPEINFO_OVERRIDE();
325 ScUndoShowHideTab(
326 ScDocShell* pShell,
327 const std::vector<SCTAB>& newUndoTabs,
328 bool bNewShow );
329 virtual ~ScUndoShowHideTab();
331 virtual void Undo() SAL_OVERRIDE;
332 virtual void Redo() SAL_OVERRIDE;
333 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
334 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
336 virtual OUString GetComment() const SAL_OVERRIDE;
338 private:
339 std::vector<SCTAB> undoTabs;
340 bool bShow;
342 void DoChange( bool bShow ) const;
345 /** This class implements undo & redo of document protect & unprotect
346 operations. */
347 class ScUndoDocProtect : public ScSimpleUndo
349 public:
350 ScUndoDocProtect(ScDocShell* pShell, ::std::unique_ptr<ScDocProtection> && pProtectSettings);
351 virtual ~ScUndoDocProtect();
353 virtual void Undo() SAL_OVERRIDE;
354 virtual void Redo() SAL_OVERRIDE;
355 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
356 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
358 virtual OUString GetComment() const SAL_OVERRIDE;
360 private:
361 ::std::unique_ptr<ScDocProtection> mpProtectSettings;
363 void DoProtect(bool bProtect);
366 /** This class implements undo & redo of both protect and unprotect of
367 sheet. */
368 class ScUndoTabProtect : public ScSimpleUndo
370 public:
371 ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab,
372 std::unique_ptr<ScTableProtection> && pProtectSettings);
373 virtual ~ScUndoTabProtect();
375 virtual void Undo() SAL_OVERRIDE;
376 virtual void Redo() SAL_OVERRIDE;
377 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
378 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
380 virtual OUString GetComment() const SAL_OVERRIDE;
382 private:
383 SCTAB mnTab;
384 ::std::unique_ptr<ScTableProtection> mpProtectSettings;
386 void DoProtect(bool bProtect);
389 class ScUndoPrintRange : public ScSimpleUndo
391 public:
392 TYPEINFO_OVERRIDE();
393 ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
394 ScPrintRangeSaver* pOld, ScPrintRangeSaver* pNew );
395 virtual ~ScUndoPrintRange();
397 virtual void Undo() SAL_OVERRIDE;
398 virtual void Redo() SAL_OVERRIDE;
399 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
400 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
402 virtual OUString GetComment() const SAL_OVERRIDE;
404 private:
405 SCTAB nTab;
406 ScPrintRangeSaver* pOldRanges;
407 ScPrintRangeSaver* pNewRanges;
409 void DoChange( bool bUndo );
412 class ScUndoScenarioFlags: public ScSimpleUndo
414 public:
415 TYPEINFO_OVERRIDE();
416 ScUndoScenarioFlags(
417 ScDocShell* pNewDocShell, SCTAB nT,
418 const OUString& rON, const OUString& rNN,
419 const OUString& rOC, const OUString& rNC,
420 const Color& rOCol, const Color& rNCol,
421 sal_uInt16 nOF, sal_uInt16 nNF );
423 virtual ~ScUndoScenarioFlags();
425 virtual void Undo() SAL_OVERRIDE;
426 virtual void Redo() SAL_OVERRIDE;
427 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
428 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
430 virtual OUString GetComment() const SAL_OVERRIDE;
432 private:
433 SCTAB nTab;
434 OUString aOldName;
435 OUString aNewName;
436 OUString aOldComment;
437 OUString aNewComment;
438 Color aOldColor;
439 Color aNewColor;
440 sal_uInt16 nOldFlags;
441 sal_uInt16 nNewFlags;
444 class ScUndoRenameObject: public ScSimpleUndo
446 public:
447 TYPEINFO_OVERRIDE();
448 ScUndoRenameObject(
449 ScDocShell* pNewDocShell, const OUString& rPN,
450 const OUString& rON, const OUString& rNN );
452 virtual ~ScUndoRenameObject();
454 virtual void Undo() SAL_OVERRIDE;
455 virtual void Redo() SAL_OVERRIDE;
456 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
457 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
459 virtual OUString GetComment() const SAL_OVERRIDE;
461 private:
462 OUString aPersistName; // to find object (works only for OLE objects)
463 OUString aOldName;
464 OUString aNewName;
466 SdrObject* GetObject();
469 class ScUndoLayoutRTL : public ScSimpleUndo
471 public:
472 TYPEINFO_OVERRIDE();
473 ScUndoLayoutRTL( ScDocShell* pShell, SCTAB nNewTab, bool bNewRTL );
474 virtual ~ScUndoLayoutRTL();
476 virtual void Undo() SAL_OVERRIDE;
477 virtual void Redo() SAL_OVERRIDE;
478 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
479 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
481 virtual OUString GetComment() const SAL_OVERRIDE;
483 private:
484 SCTAB nTab;
485 bool bRTL;
487 void DoChange( bool bNew );
490 #endif
492 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */