1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
25 #include <sdr/properties/cellproperties.hxx>
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::properties
{
37 class OutlinerParaObject
;
40 namespace sdr::table
{
42 class CellUndo
: public SdrUndoAction
, public sdr::ObjectUser
45 CellUndo( SdrObject
* pObj
, const CellRef
& xCell
);
46 virtual ~CellUndo() override
;
48 virtual void Undo() override
;
49 virtual void Redo() override
;
50 virtual bool Merge( SfxUndoAction
*pNextAction
) override
;
53 virtual void ObjectInDestruction(const SdrObject
& rObject
) override
;
58 std::unique_ptr
<sdr::properties::CellProperties
> mxProperties
;
59 std::optional
<OutlinerParaObject
> mpOutlinerParaObject
;
65 ::sal_Int32 mnRowSpan
;
66 ::sal_Int32 mnColSpan
;
78 void setDataToCell( const Data
& rData
);
79 void getDataFromCell( Data
& rData
);
81 unotools::WeakReference
<SdrObject
> mxObjRef
;
89 class InsertRowUndo
: public SdrUndoAction
92 InsertRowUndo( const TableModelRef
& xTable
, sal_Int32 nIndex
, RowVector
& aNewRows
);
93 virtual ~InsertRowUndo() override
;
95 virtual void Undo() override
;
96 virtual void Redo() override
;
99 TableModelRef mxTable
;
106 class RemoveRowUndo
: public SdrUndoAction
109 RemoveRowUndo( const TableModelRef
& xTable
, sal_Int32 nIndex
, RowVector
& aRemovedRows
);
110 virtual ~RemoveRowUndo() override
;
112 virtual void Undo() override
;
113 virtual void Redo() override
;
116 TableModelRef mxTable
;
123 class InsertColUndo
: public SdrUndoAction
126 InsertColUndo( const TableModelRef
& xTable
, sal_Int32 nIndex
, ColumnVector
& aNewCols
, CellVector
& aCells
);
127 virtual ~InsertColUndo() override
;
129 virtual void Undo() override
;
130 virtual void Redo() override
;
133 TableModelRef mxTable
;
135 ColumnVector maColumns
;
141 class RemoveColUndo
: public SdrUndoAction
144 RemoveColUndo( const TableModelRef
& xTable
, sal_Int32 nIndex
, ColumnVector
& aNewCols
, CellVector
& aCells
);
145 virtual ~RemoveColUndo() override
;
147 virtual void Undo() override
;
148 virtual void Redo() override
;
151 TableModelRef mxTable
;
153 ColumnVector maColumns
;
159 class TableColumnUndo
: public SdrUndoAction
162 explicit TableColumnUndo( const TableColumnRef
& xCol
);
163 virtual ~TableColumnUndo() override
;
165 virtual void Undo() override
;
166 virtual void Redo() override
;
167 virtual bool Merge( SfxUndoAction
*pNextAction
) override
;
176 bool mbIsStartOfNewPage
;
182 , mbOptimalWidth(false)
184 , mbIsStartOfNewPage(false)
189 void setData( const Data
& rData
);
190 void getData( Data
& rData
);
192 TableColumnRef mxCol
;
199 class TableRowUndo
: public SdrUndoAction
202 explicit TableRowUndo( const TableRowRef
& xRow
);
203 virtual ~TableRowUndo() override
;
205 virtual void Undo() override
;
206 virtual void Redo() override
;
207 virtual bool Merge( SfxUndoAction
*pNextAction
) override
;
214 bool mbOptimalHeight
;
216 bool mbIsStartOfNewPage
;
220 void setData( const Data
& rData
);
221 void getData( Data
& rData
);
229 class TableStyleUndo
: public SdrUndoAction
232 explicit TableStyleUndo( const SdrTableObj
& rTableObj
);
234 virtual void Undo() override
;
235 virtual void Redo() override
;
238 unotools::WeakReference
<SdrTableObj
> mxObjRef
;
242 TableStyleSettings maSettings
;
243 css::uno::Reference
< css::container::XIndexAccess
> mxTableStyle
;
246 void setData( const Data
& rData
);
247 void getData( Data
& rData
);
258 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */