Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / inc / undorangename.hxx
blobcbe1a2a1e5448f6d979e7f49a535739c36f431c2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #pragma once
12 #include <undobase.hxx>
14 #include <memory>
15 #include <map>
17 class ScDocShell;
19 /**
20 * Undo object for named ranges, both in global and sheet-local scopes.
22 class ScUndoAllRangeNames final : public ScSimpleUndo
24 public:
25 ScUndoAllRangeNames(ScDocShell* pDocSh, const std::map<OUString, ScRangeName*>& rOldNames,
26 const std::map<OUString, ScRangeName>& rNewNames);
28 virtual ~ScUndoAllRangeNames() override;
30 virtual void Undo() override;
31 virtual void Redo() override;
32 virtual void Repeat(SfxRepeatTarget& rTarget) override;
33 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
34 virtual OUString GetComment() const override;
36 private:
37 void DoChange(const std::map<OUString, ScRangeName>& rNames);
39 private:
40 std::map<OUString, ScRangeName> m_OldNames;
41 std::map<OUString, ScRangeName> m_NewNames;
44 class ScUndoAddRangeData final : public ScSimpleUndo
46 public:
47 // nTab = -1 for global range names
48 ScUndoAddRangeData(ScDocShell* pDocSh, const ScRangeData* pRangeData, SCTAB nTab);
50 virtual ~ScUndoAddRangeData() override;
52 virtual void Undo() override;
53 virtual void Redo() override;
54 virtual void Repeat(SfxRepeatTarget& rTarget) override;
55 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
56 virtual OUString GetComment() const override;
58 private:
59 std::unique_ptr<ScRangeData> mpRangeData;
60 SCTAB mnTab;
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */