sfx2/source/sidebar/SidebarController.cxx | 66 +++++++++++++++++++----------- 1 file changed, 42 insertions(+), 24 deletions(-)
New commits: commit 7abb086b5dfa2eca3d6dafe3499ed517a73ae59c Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Oct 7 11:03:02 2018 -0400 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jul 25 20:47:49 2019 +0200 sfx2: customize the sidebar popup menu for Lokit Don't show customization or docking options. Change-Id: I313868cb2b2d0444ee90cf9709a326a81d0e5ed8 Reviewed-on: https://gerrit.libreoffice.org/73506 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index aa328608ffe3..2e89c5137aae 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -959,12 +959,15 @@ void SidebarController::ShowPopupMenu ( // pass toolbox button rect so the menu can stay open on button up tools::Rectangle aBox (rButtonBox); aBox.Move(mpTabBar->GetPosPixel().X(), 0); - pMenu->Execute(mpParentWindow, aBox, PopupMenuFlags::ExecuteDown); + const PopupMenuFlags aMenuDirection + = (comphelper::LibreOfficeKit::isActive() ? PopupMenuFlags::ExecuteLeft + : PopupMenuFlags::ExecuteDown); + pMenu->Execute(mpParentWindow, aBox, aMenuDirection); pMenu.disposeAndClear(); } -VclPtr<PopupMenu> SidebarController::CreatePopupMenu ( - const ::std::vector<TabBar::DeckMenuData>& rMenuData) const +VclPtr<PopupMenu> +SidebarController::CreatePopupMenu(const ::std::vector<TabBar::DeckMenuData>& rMenuData) const { // Create the top level popup menu. auto pMenu = VclPtr<PopupMenu>::Create(); @@ -974,8 +977,9 @@ VclPtr<PopupMenu> SidebarController::CreatePopupMenu ( pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags() | FloatWinPopupFlags::NoMouseUpClose); } - // Create sub menu for customization (hiding of deck tabs.) - VclPtr<PopupMenu> pCustomizationMenu = VclPtr<PopupMenu>::Create(); + // Create sub menu for customization (hiding of deck tabs), only on desktop. + VclPtr<PopupMenu> pCustomizationMenu + = (comphelper::LibreOfficeKit::isActive() ? nullptr : VclPtr<PopupMenu>::Create()); // Add one entry for every tool panel element to individually make // them visible or hide them. @@ -987,35 +991,49 @@ VclPtr<PopupMenu> SidebarController::CreatePopupMenu ( pMenu->CheckItem(nMenuIndex, rItem.mbIsCurrentDeck); pMenu->EnableItem(nMenuIndex, rItem.mbIsEnabled && rItem.mbIsActive); - const sal_Int32 nSubMenuIndex (nIndex+MID_FIRST_HIDE); - if (rItem.mbIsCurrentDeck) - { - // Don't allow the currently visible deck to be disabled. - pCustomizationMenu->InsertItem(nSubMenuIndex, rItem.msDisplayName, MenuItemBits::RADIOCHECK); - pCustomizationMenu->CheckItem(nSubMenuIndex); - } - else + if (!comphelper::LibreOfficeKit::isActive()) { - pCustomizationMenu->InsertItem(nSubMenuIndex, rItem.msDisplayName, MenuItemBits::CHECKABLE); - pCustomizationMenu->CheckItem(nSubMenuIndex, rItem.mbIsEnabled && rItem.mbIsActive); + const sal_Int32 nSubMenuIndex(nIndex + MID_FIRST_HIDE); + if (rItem.mbIsCurrentDeck) + { + // Don't allow the currently visible deck to be disabled. + pCustomizationMenu->InsertItem(nSubMenuIndex, rItem.msDisplayName, + MenuItemBits::RADIOCHECK); + pCustomizationMenu->CheckItem(nSubMenuIndex); + } + else + { + pCustomizationMenu->InsertItem(nSubMenuIndex, rItem.msDisplayName, + MenuItemBits::CHECKABLE); + pCustomizationMenu->CheckItem(nSubMenuIndex, rItem.mbIsEnabled && rItem.mbIsActive); + } } ++nIndex; } pMenu->InsertSeparator(); - // Add entry for docking or un-docking the tool panel. - if (mpParentWindow->IsFloatingMode()) - pMenu->InsertItem(MID_LOCK_TASK_PANEL, SfxResId(STR_SFX_DOCK)); - else - pMenu->InsertItem(MID_UNLOCK_TASK_PANEL, SfxResId(STR_SFX_UNDOCK)); + // LOK doesn't support docked/undocked; Sidebar is floating but rendered docked in browser. + if (!comphelper::LibreOfficeKit::isActive()) + { + // Add entry for docking or un-docking the tool panel. + if (mpParentWindow->IsFloatingMode()) + pMenu->InsertItem(MID_LOCK_TASK_PANEL, SfxResId(STR_SFX_DOCK)); + else + pMenu->InsertItem(MID_UNLOCK_TASK_PANEL, SfxResId(STR_SFX_UNDOCK)); + } pMenu->InsertItem(MID_HIDE_SIDEBAR, SfxResId(SFX_STR_SIDEBAR_HIDE_SIDEBAR)); - pCustomizationMenu->InsertSeparator(); - pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, SfxResId(SFX_STR_SIDEBAR_RESTORE)); - pMenu->InsertItem(MID_CUSTOMIZATION, SfxResId(SFX_STR_SIDEBAR_CUSTOMIZATION)); - pMenu->SetPopupMenu(MID_CUSTOMIZATION, pCustomizationMenu); + // No Restore or Customize options for LoKit. + if (!comphelper::LibreOfficeKit::isActive()) + { + pCustomizationMenu->InsertSeparator(); + pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, SfxResId(SFX_STR_SIDEBAR_RESTORE)); + + pMenu->InsertItem(MID_CUSTOMIZATION, SfxResId(SFX_STR_SIDEBAR_CUSTOMIZATION)); + pMenu->SetPopupMenu(MID_CUSTOMIZATION, pCustomizationMenu); + } pMenu->RemoveDisabledEntries(false); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits