fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / inc / undocell.hxx
blobedce6bc1f22bd683d829b1bd3f7b52a4ed17f37c
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_UNDOCELL_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_UNDOCELL_HXX
23 #include "undobase.hxx"
24 #include "postit.hxx"
25 #include "cellvalue.hxx"
26 #include <cellvalues.hxx>
28 #include <boost/shared_ptr.hpp>
29 #include <boost/scoped_ptr.hpp>
31 class ScDocShell;
32 class ScPatternAttr;
33 class EditTextObject;
34 class SdrUndoAction;
35 class ScDetOpList;
36 class ScDetOpData;
37 class ScRangeName;
38 class ScDocument;
40 namespace sc {
42 class CellValues;
46 class ScUndoCursorAttr: public ScSimpleUndo
48 public:
49 TYPEINFO_OVERRIDE();
50 ScUndoCursorAttr( ScDocShell* pNewDocShell,
51 SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
52 const ScPatternAttr* pOldPat, const ScPatternAttr* pNewPat,
53 const ScPatternAttr* pApplyPat, bool bAutomatic );
54 virtual ~ScUndoCursorAttr();
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 /** once the objects are passed to this class, their life-cycle is
64 managed by this class; the calling function must pass new'ed
65 objects to this method. */
66 void SetEditData( EditTextObject* pOld, EditTextObject* pNew );
68 private:
69 SCCOL nCol;
70 SCROW nRow;
71 SCTAB nTab;
72 ScPatternAttr* pOldPattern;
73 ScPatternAttr* pNewPattern;
74 ScPatternAttr* pApplyPattern;
75 ::boost::shared_ptr<EditTextObject> pOldEditData;
76 ::boost::shared_ptr<EditTextObject> pNewEditData;
77 bool bIsAutomatic;
79 void DoChange( const ScPatternAttr* pWhichPattern, const ::boost::shared_ptr<EditTextObject>& pEditData ) const;
82 class ScUndoEnterData: public ScSimpleUndo
84 public:
85 TYPEINFO_OVERRIDE();
87 struct Value
89 SCTAB mnTab;
90 bool mbHasFormat;
91 sal_uInt32 mnFormat;
92 ScCellValue maCell;
94 Value();
97 typedef std::vector<Value> ValuesType;
99 ScUndoEnterData(
100 ScDocShell* pNewDocShell, const ScAddress& rPos,
101 ValuesType& rOldValues, const OUString& rNewStr, EditTextObject* pObj = NULL );
103 virtual ~ScUndoEnterData();
105 virtual void Undo() SAL_OVERRIDE;
106 virtual void Redo() SAL_OVERRIDE;
107 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
108 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
110 virtual OUString GetComment() const SAL_OVERRIDE;
112 private:
113 ValuesType maOldValues;
115 OUString maNewString;
116 boost::scoped_ptr<EditTextObject> mpNewEditData;
117 sal_uLong mnEndChangeAction;
118 ScAddress maPos;
120 void DoChange() const;
121 void SetChangeTrack();
124 class ScUndoEnterValue: public ScSimpleUndo
126 public:
127 TYPEINFO_OVERRIDE();
128 ScUndoEnterValue(
129 ScDocShell* pNewDocShell, const ScAddress& rNewPos,
130 const ScCellValue& rUndoCell, double nVal );
132 virtual ~ScUndoEnterValue();
134 virtual void Undo() SAL_OVERRIDE;
135 virtual void Redo() SAL_OVERRIDE;
136 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
137 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
139 virtual OUString GetComment() const SAL_OVERRIDE;
141 private:
142 ScAddress aPos;
143 ScCellValue maOldCell;
144 double nValue;
145 sal_uLong nEndChangeAction;
147 void SetChangeTrack();
150 class ScUndoSetCell : public ScSimpleUndo
152 public:
153 TYPEINFO_OVERRIDE();
154 ScUndoSetCell( ScDocShell* pDocSh, const ScAddress& rPos, const ScCellValue& rOldVal, const ScCellValue& rNewVal );
156 virtual ~ScUndoSetCell();
158 virtual void Undo() SAL_OVERRIDE;
159 virtual void Redo() SAL_OVERRIDE;
160 virtual void Repeat( SfxRepeatTarget& rTarget ) SAL_OVERRIDE;
161 virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const SAL_OVERRIDE;
162 virtual OUString GetComment() const SAL_OVERRIDE;
164 private:
165 void SetChangeTrack();
166 void SetValue( const ScCellValue& rVal );
168 private:
169 ScAddress maPos;
170 ScCellValue maOldValue;
171 ScCellValue maNewValue;
172 sal_uLong mnEndChangeAction;
175 class ScUndoPageBreak: public ScSimpleUndo
177 public:
178 TYPEINFO_OVERRIDE();
179 ScUndoPageBreak( ScDocShell* pNewDocShell,
180 SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
181 bool bNewColumn, bool bNewInsert );
182 virtual ~ScUndoPageBreak();
184 virtual void Undo() SAL_OVERRIDE;
185 virtual void Redo() SAL_OVERRIDE;
186 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
187 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
189 virtual OUString GetComment() const SAL_OVERRIDE;
191 private:
192 SCCOL nCol;
193 SCROW nRow;
194 SCTAB nTab;
195 bool bColumn; // Column or row break
196 bool bInsert; // Insert or Delete
198 void DoChange( bool bInsert ) const;
201 class ScUndoPrintZoom: public ScSimpleUndo
203 public:
204 TYPEINFO_OVERRIDE();
205 ScUndoPrintZoom( ScDocShell* pNewDocShell, SCTAB nT,
206 sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP );
207 virtual ~ScUndoPrintZoom();
209 virtual void Undo() SAL_OVERRIDE;
210 virtual void Redo() SAL_OVERRIDE;
211 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
212 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
214 virtual OUString GetComment() const SAL_OVERRIDE;
216 private:
217 SCTAB nTab;
218 sal_uInt16 nOldScale;
219 sal_uInt16 nOldPages;
220 sal_uInt16 nNewScale;
221 sal_uInt16 nNewPages;
223 void DoChange( bool bUndo );
226 class ScUndoThesaurus: public ScSimpleUndo
228 public:
229 TYPEINFO_OVERRIDE();
230 ScUndoThesaurus( ScDocShell* pNewDocShell,
231 SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
232 const ScCellValue& rOldText, const ScCellValue& rNewText );
233 virtual ~ScUndoThesaurus();
235 virtual void Undo() SAL_OVERRIDE;
236 virtual void Redo() SAL_OVERRIDE;
237 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
238 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
240 virtual OUString GetComment() const SAL_OVERRIDE;
242 private:
243 SCCOL nCol;
244 SCROW nRow;
245 SCTAB nTab;
246 sal_uLong nEndChangeAction;
248 ScCellValue maOldText;
249 ScCellValue maNewText;
251 void DoChange( bool bUndo, const ScCellValue& rText );
252 void SetChangeTrack( const ScCellValue& rOldCell );
255 /** Undo action for inserting, removing, and replacing a cell note. */
256 class ScUndoReplaceNote : public ScSimpleUndo
258 public:
259 TYPEINFO_OVERRIDE();
261 /** Constructs an undo action for inserting or removing a cell note. */
262 ScUndoReplaceNote(
263 ScDocShell& rDocShell,
264 const ScAddress& rPos,
265 const ScNoteData& rNoteData,
266 bool bInsert,
267 SdrUndoAction* pDrawUndo );
269 /** Constructs an undo action for replacing a cell note with another. */
270 ScUndoReplaceNote(
271 ScDocShell& rDocShell,
272 const ScAddress& rPos,
273 const ScNoteData& rOldData,
274 const ScNoteData& rNewData,
275 SdrUndoAction* pDrawUndo );
277 virtual ~ScUndoReplaceNote();
279 virtual void Undo() SAL_OVERRIDE;
280 virtual void Redo() SAL_OVERRIDE;
281 virtual void Repeat( SfxRepeatTarget& rTarget ) SAL_OVERRIDE;
282 virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const SAL_OVERRIDE;
284 virtual OUString GetComment() const SAL_OVERRIDE;
286 private:
287 void DoInsertNote( const ScNoteData& rNoteData );
288 void DoRemoveNote( const ScNoteData& rNoteData );
290 private:
291 ScAddress maPos;
292 ScNoteData maOldData;
293 ScNoteData maNewData;
294 SdrUndoAction* mpDrawUndo;
297 /** Undo action for showing or hiding a cell note caption. */
298 class ScUndoShowHideNote : public ScSimpleUndo
300 public:
301 TYPEINFO_OVERRIDE();
302 ScUndoShowHideNote( ScDocShell& rDocShell, const ScAddress& rPos, bool bShow );
303 virtual ~ScUndoShowHideNote();
305 virtual void Undo() SAL_OVERRIDE;
306 virtual void Redo() SAL_OVERRIDE;
307 virtual void Repeat( SfxRepeatTarget& rTarget ) SAL_OVERRIDE;
308 virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const SAL_OVERRIDE;
310 virtual OUString GetComment() const SAL_OVERRIDE;
312 private:
313 ScAddress maPos;
314 bool mbShown;
317 class ScUndoDetective: public ScSimpleUndo
319 public:
320 TYPEINFO_OVERRIDE();
321 ScUndoDetective( ScDocShell* pNewDocShell,
322 SdrUndoAction* pDraw, const ScDetOpData* pOperation,
323 ScDetOpList* pUndoList = NULL );
324 virtual ~ScUndoDetective();
326 virtual void Undo() SAL_OVERRIDE;
327 virtual void Redo() SAL_OVERRIDE;
328 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
329 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
331 virtual OUString GetComment() const SAL_OVERRIDE;
333 private:
334 bool bIsDelete;
335 ScDetOpList* pOldList;
336 sal_uInt16 nAction;
337 ScAddress aPos;
338 SdrUndoAction* pDrawUndo;
341 class ScUndoRangeNames: public ScSimpleUndo
343 public:
344 TYPEINFO_OVERRIDE();
345 //use nTab = -1 for global range names
346 ScUndoRangeNames( ScDocShell* pNewDocShell,
347 ScRangeName* pOld, ScRangeName* pNew , SCTAB nTab = -1);
348 virtual ~ScUndoRangeNames();
350 virtual void Undo() SAL_OVERRIDE;
351 virtual void Redo() SAL_OVERRIDE;
352 virtual void Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
353 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
355 virtual OUString GetComment() const SAL_OVERRIDE;
357 private:
358 ScRangeName* pOldRanges;
359 ScRangeName* pNewRanges;
360 SCTAB mnTab;
362 void DoChange( bool bUndo );
365 namespace sc {
367 class UndoSetCells : public ScSimpleUndo
369 ScAddress maTopPos;
370 CellValues maOldValues;
371 CellValues maNewValues;
373 void DoChange( const CellValues& rValues );
375 public:
376 UndoSetCells( ScDocShell* pDocSh, const ScAddress& rTopPos );
377 virtual ~UndoSetCells();
379 virtual void Undo() SAL_OVERRIDE;
380 virtual void Redo() SAL_OVERRIDE;
382 virtual bool CanRepeat( SfxRepeatTarget& ) const SAL_OVERRIDE;
383 virtual OUString GetComment() const SAL_OVERRIDE;
385 CellValues& GetOldValues() { return maOldValues;}
386 void SetNewValues( const std::vector<double>& rVals );
389 } // namespace sc
391 #endif
393 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */