Bump version to 6.4-15
[LibreOffice.git] / svx / source / table / tableundo.hxx
blob33231cdca4514f0ec4bc3ae1bdcb3b1b6d93d89e
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>
29 #include <svx/sdrobjectuser.hxx>
31 #include <celltypes.hxx>
33 namespace sdr { namespace properties {
34 class TextProperties;
35 } }
37 class OutlinerParaObject;
40 namespace sdr { namespace table {
42 class CellUndo : public SdrUndoAction, public sdr::ObjectUser
44 public:
45 CellUndo( const tools::WeakReference<SdrObject>& xObjRef, const CellRef& xCell );
46 virtual ~CellUndo() override;
48 virtual void Undo() override;
49 virtual void Redo() override;
50 virtual bool Merge( SfxUndoAction *pNextAction ) override;
52 void dispose();
53 virtual void ObjectInDestruction(const SdrObject& rObject) override;
55 private:
56 struct Data
58 sdr::properties::TextProperties* mpProperties;
59 OutlinerParaObject* mpOutlinerParaObject;
61 OUString msFormula;
62 double mfValue;
63 ::sal_Int32 mnError;
64 bool mbMerged;
65 ::sal_Int32 mnRowSpan;
66 ::sal_Int32 mnColSpan;
68 Data()
69 : mpProperties(nullptr)
70 , mpOutlinerParaObject(nullptr)
71 , mfValue(0)
72 , mnError(0)
73 , mbMerged(false)
74 , mnRowSpan(0)
75 , mnColSpan(0)
80 void setDataToCell( const Data& rData );
81 void getDataFromCell( Data& rData );
83 tools::WeakReference<SdrObject> mxObjRef;
84 CellRef mxCell;
85 Data maUndoData;
86 Data maRedoData;
87 bool mbUndo;
91 class InsertRowUndo : public SdrUndoAction
93 public:
94 InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows );
95 virtual ~InsertRowUndo() override;
97 virtual void Undo() override;
98 virtual void Redo() override;
100 private:
101 TableModelRef mxTable;
102 sal_Int32 const mnIndex;
103 RowVector maRows;
104 bool mbUndo;
108 class RemoveRowUndo : public SdrUndoAction
110 public:
111 RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows );
112 virtual ~RemoveRowUndo() override;
114 virtual void Undo() override;
115 virtual void Redo() override;
117 private:
118 TableModelRef mxTable;
119 sal_Int32 const mnIndex;
120 RowVector maRows;
121 bool mbUndo;
125 class InsertColUndo : public SdrUndoAction
127 public:
128 InsertColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
129 virtual ~InsertColUndo() override;
131 virtual void Undo() override;
132 virtual void Redo() override;
134 private:
135 TableModelRef mxTable;
136 sal_Int32 const mnIndex;
137 ColumnVector maColumns;
138 CellVector maCells;
139 bool mbUndo;
143 class RemoveColUndo : public SdrUndoAction
145 public:
146 RemoveColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
147 virtual ~RemoveColUndo() override;
149 virtual void Undo() override;
150 virtual void Redo() override;
152 private:
153 TableModelRef mxTable;
154 sal_Int32 const mnIndex;
155 ColumnVector maColumns;
156 CellVector maCells;
157 bool mbUndo;
161 class TableColumnUndo : public SdrUndoAction
163 public:
164 explicit TableColumnUndo( const TableColumnRef& xCol );
165 virtual ~TableColumnUndo() override;
167 virtual void Undo() override;
168 virtual void Redo() override;
169 virtual bool Merge( SfxUndoAction *pNextAction ) override;
171 private:
172 struct Data
174 sal_Int32 mnColumn;
175 sal_Int32 mnWidth;
176 bool mbOptimalWidth;
177 bool mbIsVisible;
178 bool mbIsStartOfNewPage;
179 OUString maName;
181 Data()
182 : mnColumn(0)
183 , mnWidth(0)
184 , mbOptimalWidth(false)
185 , mbIsVisible(false)
186 , mbIsStartOfNewPage(false)
191 void setData( const Data& rData );
192 void getData( Data& rData );
194 TableColumnRef mxCol;
195 Data maUndoData;
196 Data maRedoData;
197 bool mbHasRedoData;
201 class TableRowUndo : public SdrUndoAction
203 public:
204 explicit TableRowUndo( const TableRowRef& xRow );
205 virtual ~TableRowUndo() override;
207 virtual void Undo() override;
208 virtual void Redo() override;
209 virtual bool Merge( SfxUndoAction *pNextAction ) override;
211 private:
212 struct Data
214 sal_Int32 mnRow;
215 sal_Int32 mnHeight;
216 bool mbOptimalHeight;
217 bool mbIsVisible;
218 bool mbIsStartOfNewPage;
219 OUString maName;
222 void setData( const Data& rData );
223 void getData( Data& rData );
225 TableRowRef mxRow;
226 Data maUndoData;
227 Data maRedoData;
228 bool mbHasRedoData;
231 class TableStyleUndo : public SdrUndoAction
233 public:
234 explicit TableStyleUndo( const SdrTableObj& rTableObj );
236 virtual void Undo() override;
237 virtual void Redo() override;
239 private:
240 tools::WeakReference<SdrTableObj> mxObjRef;
242 struct Data
244 TableStyleSettings maSettings;
245 css::uno::Reference< css::container::XIndexAccess > mxTableStyle;
248 void setData( const Data& rData );
249 void getData( Data& rData );
251 Data maUndoData;
252 Data maRedoData;
253 bool mbHasRedoData;
258 #endif
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */