summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-06-03 09:18:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-06-03 09:31:41 +0100
commit05560f10b4652f97949f44b9377c2e2355c21602 (patch)
tree0c9d79f061021dd5122815bbed12608fca7dd996
parent63c54ea482ad11b5fcb883f1583c62456cf34ba5 (diff)
Resolves: tdf#100199 crash: switch to Display Mode - Master Modes - Notes
via toolbar Change-Id: I0ad3cce6d96cede8033a05e35c934c3163d214e3 (cherry picked from commit 9cf0ac710a6ace0a833fa193c7e18c4a7405bc42)
-rw-r--r--sd/source/ui/sidebar/SlideBackground.cxx15
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx45
2 files changed, 39 insertions, 21 deletions
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index f6c7d89fe88a..fd728d6a0076 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -174,12 +174,15 @@ void SlideBackground::Initialize()
mpFillGrad->SetSelectHdl(LINK(this, SlideBackground, FillColorHdl));
mpFillAttr->SetSelectHdl(LINK(this, SlideBackground, FillBackgroundHdl));
- ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
- DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell);
- SdPage* mpPage = pDrawViewShell->getCurrentPage();
- OUString aLayoutName( mpPage->GetLayoutName() );
- aLayoutName = aLayoutName.copy(0,aLayoutName.indexOf(SD_LT_SEPARATOR));
- mpMasterSlide->SelectEntry(aLayoutName);
+ if (ViewShell* pMainViewShell = mrBase.GetMainViewShell().get())
+ {
+ DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell);
+ SdPage* mpPage = pDrawViewShell->getCurrentPage();
+ OUString aLayoutName( mpPage->GetLayoutName() );
+ aLayoutName = aLayoutName.copy(0,aLayoutName.indexOf(SD_LT_SEPARATOR));
+ mpMasterSlide->SelectEntry(aLayoutName);
+ }
+
mpFillStyle->SelectEntryPos(0);
mpDspMasterBackground->SetClickHdl(LINK(this, SlideBackground, DspBackground));
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index b0db26731767..72b3f3b94532 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -1243,15 +1243,21 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
break;
case SID_NORMAL_MULTI_PANE_GUI:
- pFrameView = mrBase.GetMainViewShell()->GetFrameView();
- bState = pFrameView->GetViewShEditMode() == EM_PAGE
- && pFrameView->GetPageKind() == PK_STANDARD;
+ if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+ {
+ pFrameView = pViewShell->GetFrameView();
+ bState = pFrameView->GetViewShEditMode() == EM_PAGE
+ && pFrameView->GetPageKind() == PK_STANDARD;
+ }
break;
case SID_SLIDE_MASTER_MODE:
- pFrameView = mrBase.GetMainViewShell()->GetFrameView();
- bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
- && pFrameView->GetPageKind() == PK_STANDARD;
+ if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+ {
+ pFrameView = pViewShell->GetFrameView();
+ bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
+ && pFrameView->GetPageKind() == PK_STANDARD;
+ }
break;
case SID_SLIDE_SORTER_MULTI_PANE_GUI:
@@ -1272,21 +1278,30 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
break;
case SID_HANDOUT_MASTER_MODE:
- pFrameView = mrBase.GetMainViewShell()->GetFrameView();
- bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
- && pFrameView->GetPageKind() == PK_HANDOUT;
+ if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+ {
+ pFrameView = pViewShell->GetFrameView();
+ bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
+ && pFrameView->GetPageKind() == PK_HANDOUT;
+ }
break;
case SID_NOTES_MODE:
- pFrameView = mrBase.GetMainViewShell()->GetFrameView();
- bState = pFrameView->GetViewShEditMode() == EM_PAGE
- && pFrameView->GetPageKind() == PK_NOTES;
+ if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+ {
+ pFrameView = pViewShell->GetFrameView();
+ bState = pFrameView->GetViewShEditMode() == EM_PAGE
+ && pFrameView->GetPageKind() == PK_NOTES;
+ }
break;
case SID_NOTES_MASTER_MODE:
- pFrameView = mrBase.GetMainViewShell()->GetFrameView();
- bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
- && pFrameView->GetPageKind() == PK_NOTES;
+ if (ViewShell* pViewShell = mrBase.GetMainViewShell().get())
+ {
+ pFrameView = pViewShell->GetFrameView();
+ bState = pFrameView->GetViewShEditMode() == EM_MASTERPAGE
+ && pFrameView->GetPageKind() == PK_NOTES;
+ }
break;
case SID_TOGGLE_TABBAR_VISIBILITY: