diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-29 23:35:34 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-30 11:57:00 -0500 |
commit | a0bd814fb5c2ed1d8a1583eb59c783290c7c3dc9 (patch) | |
tree | de2c5088bfedd77def56342bb8de53053fba9e78 /sc/source/ui/undo/undocell2.cxx | |
parent | a28dc1dbedb32d18f8be4ef7eebff2281454e12b (diff) |
Speed up filling of random number generation over entire column.
Because nobody wants to wait forever...
Change-Id: Ie52bff944893b7e3fe9e7908be19d27c692fc1ea
Diffstat (limited to 'sc/source/ui/undo/undocell2.cxx')
-rw-r--r-- | sc/source/ui/undo/undocell2.cxx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/sc/source/ui/undo/undocell2.cxx b/sc/source/ui/undo/undocell2.cxx new file mode 100644 index 000000000000..f4b5d9376ad2 --- /dev/null +++ b/sc/source/ui/undo/undocell2.cxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <undocell.hxx> +#include <globstr.hrc> +#include <cellvalues.hxx> + +namespace sc { + +UndoSetCells::UndoSetCells( ScDocShell* pDocSh, const ScAddress& rTopPos ) : + ScSimpleUndo(pDocSh), maTopPos(rTopPos) {} + +UndoSetCells::~UndoSetCells() {} + +void UndoSetCells::DoChange( const CellValues& rValues ) +{ + ScDocument* pDoc = pDocShell->GetDocument(); + pDoc->CopyCellValuesFrom(maTopPos, rValues); + + ScRange aRange(maTopPos); + aRange.aEnd.IncRow(rValues.size()); + BroadcastChanges(aRange); + pDocShell->PostPaintGridAll(); +} + +void UndoSetCells::Undo() +{ + BeginUndo(); + DoChange(maOldValues); + EndUndo(); +} + +void UndoSetCells::Redo() +{ + BeginRedo(); + DoChange(maNewValues); + EndRedo(); +} + +bool UndoSetCells::CanRepeat( SfxRepeatTarget& ) const +{ + return false; +} + +OUString UndoSetCells::GetComment() const +{ + // "Input" + return ScGlobal::GetRscString(STR_UNDO_ENTERDATA); +} + +CellValues& UndoSetCells::GetOldValues() +{ + return maOldValues; +} + +void UndoSetCells::SetNewValues( const std::vector<double>& rVals ) +{ + maNewValues.assign(rVals); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |