diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-20 13:36:21 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-22 21:49:16 -0400 |
commit | 060c1f9048c713d03a9b051e4e9537d5992b8a13 (patch) | |
tree | cfcb89a81b6abd0e8468fee22cf5a2ef3f1bcdb0 /sc/source/ui/undo/undocell.cxx | |
parent | 25869d8c9bddb13e9b9fc5bff1494f8ca56a410e (diff) |
Implement the undo of arbitrary cells. Not used yet.
Change-Id: I99635829768ec7604f3387c4b0a22cb112fb9aca
Diffstat (limited to 'sc/source/ui/undo/undocell.cxx')
-rw-r--r-- | sc/source/ui/undo/undocell.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 756df86be938..13319d8b04cf 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -41,6 +41,7 @@ #include "chgtrack.hxx" #include "sc.hrc" #include "docuno.hxx" +#include "stringutil.hxx" using ::boost::shared_ptr; @@ -546,10 +547,12 @@ ScUndoSetCell::~ScUndoSetCell() {} void ScUndoSetCell::Undo() { + SetValue(maOldValue); } void ScUndoSetCell::Redo() { + SetValue(maNewValue); } void ScUndoSetCell::Repeat( SfxRepeatTarget& /*rTarget*/ ) @@ -567,6 +570,37 @@ OUString ScUndoSetCell::GetComment() const return ScGlobal::GetRscString(STR_UNDO_ENTERDATA); // "Input" } +void ScUndoSetCell::SetValue( const Value& rVal ) +{ + ScDocument* pDoc = pDocShell->GetDocument(); + + switch (rVal.meType) + { + case CELLTYPE_NONE: + // empty cell + pDoc->SetEmptyCell(maPos); + break; + case CELLTYPE_VALUE: + pDoc->SetValue(maPos, rVal.mfValue); + break; + case CELLTYPE_STRING: + { + ScSetStringParam aParam; + aParam.setTextInput(); + pDoc->SetString(maPos, *rVal.mpString); + } + break; + case CELLTYPE_EDIT: + pDoc->SetEditText(maPos, rVal.mpEditText->Clone()); + break; + case CELLTYPE_FORMULA: + pDoc->SetFormula(maPos, *rVal.mpFormulaCell->GetCode()); + break; + default: + ; + } +} + ScUndoPageBreak::ScUndoPageBreak( ScDocShell* pNewDocShell, SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, sal_Bool bNewColumn, sal_Bool bNewInsert ) : |