1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
11 #include <undo/UndoEditSparkline.hxx>
12 #include <globstr.hrc>
13 #include <scresid.hxx>
15 #include <Sparkline.hxx>
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
))
26 , maOldDataRange(mpSparkline
->getInputRange())
27 , maNewDataRange(std::move(aDataRange
))
31 UndoEditSparkline::~UndoEditSparkline() = default;
33 void UndoEditSparkline::Undo()
37 mpSparkline
->setInputRange(maOldDataRange
);
39 pDocShell
->PostPaintCell(ScAddress(mpSparkline
->getColumn(), mpSparkline
->getRow(), mnTab
));
44 void UndoEditSparkline::Redo()
48 mpSparkline
->setInputRange(maNewDataRange
);
50 pDocShell
->PostPaintCell(ScAddress(mpSparkline
->getColumn(), mpSparkline
->getRow(), mnTab
));
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
); }
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */