diff options
Diffstat (limited to 'sfx2/source/sidebar/Sidebar.cxx')
-rw-r--r-- | sfx2/source/sidebar/Sidebar.cxx | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx index 2a59ad7ef163..ca48542d5403 100644 --- a/sfx2/source/sidebar/Sidebar.cxx +++ b/sfx2/source/sidebar/Sidebar.cxx @@ -41,22 +41,23 @@ void Sidebar::ToggleDeck(std::u16string_view rsDeckId, SfxViewFrame* pViewFrame) if (!bInitiallyVisible) pViewFrame->ShowChildWindow(SID_SIDEBAR); - if (SidebarController* pController = - SidebarController::GetSidebarControllerForFrame(pViewFrame->GetFrame().GetFrameInterface())) + SidebarController* pController = + SidebarController::GetSidebarControllerForFrame(pViewFrame->GetFrame().GetFrameInterface()); + if (!pController) + return; + + if (bInitiallyVisible && pController->IsDeckVisible(rsDeckId)) { - if (bInitiallyVisible && pController->IsDeckVisible(rsDeckId)) - { - // close the sidebar if it was already visible and showing this sidebar deck - const util::URL aURL(Tools::GetURL(".uno:Sidebar")); - css::uno::Reference<frame::XDispatch> xDispatch(Tools::GetDispatch(pViewFrame->GetFrame().GetFrameInterface(), aURL)); - if (xDispatch.is()) - xDispatch->dispatch(aURL, css::uno::Sequence<beans::PropertyValue>()); - } - else - { - pController->OpenThenSwitchToDeck(rsDeckId); - pController->GetFocusManager().GrabFocusPanel(); - } + // close the sidebar if it was already visible and showing this sidebar deck + const util::URL aURL(Tools::GetURL(".uno:Sidebar")); + css::uno::Reference<frame::XDispatch> xDispatch(Tools::GetDispatch(pViewFrame->GetFrame().GetFrameInterface(), aURL)); + if (xDispatch.is()) + xDispatch->dispatch(aURL, css::uno::Sequence<beans::PropertyValue>()); + } + else + { + pController->OpenThenSwitchToDeck(rsDeckId); + pController->GetFocusManager().GrabFocusPanel(); } } |