sd/source/ui/dlg/navigatr.cxx |   21 +++++++++++++++++++++
 sd/source/ui/inc/navigatr.hxx |    7 ++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit a076bbc5261885d49c592acd46b238bd659ccb41
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Thu Mar 21 19:38:21 2024 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Fri Apr 5 20:21:07 2024 +0200

    SdNavigator: Make the sidebar panel not visible in outline and
    
    slide sorter view modes
    
    Inspired by the floating version behavior of not showing when in
    the outline or slide sorter view mode.
    
    Change-Id: I19ecb5751af7798527cf6b08ca766c367f177336
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165150
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 8b955ba07035..7423a8425eeb 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -796,6 +796,27 @@ void SdNavigatorWin::SetDragImage()
     mxToolbox->set_item_icon_name("dragmode", GetDragTypeSdBmpId(meDragType));
 }
 
+// for the sidebar to make the panel invisible when the shell type is outline 
or slide sorter
+void SdNavigatorWin::HandleContextChange(const vcl::EnumContext& eContext)
+{
+    if (eContext.GetApplication() != vcl::EnumContext::Application::Impress)
+        return;
+
+    ::sd::DrawDocShell* pCurrentDocShell
+            = dynamic_cast<::sd::DrawDocShell*>(SfxObjectShell::Current());
+    if (!pCurrentDocShell)
+        return;
+
+    const ::sd::DrawViewShell* pDrawViewShell
+            = 
static_cast<::sd::DrawViewShell*>(pCurrentDocShell->GetViewShell());
+    if (!pDrawViewShell)
+        return;
+
+    sd::ViewShell::ShellType eShellType = pDrawViewShell->GetShellType();
+    m_xContainer->set_visible(eShellType != sd::ViewShell::ST_OUTLINE
+            && eShellType != sd::ViewShell::ST_SLIDE_SORTER);
+}
+
 /**
  * ControllerItem for Navigator
  */
diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx
index 3e8ff9c28d21..a88ab7b4a2d6 100644
--- a/sd/source/ui/inc/navigatr.hxx
+++ b/sd/source/ui/inc/navigatr.hxx
@@ -25,6 +25,9 @@
 #include "sdtreelb.hxx"
 #include <pres.hxx>
 
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <vcl/EnumContext.hxx>
+
 // forward
 namespace vcl { class Window; }
 
@@ -97,7 +100,7 @@ public:
 
 }
 
-class SD_DLLPUBLIC SdNavigatorWin : public PanelLayout
+class SD_DLLPUBLIC SdNavigatorWin : public PanelLayout, public 
sfx2::sidebar::IContextChangeReceiver
 {
 public:
     typedef ::std::function<void ()> UpdateRequestFunctor;
@@ -122,6 +125,8 @@ public:
     NavigatorDragType           GetNavigatorDragType();
     SdPageObjsTLV&              GetObjects();
 
+    virtual void HandleContextChange(const vcl::EnumContext& eContext) 
override;
+
 private:
     friend class SdNavigatorFloat;
     friend class SdNavigatorControllerItem;

Reply via email to