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 <scresid.hxx>
13 #include <cellvalues.hxx>
14 #include <formulacell.hxx>
18 UndoSetCells::UndoSetCells( ScDocShell
* pDocSh
, const ScAddress
& rTopPos
) :
19 ScSimpleUndo(pDocSh
), maTopPos(rTopPos
) {}
21 UndoSetCells::~UndoSetCells() {}
23 void UndoSetCells::DoChange( const CellValues
& rValues
)
25 ScDocument
& rDoc
= pDocShell
->GetDocument();
26 rDoc
.CopyCellValuesFrom(maTopPos
, rValues
);
28 ScRange
aRange(maTopPos
);
29 aRange
.aEnd
.IncRow(rValues
.size());
30 BroadcastChanges(aRange
);
31 pDocShell
->PostPaintGridAll();
34 void UndoSetCells::Undo()
37 DoChange(maOldValues
);
41 void UndoSetCells::Redo()
44 DoChange(maNewValues
);
48 bool UndoSetCells::CanRepeat( SfxRepeatTarget
& ) const
53 OUString
UndoSetCells::GetComment() const
56 return ScResId(STR_UNDO_ENTERDATA
);
59 void UndoSetCells::SetNewValues( const std::vector
<double>& rVals
)
61 maNewValues
.assign(rVals
);
64 void UndoSetCells::SetNewValues( const std::vector
<ScFormulaCell
*>& rVals
)
66 maNewValues
.assign(rVals
);
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */