diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-10-07 11:32:55 -0400 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-26 07:42:14 +0200 |
commit | aef615ac9c69775bf51d5bf77d62686244f586af (patch) | |
tree | 7fe8ed1559dc90bbcbdd5b9cca71f11739399177 /sfx2 | |
parent | 15664117ef4db51bdcabb46b7990573509da0d73 (diff) |
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.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/sidebar/TabBar.cxx | 5 |
2 files changed, 14 insertions, 2 deletions
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: */ |