LibreOffice Module sc (master) 1
undocell2.cxx
Go to the documentation of this file.
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
16namespace sc {
17
19 ScSimpleUndo(pDocSh), maTopPos(rTopPos) {}
20
22
23void UndoSetCells::DoChange( const CellValues& rValues )
24{
26 rDoc.CopyCellValuesFrom(maTopPos, rValues);
27
28 ScRange aRange(maTopPos);
29 aRange.aEnd.IncRow(rValues.size());
30 BroadcastChanges(aRange);
32}
33
35{
36 BeginUndo();
38 EndUndo();
39}
40
42{
43 BeginRedo();
45 EndRedo();
46}
47
48bool UndoSetCells::CanRepeat( SfxRepeatTarget& ) const
49{
50 return false;
51}
52
54{
55 // "Input"
56 return ScResId(STR_UNDO_ENTERDATA);
57}
58
59void UndoSetCells::SetNewValues( const std::vector<double>& rVals )
60{
61 maNewValues.assign(rVals);
62}
63
64void UndoSetCells::SetNewValues( const std::vector<ScFormulaCell*>& rVals )
65{
66 maNewValues.assign(rVals);
67}
68
69}
70
71/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void IncRow(SCROW nDelta=1)
Definition: address.hxx:312
void PostPaintGridAll()
Definition: docsh3.cxx:183
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
void CopyCellValuesFrom(const ScAddress &rTopPos, const sc::CellValues &rSrc)
Definition: document10.cxx:178
ScAddress aEnd
Definition: address.hxx:498
void BroadcastChanges(const ScRange &rRange)
Definition: undobase.cxx:177
void BeginRedo()
Definition: undobase.cxx:145
void EndRedo()
Definition: undobase.cxx:154
void EndUndo()
Definition: undobase.cxx:125
ScDocShell * pDocShell
Definition: undobase.hxx:50
void BeginUndo()
Definition: undobase.cxx:90
Think of this as a mini-ScColumn like storage that only stores cell values in a column.
Definition: cellvalues.hxx:42
void assign(const std::vector< double > &rVals)
Definition: cellvalues.cxx:92
size_t size() const
Definition: cellvalues.cxx:122
UndoSetCells(ScDocShell *pDocSh, const ScAddress &rTopPos)
Definition: undocell2.cxx:18
CellValues maNewValues
Definition: undocell.hxx:358
virtual void Redo() override
Definition: undocell2.cxx:41
void SetNewValues(const std::vector< double > &rVals)
Definition: undocell2.cxx:59
virtual ~UndoSetCells() override
Definition: undocell2.cxx:21
void DoChange(const CellValues &rValues)
Definition: undocell2.cxx:23
virtual void Undo() override
Definition: undocell2.cxx:34
ScAddress maTopPos
Definition: undocell.hxx:356
virtual OUString GetComment() const override
Definition: undocell2.cxx:53
CellValues maOldValues
Definition: undocell.hxx:357
virtual bool CanRepeat(SfxRepeatTarget &) const override
Definition: undocell2.cxx:48
CAUTION! The following defines must be in the same namespace as the respective type.
Definition: broadcast.cxx:15
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90