/src/libreoffice/sc/source/ui/inc/undo/UndoUngroupSparklines.hxx
Line | Count | Source (jump to first uncovered line) |
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 | | |
11 | | #pragma once |
12 | | |
13 | | #include <undobase.hxx> |
14 | | #include <memory> |
15 | | #include <utility> |
16 | | |
17 | | namespace sc |
18 | | { |
19 | | /** Previous sparkline group data, which is restored at undo ungroupping */ |
20 | | struct SparklineUndoData |
21 | | { |
22 | | SparklineUndoData(ScAddress const& rAddress, ScRangeList aDataRangeList, |
23 | | std::shared_ptr<sc::SparklineGroup> pGroup) |
24 | 0 | : m_aAddress(rAddress) |
25 | 0 | , m_aDataRangeList(std::move(aDataRangeList)) |
26 | 0 | , m_pSparklineGroup(std::move(pGroup)) |
27 | 0 | { |
28 | 0 | } |
29 | | |
30 | | ScAddress m_aAddress; |
31 | | ScRangeList m_aDataRangeList; |
32 | | std::shared_ptr<sc::SparklineGroup> m_pSparklineGroup; |
33 | | }; |
34 | | |
35 | | /** Undo action for ungrouping sparklines */ |
36 | | class UndoUngroupSparklines : public ScSimpleUndo |
37 | | { |
38 | | private: |
39 | | ScRange m_aRange; |
40 | | std::vector<SparklineUndoData> m_aUndoData; |
41 | | |
42 | | public: |
43 | | UndoUngroupSparklines(ScDocShell& rDocShell, ScRange const& rRange); |
44 | | virtual ~UndoUngroupSparklines() override; |
45 | | |
46 | | void Undo() override; |
47 | | void Redo() override; |
48 | | bool CanRepeat(SfxRepeatTarget& rTarget) const override; |
49 | | void Repeat(SfxRepeatTarget& rTarget) override; |
50 | | OUString GetComment() const override; |
51 | | }; |
52 | | |
53 | | } // namespace sc |
54 | | |
55 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |