cid#1607171 Data race condition
[LibreOffice.git] / sc / source / ui / undo / undocell2.cxx
blob2222afa4224c5ee6328e87f328d3814ff767bc56
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/.
8 */
10 #include <undocell.hxx>
11 #include <globstr.hrc>
12 #include <scresid.hxx>
13 #include <cellvalues.hxx>
14 #include <formulacell.hxx>
16 namespace sc {
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()
36 BeginUndo();
37 DoChange(maOldValues);
38 EndUndo();
41 void UndoSetCells::Redo()
43 BeginRedo();
44 DoChange(maNewValues);
45 EndRedo();
48 bool UndoSetCells::CanRepeat( SfxRepeatTarget& ) const
50 return false;
53 OUString UndoSetCells::GetComment() const
55 // "Input"
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: */