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 #ifndef INCLUDED_SC_INC_UNDORANGENAME_HXX
11 #define INCLUDED_SC_INC_UNDORANGENAME_HXX
12 
13 #include <undobase.hxx>
14 
15 #include <memory>
16 #include <map>
17 
18 class ScDocShell;
19 
23 class ScUndoAllRangeNames final : public ScSimpleUndo
24 {
25 public:
26  ScUndoAllRangeNames(ScDocShell* pDocSh, const std::map<OUString, ScRangeName*>& rOldNames,
27  const std::map<OUString, std::unique_ptr<ScRangeName>>& rNewNames);
28 
29  virtual ~ScUndoAllRangeNames() override;
30 
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;
36 
37 private:
38  void DoChange(const std::map<OUString, std::unique_ptr<ScRangeName>>& rNames);
39 
40 private:
41  std::map<OUString, std::unique_ptr<ScRangeName>> m_OldNames;
42  std::map<OUString, std::unique_ptr<ScRangeName>> m_NewNames;
43 };
44 
45 class ScUndoAddRangeData final : public ScSimpleUndo
46 {
47 public:
48  // nTab = -1 for global range names
49  ScUndoAddRangeData(ScDocShell* pDocSh, const ScRangeData* pRangeData, SCTAB nTab);
50 
51  virtual ~ScUndoAddRangeData() override;
52 
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;
58 
59 private:
60  std::unique_ptr<ScRangeData> mpRangeData;
62 };
63 
64 #endif
65 
66 /* 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:23