/src/libreoffice/sc/source/ui/inc/undomanager.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ |
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 | | #pragma once |
10 | | |
11 | | #include <svx/sdrundomanager.hxx> |
12 | | #include <scdllapi.h> |
13 | | #include <address.hxx> |
14 | | |
15 | | class SfxViewShell; |
16 | | class ScSimpleUndo; |
17 | | |
18 | | class SC_DLLPUBLIC ScUndoManager : public SdrUndoManager |
19 | | { |
20 | | public: |
21 | | ~ScUndoManager(); |
22 | | |
23 | | /** |
24 | | * Checks if the topmost undo action owned by pView is independent from the topmost action undo |
25 | | * action. Sets rOffset to the offset of that independent undo action on success. |
26 | | */ |
27 | | bool IsViewUndoActionIndependent(const SfxViewShell* pView, sal_uInt16& rOffset) const; |
28 | | |
29 | | /// Make these public |
30 | | using SdrUndoManager::UndoWithContext; |
31 | | using SdrUndoManager::RedoWithContext; |
32 | | using SdrUndoManager::UndoMark; |
33 | | |
34 | | private: |
35 | | static std::optional<ScRange> getAffectedRangeFromUndo(const SfxUndoAction*); |
36 | | static const ScSimpleUndo* getScSimpleUndo(const SfxUndoAction*); |
37 | | }; |
38 | | |
39 | | class ScUndoRedoContext final : public SfxUndoContext |
40 | | { |
41 | | public: |
42 | 0 | void SetUndoOffset(size_t nUndoOffset) { m_nUndoOffset = nUndoOffset; } |
43 | | |
44 | 0 | size_t GetUndoOffset() override { return m_nUndoOffset; } |
45 | | |
46 | | private: |
47 | | size_t m_nUndoOffset = 0; |
48 | | }; |
49 | | |
50 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |