LibreOffice Module sc (master)  1
undorangename.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
10 #pragma once
11 
12 #include <undobase.hxx>
13 
14 #include <memory>
15 #include <map>
16 
17 class ScDocShell;
18 
22 class ScUndoAllRangeNames final : public ScSimpleUndo
23 {
24 public:
25  ScUndoAllRangeNames(ScDocShell* pDocSh, const std::map<OUString, ScRangeName*>& rOldNames,
26  const std::map<OUString, std::unique_ptr<ScRangeName>>& rNewNames);
27 
28  virtual ~ScUndoAllRangeNames() override;
29 
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;
35 
36 private:
37  void DoChange(const std::map<OUString, std::unique_ptr<ScRangeName>>& rNames);
38 
39 private:
40  std::map<OUString, std::unique_ptr<ScRangeName>> m_OldNames;
41  std::map<OUString, std::unique_ptr<ScRangeName>> m_NewNames;
42 };
43 
44 class ScUndoAddRangeData final : public ScSimpleUndo
45 {
46 public:
47  // nTab = -1 for global range names
48  ScUndoAddRangeData(ScDocShell* pDocSh, const ScRangeData* pRangeData, SCTAB nTab);
49 
50  virtual ~ScUndoAddRangeData() override;
51 
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;
57 
58 private:
59  std::unique_ptr<ScRangeData> mpRangeData;
61 };
62 
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Undo() override
virtual ~ScUndoAllRangeNames() override
virtual void Redo() override
FilterGroup & rTarget
ScUndoAddRangeData(ScDocShell *pDocSh, const ScRangeData *pRangeData, SCTAB nTab)
virtual ~ScUndoAddRangeData() override
virtual void Redo() override
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
std::map< OUString, std::unique_ptr< ScRangeName > > m_OldNames
ScUndoAllRangeNames(ScDocShell *pDocSh, const std::map< OUString, ScRangeName * > &rOldNames, const std::map< OUString, std::unique_ptr< ScRangeName >> &rNewNames)
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual void Repeat(SfxRepeatTarget &rTarget) override
virtual OUString GetComment() const override
void DoChange(const std::map< OUString, std::unique_ptr< ScRangeName >> &rNames)
std::unique_ptr< ScRangeData > mpRangeData
virtual OUString GetComment() const override
virtual void Undo() override
std::map< OUString, std::unique_ptr< ScRangeName > > m_NewNames
Undo object for named ranges, both in global and sheet-local scopes.
virtual bool CanRepeat(SfxRepeatTarget &rTarget) const override
sal_Int16 SCTAB
Definition: types.hxx:22