diff options
-rw-r--r-- | include/sfx2/sidebar/ResourceManager.hxx | 9 | ||||
-rw-r--r-- | sfx2/source/sidebar/ResourceManager.cxx | 24 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 33 | ||||
-rw-r--r-- | svx/uiconfig/ui/themecoloreditdialog.ui | 3 |
4 files changed, 55 insertions, 14 deletions
diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx index 9ac1130cc29b..c3ea9abbc940 100644 --- a/include/sfx2/sidebar/ResourceManager.hxx +++ b/include/sfx2/sidebar/ResourceManager.hxx @@ -20,6 +20,7 @@ #include <unotools/confignode.hxx> #include <map> +#include <vcl/EnumContext.hxx> #include <vector> #include <set> @@ -89,6 +90,11 @@ public: const css::uno::Reference<css::frame::XController>& rxController); const OUString& GetLastActiveDeck( const Context& rContext ); + const std::map<OUString, OUString>& GetDeckOverrides() { + if (maApplicationDeckOverrides.empty()) + SetupOverrides(); + return maApplicationDeckOverrides; + } void SetLastActiveDeck( const Context& rContext, const OUString& rsDeckId ); /** Remember the expansions state per panel and context. @@ -107,10 +113,13 @@ private: PanelContainer maPanels; mutable std::set<OUString> maProcessedApplications; std::map<OUString, OUString> maLastActiveDecks; + // always jump to Deck on Application type, override last used + std::map<OUString, OUString> maApplicationDeckOverrides; void ReadDeckList(); void ReadPanelList(); void ReadLastActive(); + void SetupOverrides(); static void ReadContextList(const utl::OConfigurationNode& rNode, ContextList& rContextList, const OUString& rsDefaultMenuCommand); diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 433cd5091f31..9260438ad62c 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -33,7 +33,6 @@ #include <comphelper/diagnose_ex.hxx> #include <sal/log.hxx> -#include <vcl/EnumContext.hxx> #include <o3tl/string_view.hxx> #include <com/sun/star/frame/ModuleManager.hpp> @@ -237,6 +236,7 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc const OUString& ResourceManager::GetLastActiveDeck( const Context& rContext ) { + assert(!comphelper::LibreOfficeKit::isActive()); if( maLastActiveDecks.find( rContext.msApplication ) == maLastActiveDecks.end()) return maLastActiveDecks["any"]; else @@ -245,6 +245,7 @@ const OUString& ResourceManager::GetLastActiveDeck( const Context& rContext ) void ResourceManager::SetLastActiveDeck( const Context& rContext, const OUString &rsDeckId ) { + assert(!comphelper::LibreOfficeKit::isActive()); maLastActiveDecks[rContext.msApplication] = rsDeckId; } @@ -299,6 +300,9 @@ void ResourceManager::ReadDeckList() void ResourceManager::SaveDecksSettings(const Context& rContext) { + if (comphelper::LibreOfficeKit::isActive()) + return; + for (auto const& deck : maDecks) { const ContextList::Entry* pMatchingEntry = deck->maContextList.GetMatch(rContext); @@ -403,6 +407,9 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc) void ResourceManager::SaveLastActiveDeck(const Context& rContext, const OUString& rActiveDeck) { + if (comphelper::LibreOfficeKit::isActive()) + return; + maLastActiveDecks[rContext.msApplication] = rActiveDeck; std::set<OUString> aLastActiveDecks; @@ -467,6 +474,9 @@ void ResourceManager::ReadPanelList() void ResourceManager::ReadLastActive() { + if (comphelper::LibreOfficeKit::isActive()) + return; + const Sequence <OUString> aLastActive (officecfg::Office::UI::Sidebar::Content::LastActiveDeck::get()); for (const auto& rDeckInfo : aLastActive) @@ -488,9 +498,15 @@ void ResourceManager::ReadLastActive() } // Set up a default for Math - will do nothing if already set - maLastActiveDecks.emplace( - vcl::EnumContext::GetApplicationName(vcl::EnumContext::Application::Formula), - "ElementsDeck"); + for (const auto& aOverrideDeck : GetDeckOverrides()) + maLastActiveDecks.emplace(aOverrideDeck.first, aOverrideDeck.second); +} + +void ResourceManager::SetupOverrides() +{ + maApplicationDeckOverrides = { + { vcl::EnumContext::GetApplicationName(vcl::EnumContext::Application::Formula), "ElementsDeck" } + }; } void ResourceManager::ReadContextList ( diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 805514a7871f..313a7323e665 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -361,8 +361,12 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex maContextChangeUpdate.RequestCall(); // async call, not a prob // calling with held // solarmutex - // TODO: this call is redundant but mandatory for unit test to update context on document loading - if (!comphelper::LibreOfficeKit::isActive()) + + bool bSwitchedApp = maRequestedContext.msApplication != maCurrentContext.msApplication; + // Happens on reattach of sidebar to frame or context change + // LOK performance impact: prevents to switch sidebar on every keypress in multi user case + // Allow when enters embedded OLE (eg. Math formula editor second time) + if (!comphelper::LibreOfficeKit::isActive() || bSwitchedApp) UpdateConfigurations(); } } @@ -549,8 +553,10 @@ void SidebarController::UpdateConfigurations() && mnRequestedForceFlags == SwitchFlag_NoForce) return; - if ((maCurrentContext.msApplication != "none") && - !maCurrentContext.msApplication.isEmpty()) + bool bIsLOK = comphelper::LibreOfficeKit::isActive(); + + if (!bIsLOK && maCurrentContext.msApplication != "none" && + !maCurrentContext.msApplication.isEmpty()) { mpResourceManager->SaveDecksSettings(maCurrentContext); mpResourceManager->SetLastActiveDeck(maCurrentContext, msCurrentDeckId); @@ -558,11 +564,22 @@ void SidebarController::UpdateConfigurations() // get last active deck for this application on first update if (!maRequestedContext.msApplication.isEmpty() && - (maCurrentContext.msApplication != maRequestedContext.msApplication)) + (maCurrentContext.msApplication != maRequestedContext.msApplication)) { - OUString sLastActiveDeck = mpResourceManager->GetLastActiveDeck( maRequestedContext ); - if (!sLastActiveDeck.isEmpty()) - msCurrentDeckId = sLastActiveDeck; + if (bIsLOK) + { + // LOK has no last-used memory + const auto& rOverrides = mpResourceManager->GetDeckOverrides(); + const auto aOverride = rOverrides.find(maRequestedContext.msApplication); + if (aOverride != rOverrides.end()) + msCurrentDeckId = aOverride->second; + } + else + { + OUString sLastActiveDeck = mpResourceManager->GetLastActiveDeck( maRequestedContext ); + if (!sLastActiveDeck.isEmpty()) + msCurrentDeckId = sLastActiveDeck; + } } maCurrentContext = maRequestedContext; diff --git a/svx/uiconfig/ui/themecoloreditdialog.ui b/svx/uiconfig/ui/themecoloreditdialog.ui index 96276093a75a..ac0114ab4be1 100644 --- a/svx/uiconfig/ui/themecoloreditdialog.ui +++ b/svx/uiconfig/ui/themecoloreditdialog.ui @@ -3,13 +3,12 @@ <interface domain="svx"> <requires lib="gtk+" version="3.20"/> <object class="GtkDialog" id="ThemeColorEditDialog"> - <property name="width-request">400</property> - <property name="height-request">300</property> <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="border-width">6</property> <property name="title" translatable="yes" context="themedialog|Title">Theme Color Edit</property> + <property name="resizable">False</property> <property name="modal">True</property> <property name="type-hint">dialog</property> <child internal-child="vbox"> |