summaryrefslogtreecommitdiffstats
path: root/sc/source/ui/inc/undo
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sc/source/ui/inc/undo
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/source/ui/inc/undo')
-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.hxx57
-rw-r--r--sc/source/ui/inc/undo/UndoInsertSparkline.hxx44
-rw-r--r--sc/source/ui/inc/undo/UndoThemeChange.hxx36
-rw-r--r--sc/source/ui/inc/undo/UndoUngroupSparklines.hxx55
8 files changed, 371 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 0000000000..97fcd77d95
--- /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 0000000000..7ca6c60077
--- /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> 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 0000000000..78bd096bc9
--- /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> pSparkline, SCTAB nTab,
+ ScRangeList 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 0000000000..b529c0234d
--- /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 aAttributes);
+ 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 0000000000..e67778c213
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoGroupSparklines.hxx
@@ -0,0 +1,57 @@
+/* -*- 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 <utility>
+
+namespace sc
+{
+/** Previous sparkline group data, which is restored at Undo grouping */
+struct UndoGroupSparklinesData
+{
+ UndoGroupSparklinesData(ScAddress const& rAddress, ScRangeList aDataRangeList,
+ std::shared_ptr<sc::SparklineGroup> pGroup)
+ : m_aAddress(rAddress)
+ , m_aDataRangeList(std::move(aDataRangeList))
+ , m_pSparklineGroup(std::move(pGroup))
+ {
+ }
+
+ 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> pSparklineGroup);
+ 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 0000000000..5262297a24
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoInsertSparkline.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 <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> pSparklineDataVector,
+ 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/UndoThemeChange.hxx b/sc/source/ui/inc/undo/UndoThemeChange.hxx
new file mode 100644
index 0000000000..6c0558df8a
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoThemeChange.hxx
@@ -0,0 +1,36 @@
+/* -*- 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>
+
+namespace sc
+{
+class UndoThemeChange : public ScSimpleUndo
+{
+private:
+ std::shared_ptr<model::ColorSet> mpOldColorSet;
+ std::shared_ptr<model::ColorSet> mpNewColorSet;
+
+public:
+ UndoThemeChange(ScDocShell& rDocShell, std::shared_ptr<model::ColorSet> const& pOldColorSet,
+ std::shared_ptr<model::ColorSet> const& pNewColorSet);
+ virtual ~UndoThemeChange() 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 0000000000..7c836ac2d1
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoUngroupSparklines.hxx
@@ -0,0 +1,55 @@
+/* -*- 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 <utility>
+
+namespace sc
+{
+/** Previous sparkline group data, which is restored at undo ungroupping */
+struct SparklineUndoData
+{
+ SparklineUndoData(ScAddress const& rAddress, ScRangeList aDataRangeList,
+ std::shared_ptr<sc::SparklineGroup> pGroup)
+ : m_aAddress(rAddress)
+ , m_aDataRangeList(std::move(aDataRangeList))
+ , m_pSparklineGroup(std::move(pGroup))
+ {
+ }
+
+ 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: */