From 682a91a9c8822a6cfb5377b26facea2572f34027 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Sun, 9 Dec 2018 17:27:48 -0500 Subject: sfx: LOK: toggle sidebar decks Change-Id: I0559a2a4ae041bc61cf3a2d5979656a7941f4b02 Reviewed-on: https://gerrit.libreoffice.org/73518 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sfx2/source/sidebar/Sidebar.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'sfx2') diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx index 855da3113a36..ed12c0829302 100644 --- a/sfx2/source/sidebar/Sidebar.cxx +++ b/sfx2/source/sidebar/Sidebar.cxx @@ -51,6 +51,28 @@ void Sidebar::ShowPanel ( pController->GetFocusManager().GrabFocusPanel(); } +void Sidebar::TogglePanel ( + const OUString& rsPanelId, + const css::uno::Reference& rxFrame) +{ + SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame); + if (!pController) + return; + + std::shared_ptr xPanelDescriptor = pController->GetResourceManager()->GetPanelDescriptor(rsPanelId); + + if (!xPanelDescriptor) + return; + + // This should be a lot more sophisticated: + // - Make the deck switching asynchronous + // - Make sure to use a context that really shows the panel + + // All that is not necessary for the current use cases so lets + // keep it simple for the time being. + pController->OpenThenToggleDeck(xPanelDescriptor->msDeckId); +} + bool Sidebar::IsPanelVisible( const OUString& rsPanelId, const css::uno::Reference& rxFrame) -- cgit