[Libreoffice-commits] core.git: include/sfx2 sd/source sfx2/source

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 26 18:18:30 UTC 2019


 include/sfx2/sidebar/Sidebar.hxx              |   10 ++++++++++
 sd/source/ui/view/ViewShellImplementation.cxx |    2 +-
 sd/source/ui/view/drviews2.cxx                |    2 +-
 sfx2/source/sidebar/Sidebar.cxx               |   22 ++++++++++++++++++++++
 4 files changed, 34 insertions(+), 2 deletions(-)

New commits:
commit 682a91a9c8822a6cfb5377b26facea2572f34027
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Dec 9 17:27:48 2018 -0500
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 26 20:17:22 2019 +0200

    sfx: LOK: toggle sidebar decks
    
    Change-Id: I0559a2a4ae041bc61cf3a2d5979656a7941f4b02
    Reviewed-on: https://gerrit.libreoffice.org/73518
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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)


More information about the Libreoffice-commits mailing list