Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / table / tableundo.hxx
blob1f7e24dd63504a5cf03fea327b8061e49677724b
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_SVX_SOURCE_TABLE_TABLEUNDO_HXX
21 #define INCLUDED_SVX_SOURCE_TABLE_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;
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() SAL_OVERRIDE;
49 virtual void Redo() SAL_OVERRIDE;
50 virtual bool Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
52 void dispose();
53 virtual void ObjectInDestruction(const SdrObject& rObject) SAL_OVERRIDE;
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 bool mbMerged;
67 ::sal_Int32 mnRowSpan;
68 ::sal_Int32 mnColSpan;
70 Data()
71 : mpProperties(NULL)
72 , mpOutlinerParaObject(NULL)
73 , mnCellContentType(css::table::CellContentType_EMPTY)
74 , mfValue(0)
75 , mnError(0)
76 , mbMerged(false)
77 , mnRowSpan(0)
78 , mnColSpan(0)
83 void setDataToCell( const Data& rData );
84 void getDataFromCell( Data& rData );
86 SdrObjectWeakRef mxObjRef;
87 CellRef mxCell;
88 Data maUndoData;
89 Data maRedoData;
90 bool mbUndo;
95 class InsertRowUndo : public SdrUndoAction
97 public:
98 InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows );
99 virtual ~InsertRowUndo();
101 virtual void Undo() SAL_OVERRIDE;
102 virtual void Redo() SAL_OVERRIDE;
104 private:
105 TableModelRef mxTable;
106 sal_Int32 mnIndex;
107 RowVector maRows;
108 bool mbUndo;
113 class RemoveRowUndo : public SdrUndoAction
115 public:
116 RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows );
117 virtual ~RemoveRowUndo();
119 virtual void Undo() SAL_OVERRIDE;
120 virtual void Redo() SAL_OVERRIDE;
122 private:
123 TableModelRef mxTable;
124 sal_Int32 mnIndex;
125 RowVector maRows;
126 bool mbUndo;
131 class InsertColUndo : public SdrUndoAction
133 public:
134 InsertColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
135 virtual ~InsertColUndo();
137 virtual void Undo() SAL_OVERRIDE;
138 virtual void Redo() SAL_OVERRIDE;
140 private:
141 TableModelRef mxTable;
142 sal_Int32 mnIndex;
143 ColumnVector maColumns;
144 CellVector maCells;
145 bool mbUndo;
150 class RemoveColUndo : public SdrUndoAction
152 public:
153 RemoveColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
154 virtual ~RemoveColUndo();
156 virtual void Undo() SAL_OVERRIDE;
157 virtual void Redo() SAL_OVERRIDE;
159 private:
160 TableModelRef mxTable;
161 sal_Int32 mnIndex;
162 ColumnVector maColumns;
163 CellVector maCells;
164 bool mbUndo;
169 class TableColumnUndo : public SdrUndoAction
171 public:
172 TableColumnUndo( const TableColumnRef& xCol );
173 virtual ~TableColumnUndo();
175 virtual void Undo() SAL_OVERRIDE;
176 virtual void Redo() SAL_OVERRIDE;
177 virtual bool Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
179 private:
180 struct Data
182 sal_Int32 mnColumn;
183 sal_Int32 mnWidth;
184 bool mbOptimalWidth;
185 bool mbIsVisible;
186 bool mbIsStartOfNewPage;
187 OUString maName;
190 void setData( const Data& rData );
191 void getData( Data& rData );
193 TableColumnRef mxCol;
194 Data maUndoData;
195 Data maRedoData;
196 bool mbHasRedoData;
201 class TableRowUndo : public SdrUndoAction
203 public:
204 TableRowUndo( const TableRowRef& xRow );
205 virtual ~TableRowUndo();
207 virtual void Undo() SAL_OVERRIDE;
208 virtual void Redo() SAL_OVERRIDE;
209 virtual bool Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
211 private:
212 struct Data
214 CellVector maCells;
215 sal_Int32 mnRow;
216 sal_Int32 mnHeight;
217 bool mbOptimalHeight;
218 bool mbIsVisible;
219 bool mbIsStartOfNewPage;
220 OUString maName;
223 void setData( const Data& rData );
224 void getData( Data& rData );
226 TableRowRef mxRow;
227 Data maUndoData;
228 Data maRedoData;
229 bool mbHasRedoData;
234 class TableStyleUndo : public SdrUndoAction
236 public:
237 TableStyleUndo( const SdrTableObj& rTableObj );
239 virtual void Undo() SAL_OVERRIDE;
240 virtual void Redo() SAL_OVERRIDE;
242 private:
243 SdrObjectWeakRef mxObjRef;
245 struct Data
247 TableStyleSettings maSettings;
248 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxTableStyle;
251 void setData( const Data& rData );
252 void getData( Data& rData );
254 Data maUndoData;
255 Data maRedoData;
256 bool mbHasRedoData;
261 #endif
263 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */