summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-12-09 17:27:48 -0500
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-26 20:17:22 +0200
commit682a91a9c8822a6cfb5377b26facea2572f34027 (patch)
tree9fb7d3c43b5068fad2c56b4067afcb0af221f67f
parent937440b65368e832a9e9fba92dfdb2efec4e06b5 (diff)
sfx: LOK: toggle sidebar decks
Change-Id: I0559a2a4ae041bc61cf3a2d5979656a7941f4b02 Reviewed-on: https://gerrit.libreoffice.org/73518 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/sfx2/sidebar/Sidebar.hxx10
-rw-r--r--sd/source/ui/view/ViewShellImplementation.cxx2
-rw-r--r--sd/source/ui/view/drviews2.cxx2
-rw-r--r--sfx2/source/sidebar/Sidebar.cxx22
4 files changed, 34 insertions, 2 deletions
diff --git a/include/sfx2/sidebar/Sidebar.hxx b/include/sfx2/sidebar/Sidebar.hxx
index 427acf9c6c8b..30244f9988b1 100644
--- a/include/sfx2/sidebar/Sidebar.hxx
+++ b/include/sfx2/sidebar/Sidebar.hxx
@@ -44,6 +44,16 @@ public:
const OUString& rsPanelId,
const css::uno::Reference<css::frame::XFrame>& rxFrame, bool bFocus = false);
+ /** Switch to the deck that contains the specified panel and toggle
+ the visibility of the panel (expanded and scrolled into the
+ visible area when visible)
+ Note that most of the work is done asynchronously and that
+ this function probably returns before the requested panel is visible.
+ */
+ static void TogglePanel (
+ const OUString& rsPanelId,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
static bool IsPanelVisible(
const OUString& rsPanelId,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx
index a7d67677277e..b36d7d197c9f 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -122,7 +122,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot (
mrViewShell.GetDrawView()->SdrEndTextEdit();
mrViewShell.GetDrawView()->UnmarkAll();
mrViewShell.GetViewFrame()->ShowChildWindow(SID_SIDEBAR);
- sfx2::sidebar::Sidebar::ShowPanel(
+ sfx2::sidebar::Sidebar::TogglePanel(
"SdLayoutsPanel",
mrViewShell.GetViewFrame()->GetFrame().GetFrameInterface());
break;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 34fcc56b2243..7076ff93e1fe 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -3208,7 +3208,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
else if (nSId == SID_MASTER_SLIDES_PANEL)
panelId = "SdAllMasterPagesPanel";
- ::sfx2::sidebar::Sidebar::ShowPanel(
+ ::sfx2::sidebar::Sidebar::TogglePanel(
panelId,
GetViewFrame()->GetFrame().GetFrameInterface());
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<frame::XFrame>& rxFrame)
+{
+ SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
+ if (!pController)
+ return;
+
+ std::shared_ptr<PanelDescriptor> 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<frame::XFrame>& rxFrame)