update dev300-m58
[ooovba.git] / svx / source / table / tableundo.hxx
blob36e71a254fdb995b218e72aa3e3282cf296220a6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tableundo.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_TABLEUNDO_HXX_
32 #define _SVX_TABLEUNDO_HXX_
34 #include <com/sun/star/container/XIndexAccess.hpp>
35 #include <com/sun/star/table/CellContentType.hpp>
37 #include "svx/svdotable.hxx"
38 #include "svx/svdobj.hxx"
39 #include "svx/svdundo.hxx"
41 #include "celltypes.hxx"
43 namespace sdr { namespace properties {
44 class TextProperties;
45 } }
47 class OutlinerParaObject;
49 // -----------------------------------------------------------------------------
51 namespace sdr { namespace table {
53 class CellUndo : public SdrUndoAction, public sdr::ObjectUser
55 public:
56 CellUndo( const SdrObjectWeakRef& xObjRef, const CellRef& xCell );
57 virtual ~CellUndo();
59 virtual void Undo();
60 virtual void Redo();
61 virtual BOOL Merge( SfxUndoAction *pNextAction );
63 void dispose();
64 virtual void ObjectInDestruction(const SdrObject& rObject);
66 private:
67 struct Data
69 sdr::properties::TextProperties* mpProperties;
70 OutlinerParaObject* mpOutlinerParaObject;
72 ::com::sun::star::table::CellContentType mnCellContentType;
74 ::rtl::OUString msFormula;
75 double mfValue;
76 ::sal_Int32 mnError;
77 ::sal_Bool mbMerged;
78 ::sal_Int32 mnRowSpan;
79 ::sal_Int32 mnColSpan;
81 Data() : mpProperties(0), mpOutlinerParaObject(0) {};
84 void setDataToCell( const Data& rData );
85 void getDataFromCell( Data& rData );
87 SdrObjectWeakRef mxObjRef;
88 CellRef mxCell;
89 Data maUndoData;
90 Data maRedoData;
91 bool mbUndo;
94 // -----------------------------------------------------------------------------
96 class InsertRowUndo : public SdrUndoAction
98 public:
99 InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows );
100 virtual ~InsertRowUndo();
102 virtual void Undo();
103 virtual void Redo();
105 private:
106 TableModelRef mxTable;
107 sal_Int32 mnIndex;
108 RowVector maRows;
109 bool mbUndo;
112 // -----------------------------------------------------------------------------
114 class RemoveRowUndo : public SdrUndoAction
116 public:
117 RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows );
118 virtual ~RemoveRowUndo();
120 virtual void Undo();
121 virtual void Redo();
123 private:
124 TableModelRef mxTable;
125 sal_Int32 mnIndex;
126 RowVector maRows;
127 bool mbUndo;
130 // -----------------------------------------------------------------------------
132 class InsertColUndo : public SdrUndoAction
134 public:
135 InsertColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
136 virtual ~InsertColUndo();
138 virtual void Undo();
139 virtual void Redo();
141 private:
142 TableModelRef mxTable;
143 sal_Int32 mnIndex;
144 ColumnVector maColumns;
145 CellVector maCells;
146 bool mbUndo;
149 // -----------------------------------------------------------------------------
151 class RemoveColUndo : public SdrUndoAction
153 public:
154 RemoveColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
155 virtual ~RemoveColUndo();
157 virtual void Undo();
158 virtual void Redo();
160 private:
161 TableModelRef mxTable;
162 sal_Int32 mnIndex;
163 ColumnVector maColumns;
164 CellVector maCells;
165 bool mbUndo;
168 // -----------------------------------------------------------------------------
170 class TableColumnUndo : public SdrUndoAction
172 public:
173 TableColumnUndo( const TableColumnRef& xCol );
174 virtual ~TableColumnUndo();
176 virtual void Undo();
177 virtual void Redo();
178 virtual BOOL Merge( SfxUndoAction *pNextAction );
180 private:
181 struct Data
183 sal_Int32 mnColumn;
184 sal_Int32 mnWidth;
185 sal_Bool mbOptimalWidth;
186 sal_Bool mbIsVisible;
187 sal_Bool mbIsStartOfNewPage;
188 ::rtl::OUString maName;
191 void setData( const Data& rData );
192 void getData( Data& rData );
194 TableColumnRef mxCol;
195 Data maUndoData;
196 Data maRedoData;
197 bool mbHasRedoData;
200 // -----------------------------------------------------------------------------
202 class TableRowUndo : public SdrUndoAction
204 public:
205 TableRowUndo( const TableRowRef& xRow );
206 virtual ~TableRowUndo();
208 virtual void Undo();
209 virtual void Redo();
210 virtual BOOL Merge( SfxUndoAction *pNextAction );
212 private:
213 struct Data
215 CellVector maCells;
216 sal_Int32 mnRow;
217 sal_Int32 mnHeight;
218 sal_Bool mbOptimalHeight;
219 sal_Bool mbIsVisible;
220 sal_Bool mbIsStartOfNewPage;
221 ::rtl::OUString maName;
224 void setData( const Data& rData );
225 void getData( Data& rData );
227 TableRowRef mxRow;
228 Data maUndoData;
229 Data maRedoData;
230 bool mbHasRedoData;
233 // -----------------------------------------------------------------------------
235 class TableStyleUndo : public SdrUndoAction
237 public:
238 TableStyleUndo( const SdrTableObj& rTableObj );
240 virtual void Undo();
241 virtual void Redo();
243 private:
244 SdrObjectWeakRef mxObjRef;
246 struct Data
248 TableStyleSettings maSettings;
249 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxTableStyle;
252 void setData( const Data& rData );
253 void getData( Data& rData );
255 Data maUndoData;
256 Data maRedoData;
257 bool mbHasRedoData;
262 #endif