summaryrefslogtreecommitdiff
path: root/sc/source/ui/undo/undoblk.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/undo/undoblk.cxx')
-rw-r--r--sc/source/ui/undo/undoblk.cxx53
1 files changed, 53 insertions, 0 deletions
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 8496fc236b2f..82ac93ad08a7 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -61,6 +61,7 @@ TYPEINIT1(ScUndoCut, ScBlockUndo);
TYPEINIT1(ScUndoPaste, SfxUndoAction);
TYPEINIT1(ScUndoDragDrop, SfxUndoAction);
TYPEINIT1(ScUndoListNames, SfxUndoAction);
+TYPEINIT1(ScUndoConditionalFormat, SfxUndoAction);
TYPEINIT1(ScUndoUseScenario, SfxUndoAction);
TYPEINIT1(ScUndoSelectionStyle, SfxUndoAction);
TYPEINIT1(ScUndoEnterMatrix, ScBlockUndo);
@@ -1430,6 +1431,58 @@ bool ScUndoListNames::CanRepeat(SfxRepeatTarget& rTarget) const
return rTarget.ISA(ScTabViewTarget);
}
+ScUndoConditionalFormat::ScUndoConditionalFormat(ScDocShell* pNewDocShell,
+ ScDocument* pUndoDoc, ScDocument* pRedoDoc, const ScRange& rRange):
+ ScSimpleUndo( pNewDocShell ),
+ mpUndoDoc(pUndoDoc),
+ mpRedoDoc(pRedoDoc),
+ maRange(rRange)
+{
+}
+
+ScUndoConditionalFormat::~ScUndoConditionalFormat()
+{
+}
+
+OUString ScUndoConditionalFormat::GetComment() const
+{
+ return OUString("Undo conditional format change");
+}
+
+void ScUndoConditionalFormat::Undo()
+{
+ DoChange(mpUndoDoc.get());
+}
+
+void ScUndoConditionalFormat::Redo()
+{
+ DoChange(mpRedoDoc.get());
+}
+
+void ScUndoConditionalFormat::DoChange(ScDocument* pSrcDoc)
+{
+ ScDocument* pDoc = pDocShell->GetDocument();
+
+ pDoc->DeleteAreaTab( maRange, IDF_ALL );
+ pSrcDoc->CopyToDocument( maRange, IDF_ALL, false, pDoc );
+ pDocShell->PostPaint( maRange, PAINT_GRID );
+ pDocShell->PostDataChanged();
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (pViewShell)
+ pViewShell->CellContentChanged();
+
+}
+
+void ScUndoConditionalFormat::Repeat(SfxRepeatTarget& )
+{
+}
+
+bool ScUndoConditionalFormat::CanRepeat(SfxRepeatTarget& ) const
+{
+ return false;
+}
+
+
ScUndoUseScenario::ScUndoUseScenario( ScDocShell* pNewDocShell,
const ScMarkData& rMark,
/*C*/ const ScArea& rDestArea,