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:12 +0100
commit9cf0ac710a6ace0a833fa193c7e18c4a7405bc42 (patch)
tree6a6dddf8e3aeae61659d477452eab92fab2aabfa
parent9334aa604f73bf659088c6a1cacba854cfdee5e4 (diff)
Resolves: tdf#100199 crash: switch to Display Mode - Master Modes - Notes
via toolbar Change-Id: I0ad3cce6d96cede8033a05e35c934c3163d214e3
-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 fb068fa26649..f0a6bb8d1cd1 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -127,12 +127,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: