cid#1607171 Data race condition
[LibreOffice.git] / sc / source / ui / undo / UndoEditSparkline.cxx
blob50b71fe630b7372d7e99340a4dfa60e7c5a95df3
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/.
9 */
11 #include <undo/UndoEditSparkline.hxx>
12 #include <globstr.hrc>
13 #include <scresid.hxx>
15 #include <Sparkline.hxx>
16 #include <utility>
18 namespace sc
20 UndoEditSparkline::UndoEditSparkline(ScDocShell& rDocShell,
21 std::shared_ptr<sc::Sparkline> pSparkline, SCTAB nTab,
22 ScRangeList aDataRange)
23 : ScSimpleUndo(&rDocShell)
24 , mpSparkline(std::move(pSparkline))
25 , mnTab(nTab)
26 , maOldDataRange(mpSparkline->getInputRange())
27 , maNewDataRange(std::move(aDataRange))
31 UndoEditSparkline::~UndoEditSparkline() = default;
33 void UndoEditSparkline::Undo()
35 BeginUndo();
37 mpSparkline->setInputRange(maOldDataRange);
39 pDocShell->PostPaintCell(ScAddress(mpSparkline->getColumn(), mpSparkline->getRow(), mnTab));
41 EndUndo();
44 void UndoEditSparkline::Redo()
46 BeginRedo();
48 mpSparkline->setInputRange(maNewDataRange);
50 pDocShell->PostPaintCell(ScAddress(mpSparkline->getColumn(), mpSparkline->getRow(), mnTab));
52 EndRedo();
55 void UndoEditSparkline::Repeat(SfxRepeatTarget& /*rTarget*/) {}
57 bool UndoEditSparkline::CanRepeat(SfxRepeatTarget& /*rTarget*/) const { return false; }
59 OUString UndoEditSparkline::GetComment() const { return ScResId(STR_UNDO_EDIT_SPARKLINE); }
61 } // end sc namespace
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */