summaryrefslogtreecommitdiffstats
path: root/sc/source/ui/undo/undotab.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sc/source/ui/undo/undotab.cxx26
1 files changed, 23 insertions, 3 deletions
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 4237aab463..0eacb70d1c 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -105,6 +105,9 @@ void ScUndoInsertTab::SetChangeTrack()
void ScUndoInsertTab::Undo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (!pViewShell)
+ return;
+
pViewShell->SetTabNo(nTab);
pDocShell->SetInUndo( true ); //! BeginUndo
@@ -126,6 +129,8 @@ void ScUndoInsertTab::Undo()
void ScUndoInsertTab::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (!pViewShell)
+ return;
RedoSdrUndoAction( pDrawUndo.get() ); // Draw Redo first
@@ -202,6 +207,9 @@ void ScUndoInsertTables::SetChangeTrack()
void ScUndoInsertTables::Undo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (!pViewShell)
+ return;
+
pViewShell->SetTabNo(nTab);
pDocShell->SetInUndo( true ); //! BeginUndo
@@ -225,6 +233,8 @@ void ScUndoInsertTables::Undo()
void ScUndoInsertTables::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (!pViewShell)
+ return;
RedoSdrUndoAction( pDrawUndo.get() ); // Draw Redo first
@@ -493,9 +503,11 @@ OUString ScUndoMoveTab::GetComment() const
void ScUndoMoveTab::DoChange( bool bUndo ) const
{
- ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (!pViewShell)
+ return;
+ ScDocument& rDoc = pDocShell->GetDocument();
if (bUndo) // UnDo
{
size_t i = mpNewTabs->size();
@@ -645,8 +657,11 @@ void ScUndoCopyTab::Undo()
void ScUndoCopyTab::Redo()
{
- ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (!pViewShell)
+ return;
+
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB nDestTab = 0;
for (size_t i = 0, n = mpNewTabs->size(); i < n; ++i)
@@ -883,6 +898,9 @@ OUString ScUndoImportTab::GetComment() const
void ScUndoImportTab::DoChange() const
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (!pViewShell)
+ return;
+
ScDocument& rDoc = pDocShell->GetDocument();
SCTAB nTabCount = rDoc.GetTableCount();
if (pViewShell)
@@ -1105,9 +1123,11 @@ ScUndoShowHideTab::~ScUndoShowHideTab()
void ScUndoShowHideTab::DoChange( bool bShowP ) const
{
- ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (!pViewShell)
+ return;
+ ScDocument& rDoc = pDocShell->GetDocument();
for(const SCTAB& nTab : undoTabs)
{
rDoc.SetVisible( nTab, bShowP );