bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / table / tableundo.hxx
blob4f816a477650de54fb2266cf51da5073c7765b68
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 _SVX_TABLEUNDO_HXX_
21 #define _SVX_TABLEUNDO_HXX_
23 #include <com/sun/star/container/XIndexAccess.hpp>
24 #include <com/sun/star/table/CellContentType.hpp>
26 #include "svx/svdotable.hxx"
27 #include "svx/svdobj.hxx"
28 #include "svx/svdundo.hxx"
30 #include "celltypes.hxx"
32 namespace sdr { namespace properties {
33 class TextProperties;
34 } }
36 class OutlinerParaObject;
38 // -----------------------------------------------------------------------------
40 namespace sdr { namespace table {
42 class CellUndo : public SdrUndoAction, public sdr::ObjectUser
44 public:
45 CellUndo( const SdrObjectWeakRef& xObjRef, const CellRef& xCell );
46 virtual ~CellUndo();
48 virtual void Undo();
49 virtual void Redo();
50 virtual sal_Bool Merge( SfxUndoAction *pNextAction );
52 void dispose();
53 virtual void ObjectInDestruction(const SdrObject& rObject);
55 private:
56 struct Data
58 sdr::properties::TextProperties* mpProperties;
59 OutlinerParaObject* mpOutlinerParaObject;
61 ::com::sun::star::table::CellContentType mnCellContentType;
63 OUString msFormula;
64 double mfValue;
65 ::sal_Int32 mnError;
66 ::sal_Bool mbMerged;
67 ::sal_Int32 mnRowSpan;
68 ::sal_Int32 mnColSpan;
70 Data() : mpProperties(NULL), mpOutlinerParaObject(NULL), mfValue(0) {};
73 void setDataToCell( const Data& rData );
74 void getDataFromCell( Data& rData );
76 SdrObjectWeakRef mxObjRef;
77 CellRef mxCell;
78 Data maUndoData;
79 Data maRedoData;
80 bool mbUndo;
83 // -----------------------------------------------------------------------------
85 class InsertRowUndo : public SdrUndoAction
87 public:
88 InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows );
89 virtual ~InsertRowUndo();
91 virtual void Undo();
92 virtual void Redo();
94 private:
95 TableModelRef mxTable;
96 sal_Int32 mnIndex;
97 RowVector maRows;
98 bool mbUndo;
101 // -----------------------------------------------------------------------------
103 class RemoveRowUndo : public SdrUndoAction
105 public:
106 RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows );
107 virtual ~RemoveRowUndo();
109 virtual void Undo();
110 virtual void Redo();
112 private:
113 TableModelRef mxTable;
114 sal_Int32 mnIndex;
115 RowVector maRows;
116 bool mbUndo;
119 // -----------------------------------------------------------------------------
121 class InsertColUndo : public SdrUndoAction
123 public:
124 InsertColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
125 virtual ~InsertColUndo();
127 virtual void Undo();
128 virtual void Redo();
130 private:
131 TableModelRef mxTable;
132 sal_Int32 mnIndex;
133 ColumnVector maColumns;
134 CellVector maCells;
135 bool mbUndo;
138 // -----------------------------------------------------------------------------
140 class RemoveColUndo : public SdrUndoAction
142 public:
143 RemoveColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
144 virtual ~RemoveColUndo();
146 virtual void Undo();
147 virtual void Redo();
149 private:
150 TableModelRef mxTable;
151 sal_Int32 mnIndex;
152 ColumnVector maColumns;
153 CellVector maCells;
154 bool mbUndo;
157 // -----------------------------------------------------------------------------
159 class TableColumnUndo : public SdrUndoAction
161 public:
162 TableColumnUndo( const TableColumnRef& xCol );
163 virtual ~TableColumnUndo();
165 virtual void Undo();
166 virtual void Redo();
167 virtual sal_Bool Merge( SfxUndoAction *pNextAction );
169 private:
170 struct Data
172 sal_Int32 mnColumn;
173 sal_Int32 mnWidth;
174 sal_Bool mbOptimalWidth;
175 sal_Bool mbIsVisible;
176 sal_Bool mbIsStartOfNewPage;
177 OUString maName;
180 void setData( const Data& rData );
181 void getData( Data& rData );
183 TableColumnRef mxCol;
184 Data maUndoData;
185 Data maRedoData;
186 bool mbHasRedoData;
189 // -----------------------------------------------------------------------------
191 class TableRowUndo : public SdrUndoAction
193 public:
194 TableRowUndo( const TableRowRef& xRow );
195 virtual ~TableRowUndo();
197 virtual void Undo();
198 virtual void Redo();
199 virtual sal_Bool Merge( SfxUndoAction *pNextAction );
201 private:
202 struct Data
204 CellVector maCells;
205 sal_Int32 mnRow;
206 sal_Int32 mnHeight;
207 sal_Bool mbOptimalHeight;
208 sal_Bool mbIsVisible;
209 sal_Bool mbIsStartOfNewPage;
210 OUString maName;
213 void setData( const Data& rData );
214 void getData( Data& rData );
216 TableRowRef mxRow;
217 Data maUndoData;
218 Data maRedoData;
219 bool mbHasRedoData;
222 // -----------------------------------------------------------------------------
224 class TableStyleUndo : public SdrUndoAction
226 public:
227 TableStyleUndo( const SdrTableObj& rTableObj );
229 virtual void Undo();
230 virtual void Redo();
232 private:
233 SdrObjectWeakRef mxObjRef;
235 struct Data
237 TableStyleSettings maSettings;
238 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxTableStyle;
241 void setData( const Data& rData );
242 void getData( Data& rData );
244 Data maUndoData;
245 Data maRedoData;
246 bool mbHasRedoData;
251 #endif
253 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */