Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / sc / inc / undorangename.hxx
blob50357f109e2dcad85c664d99a0cf74fca55e35b5
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 __SC_UNDORANGENAME_HXX__
11 #define __SC_UNDORANGENAME_HXX__
13 #include "undobase.hxx"
14 #include "rangenam.hxx"
15 #include <boost/ptr_container/ptr_map.hpp>
17 class ScDocShell;
19 /**
20 * Undo object for named ranges, both in global and sheet-local scopes.
22 class ScUndoAllRangeNames : public ScSimpleUndo
24 public:
25 ScUndoAllRangeNames(ScDocShell* pDocSh,
26 const std::map<OUString, ScRangeName*>& rOldNames,
27 const boost::ptr_map<OUString, ScRangeName>& rNewNames);
29 virtual ~ScUndoAllRangeNames();
31 virtual void Undo();
32 virtual void Redo();
33 virtual void Repeat(SfxRepeatTarget& rTarget);
34 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
35 virtual OUString GetComment() const;
37 private:
38 void DoChange(const boost::ptr_map<OUString, ScRangeName>& rNames);
40 private:
41 boost::ptr_map<OUString, ScRangeName> maOldNames;
42 boost::ptr_map<OUString, ScRangeName> maNewNames;
45 class ScUndoAddRangeData : public ScSimpleUndo
47 public:
48 // nTab = -1 for global range names
49 ScUndoAddRangeData(ScDocShell* pDocSh, ScRangeData* pRangeData, SCTAB nTab);
51 virtual ~ScUndoAddRangeData();
53 virtual void Undo();
54 virtual void Redo();
55 virtual void Repeat(SfxRepeatTarget& rTarget);
56 virtual bool CanRepeat(SfxRepeatTarget& rTarget) const;
57 virtual OUString GetComment() const;
59 private:
60 ScRangeData* mpRangeData;
61 SCTAB mnTab;
64 #endif
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */