summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorIvan Timofeev <timofeev.i.s@gmail.com>2012-08-30 23:21:49 +0400
committerIvan Timofeev <timofeev.i.s@gmail.com>2012-08-31 08:35:18 +0400
commit4deb9d4e0f29dd6947322aea665ee65ea8ef9ec4 (patch)
treea3c9ad5376a8424a242988c576ac112d956cadae /svx/source/svdraw
parentc050300a72f80ab838bd10f0cedd355048a2aaa5 (diff)
SdrModel: make sure undo/redo stacks are not empty
most probably Undo() does not get called if there is no undo actions, just to be on the safe side. Change-Id: I3597698dbe8208916be94ebddd7260fbd7eadc74
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r--svx/source/svdraw/svdmodel.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 14d45d61b962..9938a1f286b1 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -431,6 +431,16 @@ void SdrModel::ClearUndoBuffer()
}
}
+bool SdrModel::HasUndoActions() const
+{
+ return pUndoStack && !pUndoStack->empty();
+}
+
+bool SdrModel::HasRedoActions() const
+{
+ return pRedoStack && !pRedoStack->empty();
+}
+
bool SdrModel::Undo()
{
bool bRet = false;
@@ -440,7 +450,7 @@ bool SdrModel::Undo()
}
else
{
- SfxUndoAction* pDo=(SfxUndoAction*)GetUndoAction(0);
+ SfxUndoAction* pDo = HasUndoActions() ? pUndoStack->front() : NULL;
if(pDo!=NULL)
{
const bool bWasUndoEnabled = mbUndoEnabled;
@@ -466,7 +476,7 @@ bool SdrModel::Redo()
}
else
{
- SfxUndoAction* pDo=(SfxUndoAction*)GetRedoAction(0);
+ SfxUndoAction* pDo = HasRedoActions() ? pRedoStack->front() : NULL;
if(pDo!=NULL)
{
const bool bWasUndoEnabled = mbUndoEnabled;
@@ -492,7 +502,7 @@ bool SdrModel::Repeat(SfxRepeatTarget& rView)
}
else
{
- SfxUndoAction* pDo=(SfxUndoAction*)GetUndoAction(0);
+ SfxUndoAction* pDo = HasUndoActions() ? pUndoStack->front() : NULL;
if(pDo!=NULL)
{
if(pDo->CanRepeat(rView))