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/.
10 #include <undocell.hxx>
11 #include <globstr.hrc>
12 #include <cellvalues.hxx>
16 UndoSetCells::UndoSetCells( ScDocShell
* pDocSh
, const ScAddress
& rTopPos
) :
17 ScSimpleUndo(pDocSh
), maTopPos(rTopPos
) {}
19 UndoSetCells::~UndoSetCells() {}
21 void UndoSetCells::DoChange( const CellValues
& rValues
)
23 ScDocument
& rDoc
= pDocShell
->GetDocument();
24 rDoc
.CopyCellValuesFrom(maTopPos
, rValues
);
26 ScRange
aRange(maTopPos
);
27 aRange
.aEnd
.IncRow(rValues
.size());
28 BroadcastChanges(aRange
);
29 pDocShell
->PostPaintGridAll();
32 void UndoSetCells::Undo()
35 DoChange(maOldValues
);
39 void UndoSetCells::Redo()
42 DoChange(maNewValues
);
46 bool UndoSetCells::CanRepeat( SfxRepeatTarget
& ) const
51 OUString
UndoSetCells::GetComment() const
54 return ScGlobal::GetRscString(STR_UNDO_ENTERDATA
);
57 void UndoSetCells::SetNewValues( const std::vector
<double>& rVals
)
59 maNewValues
.assign(rVals
);
64 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */