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 
25 #include <svx/svdotable.hxx>
26 #include <svx/svdobj.hxx>
27 #include <svx/svdundo.hxx>
28 #include <svx/sdrobjectuser.hxx>
29 
30 #include <celltypes.hxx>
31 
32 namespace sdr::properties {
33  class TextProperties;
34 }
35 
36 class OutlinerParaObject;
37 
38 
39 namespace sdr::table {
40 
41 class CellUndo : public SdrUndoAction, public sdr::ObjectUser
42 {
43 public:
44  CellUndo( const tools::WeakReference<SdrObject>& xObjRef, const CellRef& xCell );
45  virtual ~CellUndo() override;
46 
47  virtual void Undo() override;
48  virtual void Redo() override;
49  virtual bool Merge( SfxUndoAction *pNextAction ) override;
50 
51  void dispose();
52  virtual void ObjectInDestruction(const SdrObject& rObject) override;
53 
54 private:
55  struct Data
56  {
59 
60  OUString msFormula;
61  double mfValue;
62  ::sal_Int32 mnError;
63  bool mbMerged;
64  ::sal_Int32 mnRowSpan;
65  ::sal_Int32 mnColSpan;
66 
67  Data()
68  : mpProperties(nullptr)
69  , mpOutlinerParaObject(nullptr)
70  , mfValue(0)
71  , mnError(0)
72  , mbMerged(false)
73  , mnRowSpan(0)
74  , mnColSpan(0)
75  {
76  }
77  };
78 
79  void setDataToCell( const Data& rData );
80  void getDataFromCell( Data& rData );
81 
86  bool mbUndo;
87 };
88 
89 
91 {
92 public:
93  InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows );
94  virtual ~InsertRowUndo() override;
95 
96  virtual void Undo() override;
97  virtual void Redo() override;
98 
99 private:
101  sal_Int32 mnIndex;
103  bool mbUndo;
104 };
105 
106 
108 {
109 public:
110  RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows );
111  virtual ~RemoveRowUndo() override;
112 
113  virtual void Undo() override;
114  virtual void Redo() override;
115 
116 private:
118  sal_Int32 mnIndex;
120  bool mbUndo;
121 };
122 
123 
125 {
126 public:
127  InsertColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
128  virtual ~InsertColUndo() override;
129 
130  virtual void Undo() override;
131  virtual void Redo() override;
132 
133 private:
135  sal_Int32 mnIndex;
138  bool mbUndo;
139 };
140 
141 
143 {
144 public:
145  RemoveColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
146  virtual ~RemoveColUndo() override;
147 
148  virtual void Undo() override;
149  virtual void Redo() override;
150 
151 private:
153  sal_Int32 mnIndex;
156  bool mbUndo;
157 };
158 
159 
161 {
162 public:
163  explicit TableColumnUndo( const TableColumnRef& xCol );
164  virtual ~TableColumnUndo() override;
165 
166  virtual void Undo() override;
167  virtual void Redo() override;
168  virtual bool Merge( SfxUndoAction *pNextAction ) override;
169 
170 private:
171  struct Data
172  {
173  sal_Int32 mnColumn;
174  sal_Int32 mnWidth;
178  OUString maName;
179 
181  : mnColumn(0)
182  , mnWidth(0)
183  , mbOptimalWidth(false)
184  , mbIsVisible(false)
185  , mbIsStartOfNewPage(false)
186  {
187  }
188  };
189 
190  void setData( const Data& rData );
191  void getData( Data& rData );
192 
197 };
198 
199 
201 {
202 public:
203  explicit TableRowUndo( const TableRowRef& xRow );
204  virtual ~TableRowUndo() override;
205 
206  virtual void Undo() override;
207  virtual void Redo() override;
208  virtual bool Merge( SfxUndoAction *pNextAction ) override;
209 
210 private:
211  struct Data
212  {
213  sal_Int32 mnRow;
214  sal_Int32 mnHeight;
218  OUString maName;
219  };
220 
221  void setData( const Data& rData );
222  void getData( Data& rData );
223 
228 };
229 
231 {
232 public:
233  explicit TableStyleUndo( const SdrTableObj& rTableObj );
234 
235  virtual void Undo() override;
236  virtual void Redo() override;
237 
238 private:
240 
241  struct Data
242  {
244  css::uno::Reference< css::container::XIndexAccess > mxTableStyle;
245  };
246 
247  void setData( const Data& rData );
248  void getData( Data& rData );
249 
253 };
254 
255 }
256 
257 #endif
258 
259 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: tableundo.cxx:375
sal_Int32 nIndex
virtual ~RemoveColUndo() override
Definition: tableundo.cxx:311
std::vector< TableRowRef > RowVector
Definition: celltypes.hxx:39
InsertColUndo(const TableModelRef &xTable, sal_Int32 nIndex, ColumnVector &aNewCols, CellVector &aCells)
Definition: tableundo.cxx:256
RemoveColUndo(const TableModelRef &xTable, sal_Int32 nIndex, ColumnVector &aNewCols, CellVector &aCells)
Definition: tableundo.cxx:300
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: tableundo.cxx:441
TableStyleSettings maSettings
Definition: tableundo.hxx:243
Abstract base class (ABC) for all UndoActions of DrawingEngine.
Definition: svdundo.hxx:54
InsertRowUndo(const TableModelRef &xTable, sal_Int32 nIndex, RowVector &aNewRows)
Definition: tableundo.cxx:162
virtual ~InsertRowUndo() override
Definition: tableundo.cxx:172
virtual void Undo() override
Definition: tableundo.cxx:179
virtual void Redo() override
Definition: tableundo.cxx:331
virtual void Redo() override
Definition: tableundo.cxx:189
virtual void ObjectInDestruction(const SdrObject &rObject) override
Definition: tableundo.cxx:70
virtual void Redo() override
Definition: tableundo.cxx:87
TableStyleUndo(const SdrTableObj &rTableObj)
Definition: tableundo.cxx:473
RemoveRowUndo(const TableModelRef &xTable, sal_Int32 nIndex, RowVector &aRemovedRows)
Definition: tableundo.cxx:202
uno::Reference< sdbc::XRow > xRow
virtual void Undo() override
Definition: tableundo.cxx:219
void setData(const Data &rData)
Definition: tableundo.cxx:382
sdr::properties::TextProperties * mpProperties
Definition: tableundo.hxx:57
std::vector< TableColumnRef > ColumnVector
Definition: celltypes.hxx:40
virtual void Undo() override
Definition: tableundo.cxx:75
virtual ~RemoveRowUndo() override
Definition: tableundo.cxx:212
virtual void Redo() override
Definition: tableundo.cxx:287
CellUndo(const tools::WeakReference< SdrObject > &xObjRef, const CellRef &xCell)
Definition: tableundo.cxx:37
virtual void Redo() override
Definition: tableundo.cxx:229
tools::WeakReference< SdrObject > mxObjRef
Definition: tableundo.hxx:82
std::vector< CellRef > CellVector
Definition: celltypes.hxx:38
tools::WeakReference< SdrTableObj > mxObjRef
Definition: tableundo.hxx:239
OutlinerParaObject * mpOutlinerParaObject
Definition: tableundo.hxx:58
virtual void Undo() override
Definition: tableundo.cxx:321
virtual void Undo() override
Definition: tableundo.cxx:481
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual void Undo() override
Definition: tableundo.cxx:277
virtual void Redo() override
Definition: tableundo.cxx:369
virtual ~TableRowUndo() override
Definition: tableundo.cxx:419
virtual void Undo() override
Definition: tableundo.cxx:424
void getData(Data &rData)
Definition: tableundo.cxx:396
TableColumnUndo(const TableColumnRef &xCol)
Definition: tableundo.cxx:344
virtual bool Merge(SfxUndoAction *pNextAction) override
Definition: tableundo.cxx:96
virtual void Redo() override
Definition: tableundo.cxx:435
void setDataToCell(const Data &rData)
Definition: tableundo.cxx:102
void getData(Data &rData)
Definition: tableundo.cxx:506
void setData(const Data &rData)
Definition: tableundo.cxx:496
TableRowUndo(const TableRowRef &xRow)
Definition: tableundo.cxx:410
void setData(const Data &rData)
Definition: tableundo.cxx:448
virtual ~CellUndo() override
Definition: tableundo.cxx:50
TableStyleSettings.
Definition: svdotable.hxx:75
void getData(Data &rData)
Definition: tableundo.cxx:462
void getDataFromCell(Data &rData)
Definition: tableundo.cxx:130
virtual void Undo() override
Definition: tableundo.cxx:358
css::uno::Reference< css::container::XIndexAccess > mxTableStyle
Definition: tableundo.hxx:244
virtual void Redo() override
Definition: tableundo.cxx:491
virtual ~InsertColUndo() override
Definition: tableundo.cxx:267
virtual ~TableColumnUndo() override
Definition: tableundo.cxx:353