Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / undorangename.hxx
blob46b4075eb7f0e23cfa8f01bdbc760d19a3d849ba
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 #ifndef INCLUDED_SC_INC_UNDORANGENAME_HXX
11 #define INCLUDED_SC_INC_UNDORANGENAME_HXX
13 #include <undobase.hxx>
14 #include "rangenam.hxx"
16 #include <memory>
17 #include <map>
19 class ScDocShell;
21 /**
22 * Undo object for named ranges, both in global and sheet-local scopes.
24 class ScUndoAllRangeNames : public ScSimpleUndo
26 public:
27 ScUndoAllRangeNames(ScDocShell* pDocSh,
28 const std::map<OUString, ScRangeName*>& rOldNames,
29 const std::map<OUString, std::unique_ptr<ScRangeName>>& rNewNames);
31 virtual ~ScUndoAllRangeNames() override;
33 virtual void Undo() override;
34 virtual void Redo() override;
35 virtual void Repeat(SfxRepeatTarget& rTarget) override;
36 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
37 virtual OUString GetComment() const override;
39 private:
40 void DoChange(const std::map<OUString, std::unique_ptr<ScRangeName>>& rNames);
42 private:
43 std::map<OUString, std::unique_ptr<ScRangeName>> m_OldNames;
44 std::map<OUString, std::unique_ptr<ScRangeName>> m_NewNames;
47 class ScUndoAddRangeData : public ScSimpleUndo
49 public:
50 // nTab = -1 for global range names
51 ScUndoAddRangeData(ScDocShell* pDocSh, const ScRangeData* pRangeData, SCTAB nTab);
53 virtual ~ScUndoAddRangeData() override;
55 virtual void Undo() override;
56 virtual void Redo() override;
57 virtual void Repeat(SfxRepeatTarget& rTarget) override;
58 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
59 virtual OUString GetComment() const override;
61 private:
62 std::unique_ptr<ScRangeData> mpRangeData;
63 SCTAB mnTab;
66 #endif
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */