/src/libreoffice/sc/source/ui/undo/undocell2.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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 | | */ |
9 | | |
10 | | #include <undocell.hxx> |
11 | | #include <globstr.hrc> |
12 | | #include <scresid.hxx> |
13 | | #include <cellvalues.hxx> |
14 | | #include <formulacell.hxx> |
15 | | |
16 | | namespace sc { |
17 | | |
18 | | UndoSetCells::UndoSetCells( ScDocShell& rDocSh, const ScAddress& rTopPos ) : |
19 | 0 | ScSimpleUndo(rDocSh), maTopPos(rTopPos) {} |
20 | | |
21 | 0 | UndoSetCells::~UndoSetCells() {} |
22 | | |
23 | | void UndoSetCells::DoChange( const CellValues& rValues ) |
24 | 0 | { |
25 | 0 | ScDocument& rDoc = rDocShell.GetDocument(); |
26 | 0 | rDoc.CopyCellValuesFrom(maTopPos, rValues); |
27 | |
|
28 | 0 | ScRange aRange(maTopPos); |
29 | 0 | aRange.aEnd.IncRow(rValues.size()); |
30 | 0 | BroadcastChanges(aRange); |
31 | 0 | rDocShell.PostPaintGridAll(); |
32 | 0 | } |
33 | | |
34 | | void UndoSetCells::Undo() |
35 | 0 | { |
36 | 0 | BeginUndo(); |
37 | 0 | DoChange(maOldValues); |
38 | 0 | EndUndo(); |
39 | 0 | } |
40 | | |
41 | | void UndoSetCells::Redo() |
42 | 0 | { |
43 | 0 | BeginRedo(); |
44 | 0 | DoChange(maNewValues); |
45 | 0 | EndRedo(); |
46 | 0 | } |
47 | | |
48 | | bool UndoSetCells::CanRepeat( SfxRepeatTarget& ) const |
49 | 0 | { |
50 | 0 | return false; |
51 | 0 | } |
52 | | |
53 | | OUString UndoSetCells::GetComment() const |
54 | 0 | { |
55 | | // "Input" |
56 | 0 | return ScResId(STR_UNDO_ENTERDATA); |
57 | 0 | } |
58 | | |
59 | | void UndoSetCells::SetNewValues( const std::vector<double>& rVals ) |
60 | 0 | { |
61 | 0 | maNewValues.assign(rVals); |
62 | 0 | } |
63 | | |
64 | | void UndoSetCells::SetNewValues( const std::vector<ScFormulaCell*>& rVals ) |
65 | 0 | { |
66 | 0 | maNewValues.assign(rVals); |
67 | 0 | } |
68 | | |
69 | | } |
70 | | |
71 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |