lok: Don't attempt to select the exact text after a failed search.
[LibreOffice.git] / svx / source / table / tableundo.hxx
blobc9747cb635bb753afb89d0cf9d0328d06b65d584
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;
41 namespace sdr { namespace table {
43 class CellUndo : public SdrUndoAction, public sdr::ObjectUser
45 public:
46 CellUndo( const SdrObjectWeakRef& xObjRef, const CellRef& xCell );
47 virtual ~CellUndo();
49 virtual void Undo() SAL_OVERRIDE;
50 virtual void Redo() SAL_OVERRIDE;
51 virtual bool Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
53 void dispose();
54 virtual void ObjectInDestruction(const SdrObject& rObject) SAL_OVERRIDE;
56 private:
57 struct Data
59 sdr::properties::TextProperties* mpProperties;
60 OutlinerParaObject* mpOutlinerParaObject;
62 ::com::sun::star::table::CellContentType mnCellContentType;
64 OUString msFormula;
65 double mfValue;
66 ::sal_Int32 mnError;
67 bool mbMerged;
68 ::sal_Int32 mnRowSpan;
69 ::sal_Int32 mnColSpan;
71 Data()
72 : mpProperties(NULL)
73 , mpOutlinerParaObject(NULL)
74 , mnCellContentType(css::table::CellContentType_EMPTY)
75 , mfValue(0)
76 , mnError(0)
77 , mbMerged(false)
78 , mnRowSpan(0)
79 , mnColSpan(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;
96 class InsertRowUndo : public SdrUndoAction
98 public:
99 InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows );
100 virtual ~InsertRowUndo();
102 virtual void Undo() SAL_OVERRIDE;
103 virtual void Redo() SAL_OVERRIDE;
105 private:
106 TableModelRef mxTable;
107 sal_Int32 mnIndex;
108 RowVector maRows;
109 bool mbUndo;
114 class RemoveRowUndo : public SdrUndoAction
116 public:
117 RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows );
118 virtual ~RemoveRowUndo();
120 virtual void Undo() SAL_OVERRIDE;
121 virtual void Redo() SAL_OVERRIDE;
123 private:
124 TableModelRef mxTable;
125 sal_Int32 mnIndex;
126 RowVector maRows;
127 bool mbUndo;
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() SAL_OVERRIDE;
139 virtual void Redo() SAL_OVERRIDE;
141 private:
142 TableModelRef mxTable;
143 sal_Int32 mnIndex;
144 ColumnVector maColumns;
145 CellVector maCells;
146 bool mbUndo;
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() SAL_OVERRIDE;
158 virtual void Redo() SAL_OVERRIDE;
160 private:
161 TableModelRef mxTable;
162 sal_Int32 mnIndex;
163 ColumnVector maColumns;
164 CellVector maCells;
165 bool mbUndo;
170 class TableColumnUndo : public SdrUndoAction
172 public:
173 TableColumnUndo( const TableColumnRef& xCol );
174 virtual ~TableColumnUndo();
176 virtual void Undo() SAL_OVERRIDE;
177 virtual void Redo() SAL_OVERRIDE;
178 virtual bool Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
180 private:
181 struct Data
183 sal_Int32 mnColumn;
184 sal_Int32 mnWidth;
185 bool mbOptimalWidth;
186 bool mbIsVisible;
187 bool mbIsStartOfNewPage;
188 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;
202 class TableRowUndo : public SdrUndoAction
204 public:
205 TableRowUndo( const TableRowRef& xRow );
206 virtual ~TableRowUndo();
208 virtual void Undo() SAL_OVERRIDE;
209 virtual void Redo() SAL_OVERRIDE;
210 virtual bool Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
212 private:
213 struct Data
215 CellVector maCells;
216 sal_Int32 mnRow;
217 sal_Int32 mnHeight;
218 bool mbOptimalHeight;
219 bool mbIsVisible;
220 bool mbIsStartOfNewPage;
221 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;
235 class TableStyleUndo : public SdrUndoAction
237 public:
238 TableStyleUndo( const SdrTableObj& rTableObj );
240 virtual void Undo() SAL_OVERRIDE;
241 virtual void Redo() SAL_OVERRIDE;
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
264 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */