tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / undodat.hxx
blob5060bf0c1059c5733231e296879c984ac01a9976
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 #pragma once
22 #include "undobase.hxx"
23 #include "refundo.hxx"
24 #include <dpobject.hxx>
25 #include <olinetab.hxx>
26 #include <rangeutl.hxx>
27 #include <rangelst.hxx>
28 #include <queryparam.hxx>
29 #include <subtotalparam.hxx>
31 #include <memory>
33 class ScDocShell;
34 class SdrUndoAction;
36 class ScUndoDoOutline: public ScSimpleUndo
38 public:
39 ScUndoDoOutline( ScDocShell* pNewDocShell,
40 SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab,
41 ScDocumentUniquePtr pNewUndoDoc, bool bNewColumns,
42 sal_uInt16 nNewLevel, sal_uInt16 nNewEntry, bool bNewShow );
43 virtual ~ScUndoDoOutline() override;
45 virtual void Undo() override;
46 virtual void Redo() override;
47 virtual void Repeat(SfxRepeatTarget& rTarget) override;
48 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
50 virtual OUString GetComment() const override;
52 private:
53 SCCOLROW nStart;
54 SCCOLROW nEnd;
55 SCTAB nTab;
56 ScDocumentUniquePtr
57 pUndoDoc;
58 bool bColumns;
59 sal_uInt16 nLevel;
60 sal_uInt16 nEntry;
61 bool bShow;
64 class ScUndoMakeOutline: public ScSimpleUndo
66 public:
67 ScUndoMakeOutline( ScDocShell* pNewDocShell,
68 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
69 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
70 std::unique_ptr<ScOutlineTable> pNewUndoTab,
71 bool bNewColumns, bool bNewMake );
72 virtual ~ScUndoMakeOutline() override;
74 virtual void Undo() override;
75 virtual void Redo() override;
76 virtual void Repeat(SfxRepeatTarget& rTarget) override;
77 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
79 virtual OUString GetComment() const override;
81 private:
82 ScAddress aBlockStart;
83 ScAddress aBlockEnd;
84 std::unique_ptr<ScOutlineTable>
85 pUndoTable;
86 bool bColumns;
87 bool bMake;
90 class ScUndoOutlineLevel: public ScSimpleUndo
92 public:
93 ScUndoOutlineLevel(ScDocShell* pNewDocShell,
94 SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab,
95 ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab,
96 bool bNewColumns, sal_uInt16 nNewLevel);
98 virtual void Undo() override;
99 virtual void Redo() override;
100 virtual void Repeat(SfxRepeatTarget& rTarget) override;
101 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
103 virtual OUString GetComment() const override;
105 private:
106 SCCOLROW nStart;
107 SCCOLROW nEnd;
108 SCTAB nTab;
109 ScDocumentUniquePtr xUndoDoc;
110 std::unique_ptr<ScOutlineTable> xUndoTable;
111 bool bColumns;
112 sal_uInt16 nLevel;
115 class ScUndoOutlineBlock: public ScSimpleUndo
117 public:
118 ScUndoOutlineBlock(ScDocShell* pNewDocShell,
119 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
120 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
121 ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab,
122 bool bNewShow);
124 virtual void Undo() override;
125 virtual void Redo() override;
126 virtual void Repeat(SfxRepeatTarget& rTarget) override;
127 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
129 virtual OUString GetComment() const override;
131 private:
132 ScAddress aBlockStart;
133 ScAddress aBlockEnd;
134 ScDocumentUniquePtr xUndoDoc;
135 std::unique_ptr<ScOutlineTable> xUndoTable;
136 bool bShow;
139 class ScUndoRemoveAllOutlines: public ScSimpleUndo
141 public:
142 ScUndoRemoveAllOutlines(ScDocShell* pNewDocShell,
143 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
144 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
145 ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab);
147 virtual void Undo() override;
148 virtual void Redo() override;
149 virtual void Repeat(SfxRepeatTarget& rTarget) override;
150 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
152 virtual OUString GetComment() const override;
154 private:
155 ScAddress aBlockStart;
156 ScAddress aBlockEnd;
157 ScDocumentUniquePtr xUndoDoc;
158 std::unique_ptr<ScOutlineTable> xUndoTable;
161 class ScUndoAutoOutline: public ScSimpleUndo
163 public:
164 ScUndoAutoOutline(ScDocShell* pNewDocShell,
165 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
166 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
167 ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab);
169 virtual void Undo() override;
170 virtual void Redo() override;
171 virtual void Repeat(SfxRepeatTarget& rTarget) override;
172 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
174 virtual OUString GetComment() const override;
176 private:
177 ScAddress aBlockStart;
178 ScAddress aBlockEnd;
179 ScDocumentUniquePtr xUndoDoc;
180 std::unique_ptr<ScOutlineTable> xUndoTable;
183 class ScUndoSubTotals: public ScDBFuncUndo
185 public:
186 ScUndoSubTotals(ScDocShell* pNewDocShell, SCTAB nNewTab,
187 const ScSubTotalParam& rNewParam, SCROW nNewEndY,
188 ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab,
189 std::unique_ptr<ScRangeName> pNewUndoRange, std::unique_ptr<ScDBCollection> pNewUndoDB);
191 virtual void Undo() override;
192 virtual void Redo() override;
193 virtual void Repeat(SfxRepeatTarget& rTarget) override;
194 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
196 virtual OUString GetComment() const override;
198 private:
199 SCTAB nTab;
200 ScSubTotalParam aParam; // The original passed parameter
201 SCROW nNewEndRow; // Size of result
202 ScDocumentUniquePtr xUndoDoc;
203 std::unique_ptr<ScOutlineTable> xUndoTable;
204 std::unique_ptr<ScRangeName> xUndoRange;
205 std::unique_ptr<ScDBCollection> xUndoDB;
208 class ScUndoQuery: public ScDBFuncUndo
210 public:
211 ScUndoQuery( ScDocShell* pNewDocShell, SCTAB nNewTab,
212 const ScQueryParam& rParam, ScDocumentUniquePtr pNewUndoDoc,
213 std::unique_ptr<ScDBCollection> pNewUndoDB, const ScRange* pOld,
214 bool bSize, const ScRange* pAdvSrc );
215 virtual ~ScUndoQuery() override;
217 virtual void Undo() override;
218 virtual void Redo() override;
219 virtual void Repeat(SfxRepeatTarget& rTarget) override;
220 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
222 virtual OUString GetComment() const override;
224 private:
225 std::unique_ptr<SdrUndoAction> pDrawUndo;
226 SCTAB nTab;
227 ScQueryParam aQueryParam;
228 ScDocumentUniquePtr xUndoDoc;
229 std::unique_ptr<ScDBCollection> xUndoDB; // due to source and target range
230 ScRange aOldDest;
231 ScRange aAdvSource;
232 bool bIsAdvanced;
233 bool bDestArea;
234 bool bDoSize;
237 class ScUndoAutoFilter: public ScDBFuncUndo
239 private:
240 OUString aDBName;
241 bool bFilterSet;
243 void DoChange( bool bUndo );
245 public:
246 ScUndoAutoFilter( ScDocShell* pNewDocShell, const ScRange& rRange,
247 OUString aName, bool bSet );
248 virtual ~ScUndoAutoFilter() override;
250 virtual void Undo() override;
251 virtual void Redo() override;
252 virtual void Repeat(SfxRepeatTarget& rTarget) override;
253 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
255 virtual OUString GetComment() const override;
258 class ScUndoDBData: public ScSimpleUndo
260 public:
261 ScUndoDBData( ScDocShell* pNewDocShell,
262 std::unique_ptr<ScDBCollection> pNewUndoColl,
263 std::unique_ptr<ScDBCollection> pNewRedoColl );
264 virtual ~ScUndoDBData() override;
266 virtual void Undo() override;
267 virtual void Redo() override;
268 virtual void Repeat(SfxRepeatTarget& rTarget) override;
269 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
271 virtual OUString GetComment() const override;
273 private:
274 std::unique_ptr<ScDBCollection> pUndoColl;
275 std::unique_ptr<ScDBCollection> pRedoColl;
278 class ScUndoImportData: public ScSimpleUndo
280 public:
281 ScUndoImportData(ScDocShell* pNewDocShell, SCTAB nNewTab,
282 const ScImportParam& rParam, SCCOL nNewEndX, SCROW nNewEndY,
283 SCCOL nNewFormula,
284 ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
285 std::unique_ptr<ScDBData> pNewUndoData, std::unique_ptr<ScDBData> pNewRedoData);
287 virtual void Undo() override;
288 virtual void Redo() override;
289 virtual void Repeat(SfxRepeatTarget& rTarget) override;
290 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
292 virtual OUString GetComment() const override;
294 private:
295 SCTAB nTab;
296 ScImportParam aImportParam;
297 SCCOL nEndCol;
298 SCROW nEndRow;
299 ScDocumentUniquePtr xUndoDoc;
300 ScDocumentUniquePtr xRedoDoc;
301 std::unique_ptr<ScDBData> xUndoDBData;
302 std::unique_ptr<ScDBData> xRedoDBData;
303 SCCOL nFormulaCols;
304 bool bRedoFilled;
307 class ScUndoRepeatDB: public ScSimpleUndo
309 public:
310 ScUndoRepeatDB(ScDocShell* pNewDocShell, SCTAB nNewTab,
311 SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY,
312 SCROW nResultEndRow, SCCOL nCurX, SCROW nCurY,
313 ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab,
314 std::unique_ptr<ScRangeName> pNewUndoRange, std::unique_ptr<ScDBCollection> pNewUndoDB,
315 const ScRange* pOldQ, const ScRange* pNewQ);
317 virtual void Undo() override;
318 virtual void Redo() override;
319 virtual void Repeat(SfxRepeatTarget& rTarget) override;
320 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
322 virtual OUString GetComment() const override;
324 private:
325 ScAddress aBlockStart;
326 ScAddress aBlockEnd;
327 SCROW nNewEndRow;
328 ScAddress aCursorPos;
329 ScDocumentUniquePtr xUndoDoc;
330 std::unique_ptr<ScOutlineTable> xUndoTable;
331 std::unique_ptr<ScRangeName> xUndoRange;
332 std::unique_ptr<ScDBCollection> xUndoDB;
333 ScRange aOldQuery;
334 ScRange aNewQuery;
335 bool bQuerySize;
338 class ScUndoDataPilot: public ScSimpleUndo
340 public:
341 ScUndoDataPilot(ScDocShell* pNewDocShell,
342 ScDocumentUniquePtr pOldDoc, ScDocumentUniquePtr pNewDoc,
343 const ScDPObject* pOldObj, const ScDPObject* pNewObj,
344 bool bMove);
346 virtual void Undo() override;
347 virtual void Redo() override;
348 virtual void Repeat(SfxRepeatTarget& rTarget) override;
349 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
351 virtual OUString GetComment() const override;
353 private:
354 ScDocumentUniquePtr xOldUndoDoc;
355 ScDocumentUniquePtr xNewUndoDoc;
356 std::unique_ptr<ScDPObject> xOldDPObject;
357 std::unique_ptr<ScDPObject> xNewDPObject;
358 bool bAllowMove;
361 class ScUndoConsolidate: public ScSimpleUndo
363 public:
364 ScUndoConsolidate(ScDocShell* pNewDocShell,
365 const ScArea& rArea, const ScConsolidateParam& rPar,
366 ScDocumentUniquePtr pNewUndoDoc, bool bReference,
367 SCROW nInsCount, std::unique_ptr<ScOutlineTable> pTab,
368 std::unique_ptr<ScDBData> pData);
370 virtual void Undo() override;
371 virtual void Redo() override;
372 virtual void Repeat(SfxRepeatTarget& rTarget) override;
373 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
375 virtual OUString GetComment() const override;
377 private:
378 ScArea aDestArea;
379 ScDocumentUniquePtr xUndoDoc;
380 ScConsolidateParam aParam;
381 bool bInsRef;
382 SCSIZE nInsertCount;
383 std::unique_ptr<ScOutlineTable> xUndoTab;
384 std::unique_ptr<ScDBData> xUndoData;
387 class ScUndoChartData: public ScSimpleUndo
389 public:
390 ScUndoChartData( ScDocShell* pNewDocShell,
391 OUString aName, const ScRange& rNew,
392 bool bColHdr, bool bRowHdr, bool bAdd );
393 ScUndoChartData( ScDocShell* pNewDocShell,
394 OUString aName, ScRangeListRef xNew,
395 bool bColHdr, bool bRowHdr, bool bAdd );
396 virtual ~ScUndoChartData() override;
398 virtual void Undo() override;
399 virtual void Redo() override;
400 virtual void Repeat(SfxRepeatTarget& rTarget) override;
401 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
403 virtual OUString GetComment() const override;
405 private:
406 OUString aChartName;
407 ScRangeListRef aOldRangeListRef;
408 bool bOldColHeaders;
409 bool bOldRowHeaders;
410 // ScRange aNewRange;
411 ScRangeListRef aNewRangeListRef;
412 bool bNewColHeaders;
413 bool bNewRowHeaders;
414 bool bAddRange;
416 void Init();
419 class ScUndoDataForm: public ScBlockUndo
421 public:
422 ScUndoDataForm(ScDocShell* pNewDocShell,
423 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
424 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
425 const ScMarkData& rMark,
426 ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
427 std::unique_ptr<ScRefUndoData> pRefData);
428 virtual void Undo() override;
429 virtual void Redo() override;
430 virtual void Repeat(SfxRepeatTarget& rTarget) override;
431 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
433 virtual OUString GetComment() const override;
435 private:
436 std::unique_ptr<ScMarkData> mxMarkData;
437 ScDocumentUniquePtr xUndoDoc;
438 ScDocumentUniquePtr xRedoDoc;
439 std::unique_ptr<ScRefUndoData> xRefUndoData;
440 std::unique_ptr<ScRefUndoData> xRefRedoData;
441 bool bRedoFilled;
443 void DoChange( const bool bUndo );
446 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */