include/sfx2/sidebar/TabBar.hxx           |    3 +++
 sfx2/source/sidebar/SidebarController.cxx |   11 +++++++++--
 sfx2/source/sidebar/TabBar.cxx            |    5 +++++
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit aef615ac9c69775bf51d5bf77d62686244f586af
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Oct 7 11:32:55 2018 -0400
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jul 26 07:42:14 2019 +0200

    LOK: sfx2: disble sidebar menu-button when deck is hidden
    
    There is no render area on the sidebar virtual-device
    to render the popup menu when the sidebar is collapsed
    into the TabBar, so we disable it altogether as we
    can't properly display it in LoKit.
    
    Change-Id: I2edee9e734485bb685f0ddc0c30bfe584e42a550
    Reviewed-on: https://gerrit.libreoffice.org/73507
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index a6fcf6a33db4..1796094c3660 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -83,6 +83,9 @@ public:
 
     void UpdateFocusManager (FocusManager& rFocusManager);
 
+    /// Enables/Disables the menu button. Used by LoKit.
+    void EnableMenuButton(const bool bEnable);
+
 private:
     css::uno::Reference<css::frame::XFrame> mxFrame;
     VclPtr<CheckBox> mpMenuButton;
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 2e89c5137aae..b560e01c2a14 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -974,7 +974,8 @@ SidebarController::CreatePopupMenu(const 
::std::vector<TabBar::DeckMenuData>& rM
     FloatingWindow* pMenuWindow = 
dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
     if (pMenuWindow != nullptr)
     {
-        pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags() | 
FloatWinPopupFlags::NoMouseUpClose);
+        pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags()
+                                       | FloatWinPopupFlags::NoMouseUpClose);
     }
 
     // Create sub menu for customization (hiding of deck tabs), only on 
desktop.
@@ -1008,6 +1009,7 @@ SidebarController::CreatePopupMenu(const 
::std::vector<TabBar::DeckMenuData>& rM
                 pCustomizationMenu->CheckItem(nSubMenuIndex, rItem.mbIsEnabled 
&& rItem.mbIsActive);
             }
         }
+
         ++nIndex;
     }
 
@@ -1179,6 +1181,9 @@ void SidebarController::UpdateDeckOpenState()
             aNewSize.setWidth(mnSavedSidebarWidth);
 
             mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, 
aNewSize);
+            // Sidebar wide enought to render the menu; enable it.
+            if (comphelper::LibreOfficeKit::isActive())
+                mpTabBar->EnableMenuButton(true);
         }
     }
     else
@@ -1196,8 +1201,10 @@ void SidebarController::UpdateDeckOpenState()
             aNewSize.setWidth(nTabBarDefaultWidth);
 
             mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, 
aNewSize);
+            // Sidebar too narrow to render the menu; disable it.
+            if (comphelper::LibreOfficeKit::isActive())
+                mpTabBar->EnableMenuButton(false);
         }
-
         if (mnWidthOnSplitterButtonDown > nTabBarDefaultWidth)
             mnSavedSidebarWidth = mnWidthOnSplitterButtonDown;
         mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE);
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 8ca65efbadd7..9825a92eac10 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -411,6 +411,11 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked, Button*, void)
     mpMenuButton->Check(false);
 }
 
+void TabBar::EnableMenuButton(const bool bEnable)
+{
+    mpMenuButton->Enable(bEnable);
+}
+
 } } // end of namespace sfx2::sidebar
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to