1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_SC_INC_UNDORANGENAME_HXX
11 #define INCLUDED_SC_INC_UNDORANGENAME_HXX
13 #include <undobase.hxx>
21 * Undo object for named ranges, both in global and sheet-local scopes.
23 class ScUndoAllRangeNames final
: public ScSimpleUndo
26 ScUndoAllRangeNames(ScDocShell
* pDocSh
, const std::map
<OUString
, ScRangeName
*>& rOldNames
,
27 const std::map
<OUString
, std::unique_ptr
<ScRangeName
>>& rNewNames
);
29 virtual ~ScUndoAllRangeNames() override
;
31 virtual void Undo() override
;
32 virtual void Redo() override
;
33 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
34 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
35 virtual OUString
GetComment() const override
;
38 void DoChange(const std::map
<OUString
, std::unique_ptr
<ScRangeName
>>& rNames
);
41 std::map
<OUString
, std::unique_ptr
<ScRangeName
>> m_OldNames
;
42 std::map
<OUString
, std::unique_ptr
<ScRangeName
>> m_NewNames
;
45 class ScUndoAddRangeData final
: public ScSimpleUndo
48 // nTab = -1 for global range names
49 ScUndoAddRangeData(ScDocShell
* pDocSh
, const ScRangeData
* pRangeData
, SCTAB nTab
);
51 virtual ~ScUndoAddRangeData() override
;
53 virtual void Undo() override
;
54 virtual void Redo() override
;
55 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
56 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
57 virtual OUString
GetComment() const override
;
60 std::unique_ptr
<ScRangeData
> mpRangeData
;
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */