// For Gtk4 defer menu_button until after the contents have been // transferred to its final home (where the old parent is a GtkWindow to // support loading the accelerators in the menu for Gtk3)
mxMenuButton = mxAuxBuilder->weld_menu_button(u"menubutton"_ustr);
mxMainMenu = mxAuxBuilder->weld_menu(u"mainmenu"_ustr);
mxSubMenu = mxAuxBuilder->weld_menu(u"submenu"_ustr);
aPopupMenuSignalConnectFunction(*mxMainMenu, *mxSubMenu);
void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDecks)
{ // invisible with LOK, so keep empty to avoid invalidations if (comphelper::LibreOfficeKit::isActive()) return;
// Remove the current buttons.
maItems.clear(); for (autoconst& deck : rDecks)
{
std::shared_ptr<DeckDescriptor> xDescriptor = mrParentSidebarController.GetResourceManager()->GetDeckDescriptor(deck.msId); if (xDescriptor == nullptr)
{
OSL_ASSERT(xDescriptor!=nullptr); continue;
}
IMPL_LINK_NOARG(TabBar::Item, HandleClick, const OUString&, void)
{ // tdf#143146 copy the functor and arg before calling // GrabFocusToDocument which may destroy this object
DeckActivationFunctor aDeckActivationFunctor = maDeckActivationFunctor; auto sDeckId = msDeckId;
Context aContext;
aContext.msApplication = mrParentSidebarController.GetCurrentContext().msApplication; // leave aContext.msContext on default 'any' ... this func is used only for decks // and we don't have context-sensitive decks anyway
void TabBar::UpdateMenus()
{ if (Application::GetToolkitName() == u"gtk4"_ustr)
{
SAL_WARN("sfx", "Skipping update of sidebar menus to avoid crash due to gtk4 menu brokenness."); return;
}
for (int i = mxMainMenu->n_children() - 1; i >= 0; --i)
{
OUString sIdent = mxMainMenu->get_id(i); if (sIdent.startsWith("select"))
mxMainMenu->remove(sIdent);
} for (int i = mxSubMenu->n_children() - 1; i >= 0; --i)
{
OUString sIdent = mxSubMenu->get_id(i); if (sIdent.indexOf("customize") != -1)
mxSubMenu->remove(sIdent);
}
// Add one entry for every tool panel element to individually make // them visible or hide them.
sal_Int32 nIndex (0); for (autoconst& rItem : maItems)
{
std::shared_ptr<DeckDescriptor> xDeckDescriptor
= mrParentSidebarController.GetResourceManager()->GetDeckDescriptor(rItem->msDeckId);
if (!comphelper::LibreOfficeKit::isActive())
{ if (bCurrentDeck)
{ // Don't allow the currently visible deck to be disabled.
OUString sSubIdent("nocustomize" + OUString::number(nIndex));
mxSubMenu->insert(nIndex, sSubIdent, sDisplayName, nullptr, nullptr, nullptr,
TRISTATE_FALSE);
mxSubMenu->set_active(sSubIdent, true);
} else
{
OUString sSubIdent("customize" + OUString::number(nIndex));
mxSubMenu->insert(nIndex, sSubIdent, sDisplayName, nullptr, nullptr, nullptr,
TRISTATE_TRUE);
mxSubMenu->set_active(sSubIdent, bEnabled && bActive);
}
}
++nIndex;
}
bool bHideLock = true; bool bHideUnLock = true; // 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 (!mrParentSidebarController.IsDocked())
bHideLock = false; else
bHideUnLock = false;
}
mxMainMenu->set_visible(u"locktaskpanel"_ustr, !bHideLock);
mxMainMenu->set_visible(u"unlocktaskpanel"_ustr, !bHideUnLock);
// No Restore or Customize options for LoKit.
mxMainMenu->set_visible(u"customization"_ustr, !comphelper::LibreOfficeKit::isActive());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.