LibreOffice Module svx (master) 1
tableundo.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_SVX_SOURCE_TABLE_TABLEUNDO_HXX
21#define INCLUDED_SVX_SOURCE_TABLE_TABLEUNDO_HXX
22
23#include <com/sun/star/container/XIndexAccess.hpp>
24
26#include <svx/svdotable.hxx>
27#include <svx/svdobj.hxx>
28#include <svx/svdundo.hxx>
29#include <svx/sdrobjectuser.hxx>
30
31#include <celltypes.hxx>
32
33namespace sdr::properties {
34 class TextProperties;
35}
36
38
39
40namespace sdr::table {
41
43{
44public:
45 CellUndo( SdrObject* pObj, const CellRef& xCell );
46 virtual ~CellUndo() override;
47
48 virtual void Undo() override;
49 virtual void Redo() override;
50 virtual bool Merge( SfxUndoAction *pNextAction ) override;
51
52 void dispose();
53 virtual void ObjectInDestruction(const SdrObject& rObject) override;
54
55private:
56 struct Data
57 {
58 std::unique_ptr<sdr::properties::CellProperties> mxProperties;
60
61 OUString msFormula;
62 double mfValue;
63 ::sal_Int32 mnError;
65 ::sal_Int32 mnRowSpan;
66 ::sal_Int32 mnColSpan;
67
69 : mfValue(0)
70 , mnError(0)
71 , mbMerged(false)
72 , mnRowSpan(0)
73 , mnColSpan(0)
74 {
75 }
76 };
77
78 void setDataToCell( const Data& rData );
79 void getDataFromCell( Data& rData );
80
85 bool mbUndo;
86};
87
88
90{
91public:
92 InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows );
93 virtual ~InsertRowUndo() override;
94
95 virtual void Undo() override;
96 virtual void Redo() override;
97
98private:
100 sal_Int32 mnIndex;
102 bool mbUndo;
103};
104
105
107{
108public:
109 RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows );
110 virtual ~RemoveRowUndo() override;
111
112 virtual void Undo() override;
113 virtual void Redo() override;
114
115private:
117 sal_Int32 mnIndex;
119 bool mbUndo;
120};
121
122
124{
125public:
126 InsertColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
127 virtual ~InsertColUndo() override;
128
129 virtual void Undo() override;
130 virtual void Redo() override;
131
132private:
134 sal_Int32 mnIndex;
137 bool mbUndo;
138};
139
140
142{
143public:
144 RemoveColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
145 virtual ~RemoveColUndo() override;
146
147 virtual void Undo() override;
148 virtual void Redo() override;
149
150private:
152 sal_Int32 mnIndex;
155 bool mbUndo;
156};
157
158
160{
161public:
162 explicit TableColumnUndo( const TableColumnRef& xCol );
163 virtual ~TableColumnUndo() override;
164
165 virtual void Undo() override;
166 virtual void Redo() override;
167 virtual bool Merge( SfxUndoAction *pNextAction ) override;
168
169private:
170 struct Data
171 {
172 sal_Int32 mnColumn;
173 sal_Int32 mnWidth;
177 OUString maName;
178
180 : mnColumn(0)
181 , mnWidth(0)
182 , mbOptimalWidth(false)
183 , mbIsVisible(false)
184 , mbIsStartOfNewPage(false)
185 {
186 }
187 };
188
189 void setData( const Data& rData );
190 void getData( Data& rData );
191
196};
197
198
200{
201public:
202 explicit TableRowUndo( const TableRowRef& xRow );
203 virtual ~TableRowUndo() override;
204
205 virtual void Undo() override;
206 virtual void Redo() override;
207 virtual bool Merge( SfxUndoAction *pNextAction ) override;
208
209private:
210 struct Data
211 {
212 sal_Int32 mnRow;
213 sal_Int32 mnHeight;
217 OUString maName;
218 };
219
220 void setData( const Data& rData );
221 void getData( Data& rData );
222
227};
228
230{
231public:
232 explicit TableStyleUndo( const SdrTableObj& rTableObj );
233
234 virtual void Undo() override;
235 virtual void Redo() override;
236
237private:
239
240 struct Data
241 {
243 css::uno::Reference< css::container::XIndexAccess > mxTableStyle;
244 };
245
246 void setData( const Data& rData );
247 void getData( Data& rData );
248
252};
253
254}
255
256#endif
257
258/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Abstract DrawObject.
Definition: svdobj.hxx:260
Abstract base class (ABC) for all UndoActions of DrawingEngine.
Definition: svdundo.hxx:61
void setDataToCell(const Data &rData)
Definition: tableundo.cxx:98
CellUndo(SdrObject *pObj, const CellRef &xCell)
Definition: tableundo.cxx:37
unotools::WeakReference< SdrObject > mxObjRef
Definition: tableundo.hxx:81
void getDataFromCell(Data &rData)
Definition: tableundo.cxx:126
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: tableundo.cxx:92
virtual void Undo() override
Definition: tableundo.cxx:71
virtual void ObjectInDestruction(const SdrObject &rObject) override
Definition: tableundo.cxx:66
virtual ~CellUndo() override
Definition: tableundo.cxx:50
virtual void Redo() override
Definition: tableundo.cxx:83
virtual void Redo() override
Definition: tableundo.cxx:283
InsertColUndo(const TableModelRef &xTable, sal_Int32 nIndex, ColumnVector &aNewCols, CellVector &aCells)
Definition: tableundo.cxx:252
virtual ~InsertColUndo() override
Definition: tableundo.cxx:263
virtual void Undo() override
Definition: tableundo.cxx:273
virtual void Redo() override
Definition: tableundo.cxx:185
virtual ~InsertRowUndo() override
Definition: tableundo.cxx:168
InsertRowUndo(const TableModelRef &xTable, sal_Int32 nIndex, RowVector &aNewRows)
Definition: tableundo.cxx:158
virtual void Undo() override
Definition: tableundo.cxx:175
virtual void Undo() override
Definition: tableundo.cxx:317
RemoveColUndo(const TableModelRef &xTable, sal_Int32 nIndex, ColumnVector &aNewCols, CellVector &aCells)
Definition: tableundo.cxx:296
virtual ~RemoveColUndo() override
Definition: tableundo.cxx:307
virtual void Redo() override
Definition: tableundo.cxx:327
virtual void Redo() override
Definition: tableundo.cxx:225
virtual ~RemoveRowUndo() override
Definition: tableundo.cxx:208
RemoveRowUndo(const TableModelRef &xTable, sal_Int32 nIndex, RowVector &aRemovedRows)
Definition: tableundo.cxx:198
virtual void Undo() override
Definition: tableundo.cxx:215
TableColumnUndo(const TableColumnRef &xCol)
Definition: tableundo.cxx:340
virtual void Redo() override
Definition: tableundo.cxx:365
void getData(Data &rData)
Definition: tableundo.cxx:392
virtual void Undo() override
Definition: tableundo.cxx:354
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: tableundo.cxx:371
void setData(const Data &rData)
Definition: tableundo.cxx:378
virtual ~TableColumnUndo() override
Definition: tableundo.cxx:349
virtual void Redo() override
Definition: tableundo.cxx:431
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: tableundo.cxx:437
TableRowUndo(const TableRowRef &xRow)
Definition: tableundo.cxx:406
void getData(Data &rData)
Definition: tableundo.cxx:458
void setData(const Data &rData)
Definition: tableundo.cxx:444
virtual ~TableRowUndo() override
Definition: tableundo.cxx:415
virtual void Undo() override
Definition: tableundo.cxx:420
virtual void Undo() override
Definition: tableundo.cxx:477
virtual void Redo() override
Definition: tableundo.cxx:487
unotools::WeakReference< SdrTableObj > mxObjRef
Definition: tableundo.hxx:238
void setData(const Data &rData)
Definition: tableundo.cxx:492
void getData(Data &rData)
Definition: tableundo.cxx:502
TableStyleUndo(const SdrTableObj &rTableObj)
Definition: tableundo.cxx:469
sal_Int32 nIndex
std::vector< CellRef > CellVector
Definition: celltypes.hxx:38
std::vector< TableColumnRef > ColumnVector
Definition: celltypes.hxx:40
std::vector< TableRowRef > RowVector
Definition: celltypes.hxx:39
std::unique_ptr< sdr::properties::CellProperties > mxProperties
Definition: tableundo.hxx:58
std::optional< OutlinerParaObject > mpOutlinerParaObject
Definition: tableundo.hxx:59
TableStyleSettings.
Definition: svdotable.hxx:75
css::uno::Reference< css::container::XIndexAccess > mxTableStyle
Definition: tableundo.hxx:243
TableStyleSettings maSettings
Definition: tableundo.hxx:242