summaryrefslogtreecommitdiffstats
path: root/sc/source/ui/inc/undo
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sc/source/ui/inc/undo/UndoDeleteSparkline.hxx43
-rw-r--r--sc/source/ui/inc/undo/UndoDeleteSparklineGroup.hxx45
-rw-r--r--sc/source/ui/inc/undo/UndoEditSparkline.hxx47
-rw-r--r--sc/source/ui/inc/undo/UndoEditSparklineGroup.hxx44
-rw-r--r--sc/source/ui/inc/undo/UndoGroupSparklines.hxx56
-rw-r--r--sc/source/ui/inc/undo/UndoInsertSparkline.hxx45
-rw-r--r--sc/source/ui/inc/undo/UndoUngroupSparklines.hxx54
-rw-r--r--sc/source/ui/inc/undobase.hxx178
-rw-r--r--sc/source/ui/inc/undoblk.hxx983
-rw-r--r--sc/source/ui/inc/undocell.hxx369
-rw-r--r--sc/source/ui/inc/undoconvert.hxx33
-rw-r--r--sc/source/ui/inc/undodat.hxx446
-rw-r--r--sc/source/ui/inc/undodraw.hxx52
-rw-r--r--sc/source/ui/inc/undoolk.hxx32
-rw-r--r--sc/source/ui/inc/undosort.hxx34
-rw-r--r--sc/source/ui/inc/undostyl.hxx102
-rw-r--r--sc/source/ui/inc/undotab.hxx471
-rw-r--r--sc/source/ui/inc/undoutil.hxx50
18 files changed, 3084 insertions, 0 deletions
diff --git a/sc/source/ui/inc/undo/UndoDeleteSparkline.hxx b/sc/source/ui/inc/undo/UndoDeleteSparkline.hxx
new file mode 100644
index 000000000..97fcd77d9
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoDeleteSparkline.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <undobase.hxx>
+#include <address.hxx>
+#include <memory>
+
+namespace sc
+{
+class SparklineGroup;
+struct SparklineData;
+
+/** Undo action for deleting a Sparkline */
+class UndoDeleteSparkline : public ScSimpleUndo
+{
+private:
+ std::shared_ptr<sc::SparklineGroup> mpSparklineGroup;
+ ScAddress maSparklinePosition;
+
+public:
+ UndoDeleteSparkline(ScDocShell& rDocShell, ScAddress const& rSparklinePosition);
+
+ virtual ~UndoDeleteSparkline() override;
+
+ void Undo() override;
+ void Redo() override;
+ bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+ void Repeat(SfxRepeatTarget& rTarget) override;
+ OUString GetComment() const override;
+};
+
+} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undo/UndoDeleteSparklineGroup.hxx b/sc/source/ui/inc/undo/UndoDeleteSparklineGroup.hxx
new file mode 100644
index 000000000..081a741ab
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoDeleteSparklineGroup.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <undobase.hxx>
+#include <address.hxx>
+#include <memory>
+
+namespace sc
+{
+class SparklineGroup;
+
+/** Undo action for deleting a sparkline group and all associated sparklines */
+class UndoDeleteSparklineGroup : public ScSimpleUndo
+{
+private:
+ std::shared_ptr<sc::SparklineGroup> mpSparklineGroup;
+ std::vector<std::shared_ptr<sc::Sparkline>> maSparklines;
+ SCTAB mnTab;
+
+public:
+ UndoDeleteSparklineGroup(ScDocShell& rDocShell,
+ std::shared_ptr<sc::SparklineGroup> const& pSparklineGroup,
+ SCTAB nSheetIndex);
+
+ virtual ~UndoDeleteSparklineGroup() override;
+
+ void Undo() override;
+ void Redo() override;
+ bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+ void Repeat(SfxRepeatTarget& rTarget) override;
+ OUString GetComment() const override;
+};
+
+} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undo/UndoEditSparkline.hxx b/sc/source/ui/inc/undo/UndoEditSparkline.hxx
new file mode 100644
index 000000000..4e33eaa1f
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoEditSparkline.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <undobase.hxx>
+#include <address.hxx>
+#include <rangelst.hxx>
+#include <memory>
+
+namespace sc
+{
+class Sparkline;
+struct SparklineData;
+
+/** Undo action for editing a Sparkline */
+class UndoEditSparkline : public ScSimpleUndo
+{
+private:
+ std::shared_ptr<sc::Sparkline> mpSparkline;
+ SCTAB mnTab;
+ ScRangeList maOldDataRange;
+ ScRangeList maNewDataRange;
+
+public:
+ UndoEditSparkline(ScDocShell& rDocShell, std::shared_ptr<sc::Sparkline> const& rpSparkline,
+ SCTAB nTab, ScRangeList const& rDataRange);
+
+ virtual ~UndoEditSparkline() override;
+
+ void Undo() override;
+ void Redo() override;
+ bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+ void Repeat(SfxRepeatTarget& rTarget) override;
+ OUString GetComment() const override;
+};
+
+} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undo/UndoEditSparklineGroup.hxx b/sc/source/ui/inc/undo/UndoEditSparklineGroup.hxx
new file mode 100644
index 000000000..4ab3e6a4e
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoEditSparklineGroup.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <undobase.hxx>
+#include <memory>
+
+#include <SparklineAttributes.hxx>
+#include <SparklineGroup.hxx>
+
+namespace sc
+{
+/** Undo action for editing a Sparkline */
+class UndoEditSparklneGroup : public ScSimpleUndo
+{
+private:
+ std::shared_ptr<sc::SparklineGroup> m_pSparklineGroup;
+ sc::SparklineAttributes m_aNewAttributes;
+ sc::SparklineAttributes m_aOriginalAttributes;
+
+public:
+ UndoEditSparklneGroup(ScDocShell& rDocShell,
+ std::shared_ptr<sc::SparklineGroup> const& rSparklineGroup,
+ sc::SparklineAttributes const& rAttributes);
+ virtual ~UndoEditSparklneGroup() override;
+
+ void Undo() override;
+ void Redo() override;
+ bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+ void Repeat(SfxRepeatTarget& rTarget) override;
+ OUString GetComment() const override;
+};
+
+} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undo/UndoGroupSparklines.hxx b/sc/source/ui/inc/undo/UndoGroupSparklines.hxx
new file mode 100644
index 000000000..bcbc470bc
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoGroupSparklines.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <undobase.hxx>
+#include <memory>
+
+namespace sc
+{
+/** Previous sparkline group data, which is restored at Undo grouping */
+struct UndoGroupSparklinesData
+{
+ UndoGroupSparklinesData(ScAddress const& rAddress, ScRangeList const& rDataRangeList,
+ std::shared_ptr<sc::SparklineGroup> const& rpGroup)
+ : m_aAddress(rAddress)
+ , m_aDataRangeList(rDataRangeList)
+ , m_pSparklineGroup(rpGroup)
+ {
+ }
+
+ ScAddress m_aAddress;
+ ScRangeList m_aDataRangeList;
+ std::shared_ptr<sc::SparklineGroup> m_pSparklineGroup;
+};
+
+/** Undo action for grouping sparklines */
+class UndoGroupSparklines : public ScSimpleUndo
+{
+private:
+ ScRange m_aRange;
+ std::shared_ptr<sc::SparklineGroup> m_pSparklineGroup;
+ std::vector<UndoGroupSparklinesData> m_aUndoData;
+
+public:
+ UndoGroupSparklines(ScDocShell& rDocShell, ScRange const& rRange,
+ std::shared_ptr<sc::SparklineGroup> const& rpSparklineGroup);
+ virtual ~UndoGroupSparklines() override;
+
+ void Undo() override;
+ void Redo() override;
+ bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+ void Repeat(SfxRepeatTarget& rTarget) override;
+ OUString GetComment() const override;
+};
+
+} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undo/UndoInsertSparkline.hxx b/sc/source/ui/inc/undo/UndoInsertSparkline.hxx
new file mode 100644
index 000000000..d9e1885f1
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoInsertSparkline.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <undobase.hxx>
+#include <address.hxx>
+#include <memory>
+
+namespace sc
+{
+class SparklineGroup;
+struct SparklineData;
+
+/** Undo action for inserting a Sparkline */
+class UndoInsertSparkline : public ScSimpleUndo
+{
+private:
+ std::vector<sc::SparklineData> maSparklineDataVector;
+ std::shared_ptr<sc::SparklineGroup> mpSparklineGroup;
+
+public:
+ UndoInsertSparkline(ScDocShell& rDocShell,
+ std::vector<SparklineData> const& rSparklineDataVector,
+ std::shared_ptr<sc::SparklineGroup> pSparklineGroup);
+
+ virtual ~UndoInsertSparkline() override;
+
+ void Undo() override;
+ void Redo() override;
+ bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+ void Repeat(SfxRepeatTarget& rTarget) override;
+ OUString GetComment() const override;
+};
+
+} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undo/UndoUngroupSparklines.hxx b/sc/source/ui/inc/undo/UndoUngroupSparklines.hxx
new file mode 100644
index 000000000..ce49d701e
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoUngroupSparklines.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <undobase.hxx>
+#include <memory>
+
+namespace sc
+{
+/** Previous sparkline group data, which is restored at undo ungroupping */
+struct SparklineUndoData
+{
+ SparklineUndoData(ScAddress const& rAddress, ScRangeList const& rDataRangeList,
+ std::shared_ptr<sc::SparklineGroup> const& rpGroup)
+ : m_aAddress(rAddress)
+ , m_aDataRangeList(rDataRangeList)
+ , m_pSparklineGroup(rpGroup)
+ {
+ }
+
+ ScAddress m_aAddress;
+ ScRangeList m_aDataRangeList;
+ std::shared_ptr<sc::SparklineGroup> m_pSparklineGroup;
+};
+
+/** Undo action for ungrouping sparklines */
+class UndoUngroupSparklines : public ScSimpleUndo
+{
+private:
+ ScRange m_aRange;
+ std::vector<SparklineUndoData> m_aUndoData;
+
+public:
+ UndoUngroupSparklines(ScDocShell& rDocShell, ScRange const& rRange);
+ virtual ~UndoUngroupSparklines() override;
+
+ void Undo() override;
+ void Redo() override;
+ bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+ void Repeat(SfxRepeatTarget& rTarget) override;
+ OUString GetComment() const override;
+};
+
+} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx
new file mode 100644
index 000000000..4e07e6ae5
--- /dev/null
+++ b/sc/source/ui/inc/undobase.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svl/undo.hxx>
+#include <address.hxx>
+#include "docsh.hxx"
+
+#include <memory>
+#include <map>
+
+class SdrUndoAction;
+class ScRefUndoData;
+class ScDBData;
+
+class SC_DLLPUBLIC ScSimpleUndo: public SfxUndoAction
+{
+ ScSimpleUndo(const ScSimpleUndo&) = delete;
+
+public:
+ typedef std::map<SCTAB, std::unique_ptr<sc::ColumnSpanSet>> DataSpansType;
+
+ ScSimpleUndo( ScDocShell* pDocSh );
+
+ virtual bool Merge( SfxUndoAction *pNextAction ) override;
+ /// See SfxUndoAction::GetViewShellId().
+ ViewShellId GetViewShellId() const override;
+
+protected:
+ ScDocShell* pDocShell;
+ std::unique_ptr<SfxUndoAction>
+ pDetectiveUndo;
+ ViewShellId mnViewShellId;
+
+ bool IsPaintLocked() const { return pDocShell->IsPaintLocked(); }
+
+ bool SetViewMarkData( const ScMarkData& rMarkData );
+
+ void BeginUndo();
+ void EndUndo();
+ void BeginRedo();
+ void EndRedo();
+
+ void BroadcastChanges( const ScRange& rRange );
+
+ /**
+ * Broadcast changes on specified spans.
+ *
+ * @param rSpans container that specifies all spans whose changes need to
+ * be broadcasted.
+ */
+ void BroadcastChanges( const DataSpansType& rSpans );
+
+ static void ShowTable( SCTAB nTab );
+ static void ShowTable( const ScRange& rRange );
+};
+
+enum ScBlockUndoMode { SC_UNDO_SIMPLE, SC_UNDO_MANUALHEIGHT, SC_UNDO_AUTOHEIGHT };
+
+class ScBlockUndo: public ScSimpleUndo
+{
+public:
+ ScBlockUndo( ScDocShell* pDocSh, const ScRange& rRange,
+ ScBlockUndoMode eBlockMode );
+ virtual ~ScBlockUndo() override;
+
+protected:
+ ScRange aBlockRange;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+ ScBlockUndoMode eMode;
+
+ void BeginUndo();
+ void EndUndo();
+// void BeginRedo();
+ void EndRedo();
+
+ bool AdjustHeight();
+ void ShowBlock();
+};
+
+class SC_DLLPUBLIC ScMultiBlockUndo: public ScSimpleUndo
+{
+public:
+ ScMultiBlockUndo(ScDocShell* pDocSh, const ScRangeList& rRanges);
+ virtual ~ScMultiBlockUndo() override;
+
+protected:
+ ScRangeList maBlockRanges;
+ std::unique_ptr<SdrUndoAction> mpDrawUndo;
+
+ void BeginUndo();
+ void EndUndo();
+ void EndRedo();
+
+ void ShowBlock();
+};
+
+// for functions that act on a database range - takes care of the unnamed database range
+// (collected separately, before the undo action, for showing dialogs etc.)
+
+class ScDBFuncUndo: public ScSimpleUndo
+{
+protected:
+ std::unique_ptr<ScDBData> pAutoDBRange;
+ ScRange aOriginalRange;
+
+public:
+ ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal );
+ virtual ~ScDBFuncUndo() override;
+
+ void BeginUndo();
+ void EndUndo();
+ void BeginRedo();
+ void EndRedo();
+};
+
+class ScMoveUndo: public ScSimpleUndo // with references
+{
+public:
+ ScMoveUndo( ScDocShell* pDocSh,
+ ScDocumentUniquePtr pRefDoc, std::unique_ptr<ScRefUndoData> pRefData );
+ virtual ~ScMoveUndo() override;
+
+protected:
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+ ScDocumentUniquePtr pRefUndoDoc;
+ std::unique_ptr<ScRefUndoData> pRefUndoData;
+
+ void BeginUndo();
+ void EndUndo();
+// void BeginRedo();
+// void EndRedo();
+
+private:
+ void UndoRef();
+};
+
+class ScUndoWrapper: public SfxUndoAction // for manual merging of actions
+{
+ std::unique_ptr<SfxUndoAction> pWrappedUndo;
+ ViewShellId mnViewShellId;
+
+public:
+ ScUndoWrapper( std::unique_ptr<SfxUndoAction> pUndo );
+ virtual ~ScUndoWrapper() override;
+
+ SfxUndoAction* GetWrappedUndo() { return pWrappedUndo.get(); }
+ void ForgetWrappedUndo();
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+ virtual bool Merge( SfxUndoAction *pNextAction ) override;
+ virtual OUString GetComment() const override;
+ virtual OUString GetRepeatComment(SfxRepeatTarget&) const override;
+ /// See SfxUndoAction::GetViewShellId().
+ ViewShellId GetViewShellId() const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
new file mode 100644
index 000000000..a0de06cb6
--- /dev/null
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -0,0 +1,983 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include "undobase.hxx"
+#include <markdata.hxx>
+#include "spellparam.hxx"
+#include "cellmergeoption.hxx"
+#include <paramisc.hxx>
+#include <editeng/boxitem.hxx>
+
+#include <memory>
+
+class ScDocShell;
+class ScOutlineTable;
+class ScPatternAttr;
+class SvxSearchItem;
+class SdrUndoAction;
+class ScEditDataArray;
+
+class ScUndoInsertCells: public ScMoveUndo
+{
+public:
+ ScUndoInsertCells( ScDocShell* pNewDocShell,
+ const ScRange& rRange,
+ SCTAB nNewCount, std::unique_ptr<SCTAB[]> pNewTabs, std::unique_ptr<SCTAB[]> pNewScenarios,
+ InsCellCmd eNewCmd, ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData,
+ bool bNewPartOfPaste );
+ virtual ~ScUndoInsertCells() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat( SfxRepeatTarget& rTarget ) override;
+ virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const override;
+
+ virtual OUString GetComment() const override;
+
+ virtual bool Merge( SfxUndoAction *pNextAction ) override;
+
+private:
+ ScRange aEffRange;
+ SCTAB nCount;
+ std::unique_ptr<SCTAB[]>
+ pTabs;
+ std::unique_ptr<SCTAB[]>
+ pScenarios;
+ sal_uLong nEndChangeAction;
+ InsCellCmd eCmd;
+ bool bPartOfPaste;
+ std::unique_ptr<SfxUndoAction>
+ pPasteUndo;
+
+ void DoChange ( const bool bUndo );
+ void SetChangeTrack();
+};
+
+class ScUndoDeleteCells: public ScMoveUndo
+{
+public:
+ ScUndoDeleteCells( ScDocShell* pNewDocShell,
+ const ScRange& rRange,
+ SCTAB nNewCount, std::unique_ptr<SCTAB[]> pNewTabs, std::unique_ptr<SCTAB[]> pNewScenarios,
+ DelCellCmd eNewCmd, ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData );
+ virtual ~ScUndoDeleteCells() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScRange aEffRange;
+ SCTAB nCount;
+ std::unique_ptr<SCTAB[]>
+ pTabs;
+ std::unique_ptr<SCTAB[]>
+ pScenarios;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+ DelCellCmd eCmd;
+
+ void DoChange ( const bool bUndo );
+ void SetChangeTrack();
+};
+
+class ScUndoDeleteMulti: public ScMoveUndo
+{
+public:
+
+ ScUndoDeleteMulti( ScDocShell* pNewDocShell,
+ bool bNewRows, bool bNeedsRefresh, SCTAB nNewTab,
+ std::vector<sc::ColRowSpan>&& rSpans,
+ ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData );
+
+ virtual ~ScUndoDeleteMulti() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ bool mbRows:1;
+ bool mbRefresh:1;
+ SCTAB nTab;
+ std::vector<sc::ColRowSpan> maSpans;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+
+ void DoChange() const;
+ void SetChangeTrack();
+};
+
+class SC_DLLPUBLIC ScUndoCut: public ScBlockUndo
+{
+public:
+ ScUndoCut(ScDocShell* pNewDocShell,
+ const ScRange& aRange, // adjusted for merged cells
+ const ScAddress& aOldEnd, // end position without adjustment
+ const ScMarkData& rMark, // selected sheets
+ ScDocumentUniquePtr pNewUndoDoc);
+ virtual ~ScUndoCut() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr
+ pUndoDoc;
+ ScRange aExtendedRange;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+
+ void DoChange( const bool bUndo );
+ void SetChangeTrack();
+};
+
+struct ScUndoPasteOptions
+{
+ ScPasteFunc nFunction;
+ bool bSkipEmptyCells;
+ bool bTranspose;
+ bool bAsLink;
+ InsCellCmd eMoveMode;
+
+ ScUndoPasteOptions() :
+ nFunction( ScPasteFunc::NONE ),
+ bSkipEmptyCells( false ),
+ bTranspose( false ),
+ bAsLink( false ),
+ eMoveMode( INS_NONE )
+ {}
+};
+
+class SC_DLLPUBLIC ScUndoPaste: public ScMultiBlockUndo
+{
+public:
+ ScUndoPaste(ScDocShell* pNewDocShell, const ScRangeList& rRanges,
+ const ScMarkData& rMark,
+ ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
+ InsertDeleteFlags nNewFlags,
+ std::unique_ptr<ScRefUndoData> pRefData,
+ bool bRedoIsFilled = true,
+ const ScUndoPasteOptions* pOptions = nullptr);
+ virtual ~ScUndoPaste() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr pUndoDoc;
+ ScDocumentUniquePtr pRedoDoc;
+ InsertDeleteFlags nFlags;
+ std::unique_ptr<ScRefUndoData> pRefUndoData;
+ std::unique_ptr<ScRefUndoData> pRefRedoData;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+ bool bRedoFilled;
+ ScUndoPasteOptions aPasteOptions;
+
+ void DoChange(bool bUndo);
+ void SetChangeTrack();
+};
+
+class ScUndoDragDrop: public ScMoveUndo
+{
+public:
+ ScUndoDragDrop( ScDocShell* pNewDocShell,
+ const ScRange& rRange, const ScAddress& aNewDestPos, bool bNewCut,
+ ScDocumentUniquePtr pUndoDocument,
+ bool bScenario );
+ virtual ~ScUndoDragDrop() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ sal_uInt16 mnPaintExtFlags;
+ ScRangeList maPaintRanges;
+
+ ScRange aSrcRange;
+ ScRange aDestRange;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+ bool bCut;
+ bool bKeepScenarioFlags;
+
+ void PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const;
+ void DoUndo( ScRange aRange );
+
+ void SetChangeTrack();
+};
+
+class ScUndoDeleteContents: public ScSimpleUndo
+{
+public:
+ ScUndoDeleteContents( ScDocShell* pNewDocShell,
+ const ScMarkData& rMark,
+ const ScRange& rRange,
+ ScDocumentUniquePtr&& pNewUndoDoc, bool bNewMulti,
+ InsertDeleteFlags nNewFlags, bool bObjects );
+ virtual ~ScUndoDeleteContents() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+ void SetDataSpans( const std::shared_ptr<DataSpansType>& pSpans );
+
+private:
+ std::shared_ptr<DataSpansType> mpDataSpans; // Spans of non-empty cells.
+
+ ScRange aRange;
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr pUndoDoc; // Block mark and deleted data
+ std::unique_ptr<SdrUndoAction> pDrawUndo; // Deleted objects
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+ InsertDeleteFlags nFlags;
+ bool bMulti; // Multi selection
+
+ void DoChange( const bool bUndo );
+ void SetChangeTrack();
+};
+
+class ScUndoFillTable: public ScSimpleUndo
+{
+public:
+ ScUndoFillTable( ScDocShell* pNewDocShell,
+ const ScMarkData& rMark,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
+ ScDocumentUniquePtr pNewUndoDoc, bool bNewMulti, SCTAB nSrc,
+ InsertDeleteFlags nFlg, ScPasteFunc nFunc, bool bSkip, bool bLink );
+ virtual ~ScUndoFillTable() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScRange aRange;
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr
+ pUndoDoc; // Block mark and deleted data
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+ InsertDeleteFlags nFlags;
+ ScPasteFunc nFunction;
+ SCTAB nSrcTab;
+ bool bMulti; // Multi selection
+ bool bSkipEmpty;
+ bool bAsLink;
+
+ void DoChange( const bool bUndo );
+ void SetChangeTrack();
+};
+
+class ScUndoSelectionAttr: public ScSimpleUndo
+{
+public:
+ ScUndoSelectionAttr( ScDocShell* pNewDocShell,
+ const ScMarkData& rMark,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
+ ScDocumentUniquePtr pNewUndoDoc, bool bNewMulti,
+ const ScPatternAttr* pNewApply,
+ const SvxBoxItem* pNewOuter = nullptr,
+ const SvxBoxInfoItem* pNewInner = nullptr,
+ const ScRange* pRangeCover = nullptr );
+ virtual ~ScUndoSelectionAttr() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+ ScEditDataArray* GetDataArray();
+private:
+ ScMarkData aMarkData;
+ ScRange aRange;
+ ScRange aRangeCover;
+ std::unique_ptr<ScEditDataArray> mpDataArray;
+ ScDocumentUniquePtr pUndoDoc;
+ bool bMulti;
+ ScPatternAttr* pApplyPattern;
+ SvxBoxItem* pLineOuter;
+ SvxBoxInfoItem* pLineInner;
+
+ void DoChange( const bool bUndo );
+ void ChangeEditData( const bool bUndo );
+};
+
+class ScUndoWidthOrHeight: public ScSimpleUndo
+{
+public:
+ ScUndoWidthOrHeight( ScDocShell* pNewDocShell,
+ const ScMarkData& rMark,
+ SCCOLROW nNewStart, SCTAB nNewStartTab,
+ SCCOLROW nNewEnd, SCTAB nNewEndTab,
+ ScDocumentUniquePtr pNewUndoDoc,
+ std::vector<sc::ColRowSpan>&& rRanges,
+ std::unique_ptr<ScOutlineTable> pNewUndoTab,
+ ScSizeMode eNewMode, sal_uInt16 nNewSizeTwips,
+ bool bNewWidth );
+ virtual ~ScUndoWidthOrHeight() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScMarkData aMarkData;
+ SCCOLROW nStart;
+ SCCOLROW nEnd;
+ SCTAB nStartTab;
+ SCTAB nEndTab;
+ ScDocumentUniquePtr pUndoDoc;
+ std::unique_ptr<ScOutlineTable> pUndoTab;
+ std::vector<sc::ColRowSpan> maRanges;
+ sal_uInt16 nNewSize;
+ bool bWidth;
+ ScSizeMode eMode;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+};
+
+class ScUndoAutoFill: public ScBlockUndo
+{
+public:
+ ScUndoAutoFill( ScDocShell* pNewDocShell,
+ const ScRange& rRange, const ScRange& rSourceArea,
+ ScDocumentUniquePtr pNewUndoDoc, const ScMarkData& rMark,
+ FillDir eNewFillDir,
+ FillCmd eNewFillCmd, FillDateCmd eNewFillDateCmd,
+ double fNewStartValue, double fNewStepValue, double fNewMaxValue );
+ virtual ~ScUndoAutoFill() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScRange aSource;
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr
+ pUndoDoc;
+ FillDir eFillDir;
+ FillCmd eFillCmd;
+ FillDateCmd eFillDateCmd;
+ double fStartValue;
+ double fStepValue;
+ double fMaxValue;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+
+ void SetChangeTrack();
+};
+
+class ScUndoMerge: public ScSimpleUndo
+{
+public:
+ ScUndoMerge( ScDocShell* pNewDocShell, const ScCellMergeOption& rOption,
+ bool bMergeContents, ScDocumentUniquePtr pUndoDoc,
+ std::unique_ptr<SdrUndoAction> pDrawUndo);
+ virtual ~ScUndoMerge() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScCellMergeOption maOption;
+ bool mbMergeContents; // Merge contents in Redo().
+ ScDocumentUniquePtr mxUndoDoc; // when data is merged
+ std::unique_ptr<SdrUndoAction> mpDrawUndo;
+
+ void DoChange( bool bUndo ) const;
+};
+
+class ScUndoAutoFormat: public ScBlockUndo
+{
+public:
+ ScUndoAutoFormat( ScDocShell* pNewDocShell,
+ const ScRange& rRange, ScDocumentUniquePtr pNewUndoDoc,
+ const ScMarkData& rMark,
+ bool bNewSize, sal_uInt16 nNewFormatNo );
+ virtual ~ScUndoAutoFormat() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScDocumentUniquePtr
+ pUndoDoc; // deleted data
+ ScMarkData aMarkData;
+ bool bSize;
+ sal_uInt16 nFormatNo;
+};
+
+class ScUndoReplace: public ScSimpleUndo
+{
+public:
+ ScUndoReplace( ScDocShell* pNewDocShell,
+ const ScMarkData& rMark,
+ SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
+ const OUString& rNewUndoStr, ScDocumentUniquePtr pNewUndoDoc,
+ const SvxSearchItem* pItem );
+ virtual ~ScUndoReplace() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScAddress aCursorPos;
+ ScMarkData aMarkData;
+ OUString aUndoStr; // Data at single selection
+ ScDocumentUniquePtr pUndoDoc; // Block mark and deleted data
+ std::unique_ptr<SvxSearchItem> pSearchItem;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+
+ void SetChangeTrack();
+};
+
+class ScUndoTabOp: public ScSimpleUndo
+{
+public:
+ ScUndoTabOp( ScDocShell* pNewDocShell,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
+ ScDocumentUniquePtr pNewUndoDoc,
+ const ScRefAddress& rFormulaCell,
+ const ScRefAddress& rFormulaEnd,
+ const ScRefAddress& rRowCell,
+ const ScRefAddress& rColCell,
+ ScTabOpParam::Mode eMode );
+ virtual ~ScUndoTabOp() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScRange aRange;
+ ScDocumentUniquePtr
+ pUndoDoc; // Deleted data
+ ScRefAddress theFormulaCell;
+ ScRefAddress theFormulaEnd;
+ ScRefAddress theRowCell;
+ ScRefAddress theColCell;
+ ScTabOpParam::Mode meMode;
+};
+
+class ScUndoConversion : public ScSimpleUndo
+{
+public:
+
+ ScUndoConversion( ScDocShell* pNewDocShell, const ScMarkData& rMark,
+ SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScDocumentUniquePtr pNewUndoDoc,
+ SCCOL nNewX, SCROW nNewY, SCTAB nNewZ, ScDocumentUniquePtr pNewRedoDoc,
+ const ScConversionParam& rConvParam );
+ virtual ~ScUndoConversion() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScMarkData aMarkData;
+ ScAddress aCursorPos;
+ ScDocumentUniquePtr pUndoDoc; // Block mark and deleted data
+ ScAddress aNewCursorPos;
+ ScDocumentUniquePtr pRedoDoc; // Block mark and new data
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+ ScConversionParam maConvParam; /// Conversion type and parameters.
+
+ void DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPos );
+ void SetChangeTrack();
+};
+
+class ScUndoRefConversion: public ScSimpleUndo
+{
+public:
+ ScUndoRefConversion( ScDocShell* pNewDocShell,
+ const ScRange& aMarkRange, const ScMarkData& rMark,
+ ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc, bool bNewMulti);
+ virtual ~ScUndoRefConversion() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr pUndoDoc;
+ ScDocumentUniquePtr pRedoDoc;
+ ScRange aRange;
+ bool bMulti;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+
+ void DoChange( ScDocument* pRefDoc);
+ void SetChangeTrack();
+};
+
+class ScUndoListNames: public ScBlockUndo
+{
+public:
+ ScUndoListNames(ScDocShell* pNewDocShell,
+ const ScRange& rRange,
+ ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScDocumentUniquePtr xUndoDoc;
+ ScDocumentUniquePtr xRedoDoc;
+
+ void DoChange( ScDocument* pSrcDoc ) const;
+};
+
+class ScUndoConditionalFormat : public ScSimpleUndo
+{
+public:
+ ScUndoConditionalFormat( ScDocShell* pNewDocShell,
+ ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, const ScRange& rRange);
+ virtual ~ScUndoConditionalFormat() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ void DoChange(ScDocument* pDoc);
+ ScDocumentUniquePtr mpUndoDoc;
+ ScDocumentUniquePtr mpRedoDoc;
+ ScRange maRange;
+};
+
+class ScUndoConditionalFormatList : public ScSimpleUndo
+{
+public:
+ ScUndoConditionalFormatList( ScDocShell* pNewDocShell,
+ ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab);
+ virtual ~ScUndoConditionalFormatList() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ void DoChange(const ScDocument* pDoc);
+ ScDocumentUniquePtr mpUndoDoc;
+ ScDocumentUniquePtr mpRedoDoc;
+ SCTAB mnTab;
+};
+
+class ScUndoUseScenario: public ScSimpleUndo
+{
+public:
+ ScUndoUseScenario( ScDocShell* pNewDocShell,
+ const ScMarkData& rMark,
+ const ScArea& rDestArea, ScDocumentUniquePtr pNewUndoDoc,
+ const OUString& rNewName );
+ virtual ~ScUndoUseScenario() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScDocumentUniquePtr
+ pUndoDoc;
+ ScRange aRange;
+ ScMarkData aMarkData;
+ OUString aName;
+};
+
+class ScUndoSelectionStyle: public ScSimpleUndo
+{
+public:
+ ScUndoSelectionStyle( ScDocShell* pNewDocShell,
+ const ScMarkData& rMark,
+ const ScRange& rRange,
+ const OUString& rName,
+ ScDocumentUniquePtr pNewUndoDoc );
+ virtual ~ScUndoSelectionStyle() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr
+ pUndoDoc;
+ OUString aStyleName;
+ ScRange aRange;
+
+ void DoChange( const bool bUndo );
+};
+
+class ScUndoRefreshLink: public ScSimpleUndo
+{
+public:
+ ScUndoRefreshLink(ScDocShell* pNewDocShell,
+ ScDocumentUniquePtr pNewUndoDoc);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScDocumentUniquePtr xUndoDoc;
+ ScDocumentUniquePtr xRedoDoc;
+};
+
+class ScUndoEnterMatrix: public ScBlockUndo
+{
+public:
+ ScUndoEnterMatrix( ScDocShell* pNewDocShell,
+ const ScRange& rArea,
+ ScDocumentUniquePtr pNewUndoDoc,
+ const OUString& rForm );
+ virtual ~ScUndoEnterMatrix() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScDocumentUniquePtr
+ pUndoDoc;
+ OUString aFormula;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+
+ void SetChangeTrack();
+};
+
+class ScUndoInsertAreaLink : public ScSimpleUndo
+{
+public:
+ ScUndoInsertAreaLink( ScDocShell* pShell,
+ const OUString& rDocName,
+ const OUString& rFltName, const OUString& rOptions,
+ const OUString& rAreaName, const ScRange& rDestRange,
+ sal_uLong nRefreshDelay );
+ virtual ~ScUndoInsertAreaLink() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ OUString aDocName;
+ OUString aFltName;
+ OUString aOptions;
+ OUString aAreaName;
+ ScRange aRange;
+ sal_uLong nRefreshDelay;
+};
+
+class ScUndoRemoveAreaLink : public ScSimpleUndo
+{
+public:
+ ScUndoRemoveAreaLink( ScDocShell* pShell,
+ const OUString& rDocName,
+ const OUString& rFltName, const OUString& rOptions,
+ const OUString& rAreaName, const ScRange& rDestRange,
+ sal_uLong nRefreshDelay );
+ virtual ~ScUndoRemoveAreaLink() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ OUString aDocName;
+ OUString aFltName;
+ OUString aOptions;
+ OUString aAreaName;
+ ScRange aRange;
+ sal_uLong nRefreshDelay;
+};
+
+class ScUndoUpdateAreaLink : public ScSimpleUndo //! also change BlockUndo?
+{
+public:
+ ScUndoUpdateAreaLink(ScDocShell* pShell,
+ const OUString& rOldD,
+ const OUString& rOldF, const OUString& rOldO,
+ const OUString& rOldA, const ScRange& rOldR,
+ sal_uLong nOldRD,
+ const OUString& rNewD,
+ const OUString& rNewF, const OUString& rNewO,
+ const OUString& rNewA, const ScRange& rNewR,
+ sal_uLong nNewRD,
+ ScDocumentUniquePtr pUndo, ScDocumentUniquePtr pRedo,
+ bool bDoInsert);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ OUString aOldDoc;
+ OUString aOldFlt;
+ OUString aOldOpt;
+ OUString aOldArea;
+ ScRange aOldRange;
+ OUString aNewDoc;
+ OUString aNewFlt;
+ OUString aNewOpt;
+ OUString aNewArea;
+ ScRange aNewRange;
+ ScDocumentUniquePtr xUndoDoc;
+ ScDocumentUniquePtr xRedoDoc;
+ sal_uLong nOldRefresh;
+ sal_uLong nNewRefresh;
+ bool bWithInsert;
+
+ void DoChange( const bool bUndo ) const;
+};
+
+class ScUndoIndent: public ScBlockUndo
+{
+public:
+ ScUndoIndent( ScDocShell* pNewDocShell, const ScMarkData& rMark,
+ ScDocumentUniquePtr pNewUndoDoc, bool bIncrement );
+ virtual ~ScUndoIndent() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr
+ pUndoDoc;
+ bool bIsIncrement;
+};
+
+class ScUndoTransliterate: public ScBlockUndo
+{
+public:
+ ScUndoTransliterate( ScDocShell* pNewDocShell, const ScMarkData& rMark,
+ ScDocumentUniquePtr pNewUndoDoc, TransliterationFlags nType );
+ virtual ~ScUndoTransliterate() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr
+ pUndoDoc;
+ TransliterationFlags
+ nTransliterationType;
+};
+
+class ScUndoClearItems: public ScBlockUndo
+{
+public:
+ ScUndoClearItems( ScDocShell* pNewDocShell, const ScMarkData& rMark,
+ ScDocumentUniquePtr pNewUndoDoc, const sal_uInt16* pW );
+ virtual ~ScUndoClearItems() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScMarkData aMarkData;
+ ScDocumentUniquePtr
+ pUndoDoc;
+ std::unique_ptr<sal_uInt16[]>
+ pWhich;
+};
+
+class ScUndoRemoveBreaks: public ScSimpleUndo
+{
+public:
+ ScUndoRemoveBreaks( ScDocShell* pNewDocShell,
+ SCTAB nNewTab, ScDocumentUniquePtr pNewUndoDoc );
+ virtual ~ScUndoRemoveBreaks() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB nTab;
+ ScDocumentUniquePtr
+ pUndoDoc;
+};
+
+class ScUndoRemoveMerge: public ScBlockUndo
+{
+public:
+ ScUndoRemoveMerge( ScDocShell* pNewDocShell,
+ const ScCellMergeOption& rOption,
+ ScDocumentUniquePtr pNewUndoDoc );
+ ScUndoRemoveMerge( ScDocShell* pNewDocShell,
+ const ScRange& rRange,
+ ScDocumentUniquePtr pNewUndoDoc );
+ virtual ~ScUndoRemoveMerge() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+ ScDocument* GetUndoDoc();
+ void AddCellMergeOption( const ScCellMergeOption& rOption );
+
+private:
+ void SetCurTab();
+
+ std::vector<ScCellMergeOption> maOptions;
+ ScDocumentUniquePtr pUndoDoc;
+};
+
+class ScUndoBorder: public ScBlockUndo
+{
+public:
+ ScUndoBorder(ScDocShell* pNewDocShell,
+ const ScRangeList& rRangeList,
+ ScDocumentUniquePtr pNewUndoDoc,
+ const SvxBoxItem& rNewOuter,
+ const SvxBoxInfoItem& rNewInner);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScDocumentUniquePtr xUndoDoc;
+ std::unique_ptr<ScRangeList> xRanges;
+ std::unique_ptr<SvxBoxItem> xOuter;
+ std::unique_ptr<SvxBoxInfoItem> xInner;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undocell.hxx b/sc/source/ui/inc/undocell.hxx
new file mode 100644
index 000000000..b013e084f
--- /dev/null
+++ b/sc/source/ui/inc/undocell.hxx
@@ -0,0 +1,369 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "undobase.hxx"
+#include <detdata.hxx>
+#include <postit.hxx>
+#include <cellvalue.hxx>
+#include <cellvalues.hxx>
+#include <editeng/editobj.hxx>
+
+#include <memory>
+
+class ScDocShell;
+class ScPatternAttr;
+class ScRangeName;
+class ScFormulaCell;
+
+class ScUndoCursorAttr: public ScSimpleUndo
+{
+public:
+ ScUndoCursorAttr( ScDocShell* pNewDocShell,
+ SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
+ const ScPatternAttr* pOldPat, const ScPatternAttr* pNewPat,
+ const ScPatternAttr* pApplyPat );
+ virtual ~ScUndoCursorAttr() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+ /** once the objects are passed to this class, their life-cycle is
+ managed by this class; the calling function must pass new'ed
+ objects to this method. */
+ void SetEditData( std::unique_ptr<EditTextObject> pOld, std::unique_ptr<EditTextObject> pNew );
+
+private:
+ SCCOL nCol;
+ SCROW nRow;
+ SCTAB nTab;
+ ScPatternAttr* pOldPattern;
+ ScPatternAttr* pNewPattern;
+ ScPatternAttr* pApplyPattern;
+ std::unique_ptr<EditTextObject> pOldEditData;
+ std::unique_ptr<EditTextObject> pNewEditData;
+
+ void DoChange( const ScPatternAttr* pWhichPattern, const std::unique_ptr<EditTextObject>& pEditData ) const;
+};
+
+class ScUndoEnterData: public ScSimpleUndo
+{
+public:
+
+ struct Value
+ {
+ SCTAB mnTab;
+ bool mbHasFormat;
+ sal_uInt32 mnFormat;
+ ScCellValue maCell;
+
+ Value();
+ };
+
+ typedef std::vector<Value> ValuesType;
+
+ ScUndoEnterData(
+ ScDocShell* pNewDocShell, const ScAddress& rPos,
+ ValuesType& rOldValues, const OUString& rNewStr, std::unique_ptr<EditTextObject> pObj );
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ValuesType maOldValues;
+
+ OUString maNewString;
+ std::unique_ptr<EditTextObject> mpNewEditData;
+ sal_uLong mnEndChangeAction;
+ ScAddress maPos;
+
+ void DoChange() const;
+ void SetChangeTrack();
+};
+
+class ScUndoEnterValue: public ScSimpleUndo
+{
+public:
+ ScUndoEnterValue(
+ ScDocShell* pNewDocShell, const ScAddress& rNewPos,
+ const ScCellValue& rUndoCell, double nVal );
+
+ virtual ~ScUndoEnterValue() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScAddress aPos;
+ ScCellValue maOldCell;
+ double nValue;
+ sal_uLong nEndChangeAction;
+
+ void SetChangeTrack();
+};
+
+class ScUndoSetCell : public ScSimpleUndo
+{
+public:
+ ScUndoSetCell( ScDocShell* pDocSh, const ScAddress& rPos, const ScCellValue& rOldVal, const ScCellValue& rNewVal );
+
+ virtual ~ScUndoSetCell() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat( SfxRepeatTarget& rTarget ) override;
+ virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const override;
+ virtual OUString GetComment() const override;
+
+private:
+ void SetChangeTrack();
+ void SetValue( const ScCellValue& rVal );
+ void MoveCursorToCell();
+
+private:
+ ScAddress maPos;
+ ScCellValue maOldValue;
+ ScCellValue maNewValue;
+ sal_uLong mnEndChangeAction;
+};
+
+class ScUndoPageBreak: public ScSimpleUndo
+{
+public:
+ ScUndoPageBreak( ScDocShell* pNewDocShell,
+ SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
+ bool bNewColumn, bool bNewInsert );
+ virtual ~ScUndoPageBreak() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCCOL nCol;
+ SCROW nRow;
+ SCTAB nTab;
+ bool bColumn; // Column or row break
+ bool bInsert; // Insert or Delete
+
+ void DoChange( bool bInsert ) const;
+};
+
+class ScUndoPrintZoom: public ScSimpleUndo
+{
+public:
+ ScUndoPrintZoom( ScDocShell* pNewDocShell, SCTAB nT,
+ sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP );
+ virtual ~ScUndoPrintZoom() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB nTab;
+ sal_uInt16 nOldScale;
+ sal_uInt16 nOldPages;
+ sal_uInt16 nNewScale;
+ sal_uInt16 nNewPages;
+
+ void DoChange( bool bUndo );
+};
+
+class ScUndoThesaurus: public ScSimpleUndo
+{
+public:
+ ScUndoThesaurus( ScDocShell* pNewDocShell,
+ SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
+ const ScCellValue& rOldText, const ScCellValue& rNewText );
+ virtual ~ScUndoThesaurus() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCCOL nCol;
+ SCROW nRow;
+ SCTAB nTab;
+ sal_uLong nEndChangeAction;
+
+ ScCellValue maOldText;
+ ScCellValue maNewText;
+
+ void DoChange( bool bUndo, const ScCellValue& rText );
+ void SetChangeTrack( const ScCellValue& rOldCell );
+};
+
+/** Undo action for inserting, removing, and replacing a cell note. */
+class ScUndoReplaceNote : public ScSimpleUndo
+{
+public:
+
+ /** Constructs an undo action for inserting or removing a cell note. */
+ ScUndoReplaceNote(
+ ScDocShell& rDocShell,
+ const ScAddress& rPos,
+ const ScNoteData& rNoteData,
+ bool bInsert,
+ std::unique_ptr<SdrUndoAction> pDrawUndo );
+
+ /** Constructs an undo action for replacing a cell note with another. */
+ ScUndoReplaceNote(
+ ScDocShell& rDocShell,
+ const ScAddress& rPos,
+ const ScNoteData& rOldData,
+ const ScNoteData& rNewData,
+ std::unique_ptr<SdrUndoAction> pDrawUndo );
+
+ virtual ~ScUndoReplaceNote() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat( SfxRepeatTarget& rTarget ) override;
+ virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ void DoInsertNote( const ScNoteData& rNoteData );
+ void DoRemoveNote( const ScNoteData& rNoteData );
+
+private:
+ ScAddress maPos;
+ ScNoteData maOldData;
+ ScNoteData maNewData;
+ std::unique_ptr<SdrUndoAction> mpDrawUndo;
+};
+
+/** Undo action for showing or hiding a cell note caption. */
+class ScUndoShowHideNote : public ScSimpleUndo
+{
+public:
+ ScUndoShowHideNote( ScDocShell& rDocShell, const ScAddress& rPos, bool bShow );
+ virtual ~ScUndoShowHideNote() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat( SfxRepeatTarget& rTarget ) override;
+ virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScAddress maPos;
+ bool mbShown;
+};
+
+class ScUndoDetective: public ScSimpleUndo
+{
+public:
+ ScUndoDetective( ScDocShell* pNewDocShell,
+ std::unique_ptr<SdrUndoAction> pDraw, const ScDetOpData* pOperation,
+ std::unique_ptr<ScDetOpList> pUndoList = nullptr );
+ virtual ~ScUndoDetective() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ bool bIsDelete;
+ std::unique_ptr<ScDetOpList> pOldList;
+ sal_uInt16 nAction;
+ ScAddress aPos;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+};
+
+class ScUndoRangeNames: public ScSimpleUndo
+{
+public:
+ //use nTab = -1 for global range names
+ ScUndoRangeNames( ScDocShell* pNewDocShell,
+ std::unique_ptr<ScRangeName> pOld, std::unique_ptr<ScRangeName> pNew , SCTAB nTab);
+ virtual ~ScUndoRangeNames() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ std::unique_ptr<ScRangeName> pOldRanges;
+ std::unique_ptr<ScRangeName> pNewRanges;
+ SCTAB mnTab;
+
+ void DoChange( bool bUndo );
+};
+
+namespace sc {
+
+class UndoSetCells : public ScSimpleUndo
+{
+ ScAddress maTopPos;
+ CellValues maOldValues;
+ CellValues maNewValues;
+
+ void DoChange( const CellValues& rValues );
+
+public:
+ UndoSetCells( ScDocShell* pDocSh, const ScAddress& rTopPos );
+ virtual ~UndoSetCells() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+ virtual bool CanRepeat( SfxRepeatTarget& ) const override;
+ virtual OUString GetComment() const override;
+
+ CellValues& GetOldValues() { return maOldValues;}
+ void SetNewValues( const std::vector<double>& rVals );
+ void SetNewValues( const std::vector<ScFormulaCell*>& rVals );
+};
+
+} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undoconvert.hxx b/sc/source/ui/inc/undoconvert.hxx
new file mode 100644
index 000000000..428710d83
--- /dev/null
+++ b/sc/source/ui/inc/undoconvert.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include "undobase.hxx"
+#include <cellvalues.hxx>
+
+namespace sc
+{
+class UndoFormulaToValue : public ScSimpleUndo
+{
+ TableValues maUndoValues;
+
+public:
+ UndoFormulaToValue(ScDocShell* pDocSh, TableValues& rUndoValues);
+
+ virtual OUString GetComment() const override;
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+private:
+ void Execute();
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undodat.hxx b/sc/source/ui/inc/undodat.hxx
new file mode 100644
index 000000000..486fe07d1
--- /dev/null
+++ b/sc/source/ui/inc/undodat.hxx
@@ -0,0 +1,446 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "undobase.hxx"
+#include "refundo.hxx"
+#include <dpobject.hxx>
+#include <olinetab.hxx>
+#include <rangeutl.hxx>
+#include <rangelst.hxx>
+#include <queryparam.hxx>
+#include <subtotalparam.hxx>
+
+#include <memory>
+
+class ScDocShell;
+class SdrUndoAction;
+
+class ScUndoDoOutline: public ScSimpleUndo
+{
+public:
+ ScUndoDoOutline( ScDocShell* pNewDocShell,
+ SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab,
+ ScDocumentUniquePtr pNewUndoDoc, bool bNewColumns,
+ sal_uInt16 nNewLevel, sal_uInt16 nNewEntry, bool bNewShow );
+ virtual ~ScUndoDoOutline() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCCOLROW nStart;
+ SCCOLROW nEnd;
+ SCTAB nTab;
+ ScDocumentUniquePtr
+ pUndoDoc;
+ bool bColumns;
+ sal_uInt16 nLevel;
+ sal_uInt16 nEntry;
+ bool bShow;
+};
+
+class ScUndoMakeOutline: public ScSimpleUndo
+{
+public:
+ ScUndoMakeOutline( ScDocShell* pNewDocShell,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
+ std::unique_ptr<ScOutlineTable> pNewUndoTab,
+ bool bNewColumns, bool bNewMake );
+ virtual ~ScUndoMakeOutline() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScAddress aBlockStart;
+ ScAddress aBlockEnd;
+ std::unique_ptr<ScOutlineTable>
+ pUndoTable;
+ bool bColumns;
+ bool bMake;
+};
+
+class ScUndoOutlineLevel: public ScSimpleUndo
+{
+public:
+ ScUndoOutlineLevel(ScDocShell* pNewDocShell,
+ SCCOLROW nNewStart, SCCOLROW nNewEnd, SCTAB nNewTab,
+ ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab,
+ bool bNewColumns, sal_uInt16 nNewLevel);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCCOLROW nStart;
+ SCCOLROW nEnd;
+ SCTAB nTab;
+ ScDocumentUniquePtr xUndoDoc;
+ std::unique_ptr<ScOutlineTable> xUndoTable;
+ bool bColumns;
+ sal_uInt16 nLevel;
+};
+
+class ScUndoOutlineBlock: public ScSimpleUndo
+{
+public:
+ ScUndoOutlineBlock(ScDocShell* pNewDocShell,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
+ ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab,
+ bool bNewShow);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScAddress aBlockStart;
+ ScAddress aBlockEnd;
+ ScDocumentUniquePtr xUndoDoc;
+ std::unique_ptr<ScOutlineTable> xUndoTable;
+ bool bShow;
+};
+
+class ScUndoRemoveAllOutlines: public ScSimpleUndo
+{
+public:
+ ScUndoRemoveAllOutlines(ScDocShell* pNewDocShell,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
+ ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScAddress aBlockStart;
+ ScAddress aBlockEnd;
+ ScDocumentUniquePtr xUndoDoc;
+ std::unique_ptr<ScOutlineTable> xUndoTable;
+};
+
+class ScUndoAutoOutline: public ScSimpleUndo
+{
+public:
+ ScUndoAutoOutline(ScDocShell* pNewDocShell,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
+ ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScAddress aBlockStart;
+ ScAddress aBlockEnd;
+ ScDocumentUniquePtr xUndoDoc;
+ std::unique_ptr<ScOutlineTable> xUndoTable;
+};
+
+class ScUndoSubTotals: public ScDBFuncUndo
+{
+public:
+ ScUndoSubTotals(ScDocShell* pNewDocShell, SCTAB nNewTab,
+ const ScSubTotalParam& rNewParam, SCROW nNewEndY,
+ ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab,
+ std::unique_ptr<ScRangeName> pNewUndoRange, std::unique_ptr<ScDBCollection> pNewUndoDB);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB nTab;
+ ScSubTotalParam aParam; // The original passed parameter
+ SCROW nNewEndRow; // Size of result
+ ScDocumentUniquePtr xUndoDoc;
+ std::unique_ptr<ScOutlineTable> xUndoTable;
+ std::unique_ptr<ScRangeName> xUndoRange;
+ std::unique_ptr<ScDBCollection> xUndoDB;
+};
+
+class ScUndoQuery: public ScDBFuncUndo
+{
+public:
+ ScUndoQuery( ScDocShell* pNewDocShell, SCTAB nNewTab,
+ const ScQueryParam& rParam, ScDocumentUniquePtr pNewUndoDoc,
+ std::unique_ptr<ScDBCollection> pNewUndoDB, const ScRange* pOld,
+ bool bSize, const ScRange* pAdvSrc );
+ virtual ~ScUndoQuery() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+ SCTAB nTab;
+ ScQueryParam aQueryParam;
+ ScDocumentUniquePtr xUndoDoc;
+ std::unique_ptr<ScDBCollection> xUndoDB; // due to source and target range
+ ScRange aOldDest;
+ ScRange aAdvSource;
+ bool bIsAdvanced;
+ bool bDestArea;
+ bool bDoSize;
+};
+
+class ScUndoAutoFilter: public ScDBFuncUndo
+{
+private:
+ OUString aDBName;
+ bool bFilterSet;
+
+ void DoChange( bool bUndo );
+
+public:
+ ScUndoAutoFilter( ScDocShell* pNewDocShell, const ScRange& rRange,
+ const OUString& rName, bool bSet );
+ virtual ~ScUndoAutoFilter() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+};
+
+class ScUndoDBData: public ScSimpleUndo
+{
+public:
+ ScUndoDBData( ScDocShell* pNewDocShell,
+ std::unique_ptr<ScDBCollection> pNewUndoColl,
+ std::unique_ptr<ScDBCollection> pNewRedoColl );
+ virtual ~ScUndoDBData() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ std::unique_ptr<ScDBCollection> pUndoColl;
+ std::unique_ptr<ScDBCollection> pRedoColl;
+};
+
+class ScUndoImportData: public ScSimpleUndo
+{
+public:
+ ScUndoImportData(ScDocShell* pNewDocShell, SCTAB nNewTab,
+ const ScImportParam& rParam, SCCOL nNewEndX, SCROW nNewEndY,
+ SCCOL nNewFormula,
+ ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
+ std::unique_ptr<ScDBData> pNewUndoData, std::unique_ptr<ScDBData> pNewRedoData);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB nTab;
+ ScImportParam aImportParam;
+ SCCOL nEndCol;
+ SCROW nEndRow;
+ ScDocumentUniquePtr xUndoDoc;
+ ScDocumentUniquePtr xRedoDoc;
+ std::unique_ptr<ScDBData> xUndoDBData;
+ std::unique_ptr<ScDBData> xRedoDBData;
+ SCCOL nFormulaCols;
+ bool bRedoFilled;
+};
+
+class ScUndoRepeatDB: public ScSimpleUndo
+{
+public:
+ ScUndoRepeatDB(ScDocShell* pNewDocShell, SCTAB nNewTab,
+ SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY,
+ SCROW nResultEndRow, SCCOL nCurX, SCROW nCurY,
+ ScDocumentUniquePtr pNewUndoDoc, std::unique_ptr<ScOutlineTable> pNewUndoTab,
+ std::unique_ptr<ScRangeName> pNewUndoRange, std::unique_ptr<ScDBCollection> pNewUndoDB,
+ const ScRange* pOldQ, const ScRange* pNewQ);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScAddress aBlockStart;
+ ScAddress aBlockEnd;
+ SCROW nNewEndRow;
+ ScAddress aCursorPos;
+ ScDocumentUniquePtr xUndoDoc;
+ std::unique_ptr<ScOutlineTable> xUndoTable;
+ std::unique_ptr<ScRangeName> xUndoRange;
+ std::unique_ptr<ScDBCollection> xUndoDB;
+ ScRange aOldQuery;
+ ScRange aNewQuery;
+ bool bQuerySize;
+};
+
+class ScUndoDataPilot: public ScSimpleUndo
+{
+public:
+ ScUndoDataPilot(ScDocShell* pNewDocShell,
+ ScDocumentUniquePtr pOldDoc, ScDocumentUniquePtr pNewDoc,
+ const ScDPObject* pOldObj, const ScDPObject* pNewObj,
+ bool bMove);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScDocumentUniquePtr xOldUndoDoc;
+ ScDocumentUniquePtr xNewUndoDoc;
+ std::unique_ptr<ScDPObject> xOldDPObject;
+ std::unique_ptr<ScDPObject> xNewDPObject;
+ bool bAllowMove;
+};
+
+class ScUndoConsolidate: public ScSimpleUndo
+{
+public:
+ ScUndoConsolidate(ScDocShell* pNewDocShell,
+ const ScArea& rArea, const ScConsolidateParam& rPar,
+ ScDocumentUniquePtr pNewUndoDoc, bool bReference,
+ SCROW nInsCount, std::unique_ptr<ScOutlineTable> pTab,
+ std::unique_ptr<ScDBData> pData);
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScArea aDestArea;
+ ScDocumentUniquePtr xUndoDoc;
+ ScConsolidateParam aParam;
+ bool bInsRef;
+ SCSIZE nInsertCount;
+ std::unique_ptr<ScOutlineTable> xUndoTab;
+ std::unique_ptr<ScDBData> xUndoData;
+};
+
+class ScUndoChartData: public ScSimpleUndo
+{
+public:
+ ScUndoChartData( ScDocShell* pNewDocShell,
+ const OUString& rName, const ScRange& rNew,
+ bool bColHdr, bool bRowHdr, bool bAdd );
+ ScUndoChartData( ScDocShell* pNewDocShell,
+ const OUString& rName, const ScRangeListRef& rNew,
+ bool bColHdr, bool bRowHdr, bool bAdd );
+ virtual ~ScUndoChartData() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ OUString aChartName;
+ ScRangeListRef aOldRangeListRef;
+ bool bOldColHeaders;
+ bool bOldRowHeaders;
+// ScRange aNewRange;
+ ScRangeListRef aNewRangeListRef;
+ bool bNewColHeaders;
+ bool bNewRowHeaders;
+ bool bAddRange;
+
+ void Init();
+};
+
+class ScUndoDataForm: public ScBlockUndo
+{
+public:
+ ScUndoDataForm(ScDocShell* pNewDocShell,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
+ const ScMarkData& rMark,
+ ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
+ std::unique_ptr<ScRefUndoData> pRefData);
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ std::unique_ptr<ScMarkData> mxMarkData;
+ ScDocumentUniquePtr xUndoDoc;
+ ScDocumentUniquePtr xRedoDoc;
+ std::unique_ptr<ScRefUndoData> xRefUndoData;
+ std::unique_ptr<ScRefUndoData> xRefRedoData;
+ bool bRedoFilled;
+
+ void DoChange( const bool bUndo );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undodraw.hxx b/sc/source/ui/inc/undodraw.hxx
new file mode 100644
index 000000000..b12eebdb3
--- /dev/null
+++ b/sc/source/ui/inc/undodraw.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+#include <svl/undo.hxx>
+
+class ScDocShell;
+
+class ScUndoDraw: public SfxUndoAction
+{
+ std::unique_ptr<SfxUndoAction> pDrawUndo;
+ ScDocShell* pDocShell;
+ ViewShellId mnViewShellId;
+
+ void UpdateSubShell();
+
+public:
+ ScUndoDraw( std::unique_ptr<SfxUndoAction> pUndo, ScDocShell* pDocSh );
+ virtual ~ScUndoDraw() override;
+
+ std::unique_ptr<SfxUndoAction> ReleaseDrawUndo() { return std::move(pDrawUndo); }
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+ virtual bool Merge( SfxUndoAction *pNextAction ) override;
+ virtual OUString GetComment() const override;
+ virtual OUString GetRepeatComment(SfxRepeatTarget&) const override;
+ /// See SfxUndoAction::GetViewShellId().
+ ViewShellId GetViewShellId() const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undoolk.hxx b/sc/source/ui/inc/undoolk.hxx
new file mode 100644
index 000000000..67d519438
--- /dev/null
+++ b/sc/source/ui/inc/undoolk.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+
+class SdrUndoAction;
+class ScDocument;
+
+std::unique_ptr<SdrUndoAction> GetSdrUndoAction( ScDocument* pDoc );
+void DoSdrUndoAction ( SdrUndoAction* pUndoAction, ScDocument* pDoc );
+void RedoSdrUndoAction ( SdrUndoAction* pUndoAction );
+void EnableDrawAdjust ( ScDocument* pDoc, bool bEnable );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undosort.hxx b/sc/source/ui/inc/undosort.hxx
new file mode 100644
index 000000000..64b4f0da7
--- /dev/null
+++ b/sc/source/ui/inc/undosort.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include "undobase.hxx"
+#include <sortparam.hxx>
+
+namespace sc {
+
+class UndoSort : public ScSimpleUndo
+{
+ ReorderParam maParam;
+
+public:
+ UndoSort( ScDocShell* pDocSh, const ReorderParam& rParam );
+
+ virtual OUString GetComment() const override;
+ virtual void Undo() override;
+ virtual void Redo() override;
+
+private:
+ void Execute( bool bUndo );
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undostyl.hxx b/sc/source/ui/inc/undostyl.hxx
new file mode 100644
index 000000000..6c169c43e
--- /dev/null
+++ b/sc/source/ui/inc/undostyl.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <optional>
+#include <svl/style.hxx>
+#include <svl/itemset.hxx>
+#include "undobase.hxx"
+
+class ScDocShell;
+
+class ScStyleSaveData
+{
+private:
+ OUString aName;
+ OUString aParent;
+ std::optional<SfxItemSet> moItems;
+
+public:
+ ScStyleSaveData();
+ ScStyleSaveData( const ScStyleSaveData& rOther );
+ ScStyleSaveData& operator=( const ScStyleSaveData& rOther );
+
+ void InitFromStyle( const SfxStyleSheetBase* pSource );
+
+ const OUString& GetName() const { return aName; }
+ const OUString& GetParent() const { return aParent; }
+ const std::optional<SfxItemSet>& GetItems() const { return moItems; }
+};
+
+class ScUndoModifyStyle: public ScSimpleUndo
+{
+private:
+ SfxStyleFamily eFamily;
+ ScStyleSaveData aOldData;
+ ScStyleSaveData aNewData;
+
+ static void DoChange( ScDocShell* pDocSh,
+ const OUString& rName, SfxStyleFamily eStyleFamily,
+ const ScStyleSaveData& rData );
+
+public:
+ ScUndoModifyStyle( ScDocShell* pDocSh,
+ SfxStyleFamily eFam,
+ const ScStyleSaveData& rOld,
+ const ScStyleSaveData& rNew );
+ virtual ~ScUndoModifyStyle() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+};
+
+class ScUndoApplyPageStyle: public ScSimpleUndo
+{
+public:
+ ScUndoApplyPageStyle( ScDocShell* pDocSh, const OUString& rNewStyle );
+ virtual ~ScUndoApplyPageStyle() override;
+
+ void AddSheetAction( SCTAB nTab, const OUString& rOld );
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ struct ApplyStyleEntry
+ {
+ SCTAB mnTab;
+ OUString maOldStyle;
+ explicit ApplyStyleEntry( SCTAB nTab, const OUString& rOldStyle );
+ };
+ typedef ::std::vector< ApplyStyleEntry > ApplyStyleVec;
+
+ ApplyStyleVec maEntries;
+ OUString maNewStyle;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx
new file mode 100644
index 000000000..2d94d6965
--- /dev/null
+++ b/sc/source/ui/inc/undotab.hxx
@@ -0,0 +1,471 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "undobase.hxx"
+#include <tools/color.hxx>
+#include <tabbgcolor.hxx>
+
+#include <memory>
+#include <vector>
+
+class ScDocShell;
+class SdrUndoAction;
+class ScPrintRangeSaver;
+class SdrObject;
+class ScDocProtection;
+class ScTableProtection;
+class ScMarkData;
+
+class ScUndoInsertTab : public ScSimpleUndo
+{
+public:
+ ScUndoInsertTab(
+ ScDocShell* pNewDocShell,
+ SCTAB nTabNum,
+ bool bApp,
+ const OUString& rNewName);
+ virtual ~ScUndoInsertTab() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ OUString sNewName;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+ sal_uLong nEndChangeAction;
+ SCTAB nTab;
+ bool bAppend;
+
+ void SetChangeTrack();
+};
+
+class ScUndoInsertTables : public ScSimpleUndo
+{
+public:
+ ScUndoInsertTables(
+ ScDocShell* pNewDocShell,
+ SCTAB nTabNum,
+ std::vector<OUString>&& newNameList);
+ virtual ~ScUndoInsertTables() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+ std::vector<OUString> aNameList;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+ SCTAB nTab;
+
+ void SetChangeTrack();
+};
+
+class ScUndoDeleteTab: public ScMoveUndo
+{
+public:
+ ScUndoDeleteTab(
+ ScDocShell* pNewDocShell,
+ const std::vector<SCTAB> &theTabs, //SCTAB nNewTab,
+ ScDocumentUniquePtr pUndoDocument,
+ std::unique_ptr<ScRefUndoData> pRefData );
+ virtual ~ScUndoDeleteTab() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ std::vector<SCTAB> theTabs;
+ sal_uLong nStartChangeAction;
+ sal_uLong nEndChangeAction;
+
+ void SetChangeTrack();
+};
+
+class ScUndoRenameTab: public ScSimpleUndo
+{
+public:
+ ScUndoRenameTab(
+ ScDocShell* pNewDocShell,
+ SCTAB nT,
+ const OUString& rOldName,
+ const OUString& rNewName);
+ virtual ~ScUndoRenameTab() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB nTab;
+ OUString sOldName;
+ OUString sNewName;
+
+ void DoChange( SCTAB nTab, const OUString& rName ) const;
+};
+
+class ScUndoMoveTab: public ScSimpleUndo
+{
+public:
+ ScUndoMoveTab(
+ ScDocShell* pNewDocShell,
+ std::unique_ptr<std::vector<SCTAB>> pOldTabs,
+ std::unique_ptr<std::vector<SCTAB>> pNewTabs,
+ std::unique_ptr<std::vector< OUString>> pOldNames = nullptr,
+ std::unique_ptr<std::vector< OUString>> pNewNames = nullptr );
+
+ virtual ~ScUndoMoveTab() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ std::unique_ptr< ::std::vector<SCTAB> > mpOldTabs;
+ std::unique_ptr< ::std::vector<SCTAB> > mpNewTabs;
+ std::unique_ptr< ::std::vector< OUString> > mpOldNames;
+ std::unique_ptr< ::std::vector< OUString> > mpNewNames;
+
+ void DoChange( bool bUndo ) const;
+};
+
+class ScUndoCopyTab: public ScSimpleUndo
+{
+public:
+ ScUndoCopyTab(
+ ScDocShell* pNewDocShell,
+ std::unique_ptr<std::vector<SCTAB>> pOldTabs,
+ std::unique_ptr<std::vector<SCTAB>> pNewTabs,
+ std::unique_ptr<std::vector< OUString>> pNewNames = nullptr );
+
+ virtual ~ScUndoCopyTab() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ std::unique_ptr< ::std::vector<SCTAB> > mpOldTabs;
+ std::unique_ptr< ::std::vector<SCTAB> > mpNewTabs;
+ std::unique_ptr< ::std::vector< OUString> > mpNewNames;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+
+ void DoChange() const;
+};
+
+class ScUndoTabColor: public ScSimpleUndo
+{
+public:
+ ScUndoTabColor(
+ ScDocShell* pNewDocShell,
+ SCTAB nT,
+ const Color& aOTabBgColor,
+ const Color& aNTabBgColor);
+ ScUndoTabColor(
+ ScDocShell* pNewDocShell,
+ ScUndoTabColorInfo::List&& rUndoTabColorList);
+ virtual ~ScUndoTabColor() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ScUndoTabColorInfo::List aTabColorList;
+
+ void DoChange(bool bUndoType) const;
+};
+
+class ScUndoMakeScenario: public ScSimpleUndo
+{
+public:
+ ScUndoMakeScenario(
+ ScDocShell* pNewDocShell,
+ SCTAB nSrc, SCTAB nDest,
+ const OUString& rN, const OUString& rC,
+ const Color& rCol, ScScenarioFlags nF,
+ const ScMarkData& rMark );
+ virtual ~ScUndoMakeScenario() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ std::unique_ptr<ScMarkData> mpMarkData;
+ SCTAB nSrcTab;
+ SCTAB nDestTab;
+ OUString aName;
+ OUString aComment;
+ Color aColor;
+ ScScenarioFlags nFlags;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+};
+
+class ScUndoImportTab : public ScSimpleUndo
+{
+public:
+ ScUndoImportTab(
+ ScDocShell* pShell,
+ SCTAB nNewTab, SCTAB nNewCount );
+ virtual ~ScUndoImportTab() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB nTab;
+ SCTAB nCount;
+ ScDocumentUniquePtr xRedoDoc;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+
+ void DoChange() const;
+};
+
+class ScUndoRemoveLink : public ScSimpleUndo
+{
+public:
+ ScUndoRemoveLink( // Call before delete!
+ ScDocShell* pShell,
+ const OUString& rDoc );
+ virtual ~ScUndoRemoveLink() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ OUString aDocName;
+ OUString aFltName;
+ OUString aOptions;
+ sal_uLong nRefreshDelay;
+ sal_uInt16 nCount;
+ std::unique_ptr<SCTAB[]>
+ pTabs;
+ std::unique_ptr<ScLinkMode[]>
+ pModes;
+ std::unique_ptr<OUString[]>
+ pTabNames;
+
+ void DoChange( bool bLink ) const;
+};
+
+class ScUndoShowHideTab : public ScSimpleUndo
+{
+public:
+ ScUndoShowHideTab(
+ ScDocShell* pShell,
+ std::vector<SCTAB>&& newUndoTabs,
+ bool bNewShow );
+ virtual ~ScUndoShowHideTab() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ std::vector<SCTAB> undoTabs;
+ bool bShow;
+
+ void DoChange( bool bShow ) const;
+};
+
+/** This class implements undo & redo of document protect & unprotect
+ operations. */
+class ScUndoDocProtect : public ScSimpleUndo
+{
+public:
+ ScUndoDocProtect(ScDocShell* pShell, ::std::unique_ptr<ScDocProtection> && pProtectSettings);
+ virtual ~ScUndoDocProtect() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ ::std::unique_ptr<ScDocProtection> mpProtectSettings;
+
+ void DoProtect(bool bProtect);
+};
+
+/** This class implements undo & redo of both protect and unprotect of
+ sheet. */
+class ScUndoTabProtect : public ScSimpleUndo
+{
+public:
+ ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab,
+ std::unique_ptr<ScTableProtection> && pProtectSettings);
+ virtual ~ScUndoTabProtect() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB mnTab;
+ ::std::unique_ptr<ScTableProtection> mpProtectSettings;
+
+ void DoProtect(bool bProtect);
+};
+
+class ScUndoPrintRange : public ScSimpleUndo
+{
+public:
+ ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
+ std::unique_ptr<ScPrintRangeSaver> pOld,
+ std::unique_ptr<ScPrintRangeSaver> pNew );
+ virtual ~ScUndoPrintRange() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB nTab;
+ std::unique_ptr<ScPrintRangeSaver> pOldRanges;
+ std::unique_ptr<ScPrintRangeSaver> pNewRanges;
+
+ void DoChange( bool bUndo );
+};
+
+class ScUndoScenarioFlags: public ScSimpleUndo
+{
+public:
+ ScUndoScenarioFlags(
+ ScDocShell* pNewDocShell, SCTAB nT,
+ const OUString& rON, const OUString& rNN,
+ const OUString& rOC, const OUString& rNC,
+ const Color& rOCol, const Color& rNCol,
+ ScScenarioFlags nOF, ScScenarioFlags nNF);
+
+ virtual ~ScUndoScenarioFlags() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB nTab;
+ OUString aOldName;
+ OUString aNewName;
+ OUString aOldComment;
+ OUString aNewComment;
+ Color aOldColor;
+ Color aNewColor;
+ ScScenarioFlags nOldFlags;
+ ScScenarioFlags nNewFlags;
+};
+
+class ScUndoRenameObject: public ScSimpleUndo
+{
+public:
+ ScUndoRenameObject(
+ ScDocShell* pNewDocShell, const OUString& rPN,
+ const OUString& rON, const OUString& rNN );
+
+ virtual ~ScUndoRenameObject() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ OUString aPersistName; // to find object (works only for OLE objects)
+ OUString aOldName;
+ OUString aNewName;
+
+ SdrObject* GetObject();
+};
+
+class ScUndoLayoutRTL : public ScSimpleUndo
+{
+public:
+ ScUndoLayoutRTL( ScDocShell* pShell, SCTAB nNewTab, bool bNewRTL );
+ virtual ~ScUndoLayoutRTL() override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
+ virtual void Repeat(SfxRepeatTarget& rTarget) override;
+ virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+
+ virtual OUString GetComment() const override;
+
+private:
+ SCTAB nTab;
+ bool bRTL;
+
+ void DoChange( bool bNew );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/undoutil.hxx b/sc/source/ui/inc/undoutil.hxx
new file mode 100644
index 000000000..59887e570
--- /dev/null
+++ b/sc/source/ui/inc/undoutil.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <address.hxx>
+
+class ScDocShell;
+class ScDBData;
+class ScDocument;
+
+class ScUndoUtil
+{
+public:
+ /** Mark Block (invisible - has to be repainted) */
+ static void MarkSimpleBlock( const ScDocShell* pDocShell,
+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ );
+ static void MarkSimpleBlock( const ScDocShell* pDocShell,
+ const ScAddress& rBlockStart,
+ const ScAddress& rBlockEnd );
+ static void MarkSimpleBlock( const ScDocShell* pDocShell,
+ const ScRange& rRange );
+
+ static void PaintMore( ScDocShell* pDocShell,
+ const ScRange& rRange );
+
+ /** Search for Data base range in Document ("untitled" or by region)
+ create new if not found */
+ static ScDBData* GetOldDBData( const ScDBData* pUndoData, ScDocument* pDoc, SCTAB nTab,
+ SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */