From 83829de5ad87240d2c54925da23a84c1e8964c54 Mon Sep 17 00:00:00 2001 From: Gökay Şatır Date: Mon, 20 Mar 2023 11:17:37 +0300 Subject: Revert "[API CHANGE] Add createShortCutManager function to..." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 67fcd647341118747a4e7cd404d907d29613778c. Signed-off-by: Gökay Şatır Change-Id: I9d0652df63ab7ce9b220aff37008b18d8d511a03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149138 Tested-by: Jenkins CollaboraOffice --- .../moduleuiconfigurationmanager.cxx | 6 ---- .../uiconfiguration/uiconfigurationmanager.cxx | 6 ---- include/sfx2/app.hxx | 4 --- include/svtools/acceleratorexecute.hxx | 2 -- offapi/com/sun/star/ui/XUIConfigurationManager.idl | 7 ---- sfx2/source/appl/app.cxx | 5 --- sfx2/source/inc/appdata.hxx | 2 -- sfx2/source/view/lokhelper.cxx | 6 ++-- sfx2/source/view/viewsh.cxx | 41 ---------------------- svtools/source/misc/acceleratorexecute.cxx | 23 ------------ 10 files changed, 3 insertions(+), 99 deletions(-) diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index d20c4764dc57..b2346455d228 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -122,7 +122,6 @@ public: virtual void SAL_CALL insertSettings( const OUString& NewResourceURL, const css::uno::Reference< css::container::XIndexAccess >& aNewData ) override; virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getImageManager() override; virtual css::uno::Reference< css::ui::XAcceleratorConfiguration > SAL_CALL getShortCutManager() override; - virtual css::uno::Reference< css::ui::XAcceleratorConfiguration > SAL_CALL createShortCutManager() override; virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getEventsManager() override; // XModuleUIConfigurationManager @@ -1409,11 +1408,6 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager() return Reference< XInterface >( static_cast(m_xModuleImageManager.get()), UNO_QUERY ); } -Reference< ui::XAcceleratorConfiguration > SAL_CALL ModuleUIConfigurationManager::createShortCutManager() -{ - return ui::ModuleAcceleratorConfiguration::createWithModuleIdentifier(m_xContext, m_aModuleIdentifier); -} - Reference< ui::XAcceleratorConfiguration > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() { SolarMutexGuard g; diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 2203090fbeef..495bbb573896 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -111,7 +111,6 @@ public: virtual void SAL_CALL insertSettings( const OUString& NewResourceURL, const css::uno::Reference< css::container::XIndexAccess >& aNewData ) override; virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getImageManager() override; virtual css::uno::Reference< css::ui::XAcceleratorConfiguration > SAL_CALL getShortCutManager() override; - virtual css::uno::Reference< css::ui::XAcceleratorConfiguration > SAL_CALL createShortCutManager() override; virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getEventsManager() override; // XUIConfigurationPersistence @@ -1126,11 +1125,6 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager() return Reference< XInterface >( static_cast(m_xImageManager.get()), UNO_QUERY ); } -Reference< XAcceleratorConfiguration > SAL_CALL UIConfigurationManager::createShortCutManager() -{ - return DocumentAcceleratorConfiguration::createWithDocumentRoot(m_xContext, m_xDocConfigStorage); -} - Reference< XAcceleratorConfiguration > SAL_CALL UIConfigurationManager::getShortCutManager() { // SAFE -> diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index 6687dc1f1653..fd8e556c7af1 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -27,8 +27,6 @@ #include #include #include -#include -#include #include @@ -175,8 +173,6 @@ public: SAL_DLLPRIVATE SfxChildWinFactory* GetChildWinFactoryById(sal_uInt16 nId) const; SAL_DLLPRIVATE std::vector& GetViewFrames_Impl() const; SAL_DLLPRIVATE std::vector& GetViewShells_Impl() const; - /* unordered_map */ - SAL_DLLPRIVATE std::unordered_map>& GetAcceleratorConfs_Impl() const; SAL_DLLPRIVATE std::vector& GetObjectShells_Impl() const; SAL_DLLPRIVATE void SetViewFrame_Impl(SfxViewFrame *pViewFrame); diff --git a/include/svtools/acceleratorexecute.hxx b/include/svtools/acceleratorexecute.hxx index 5d5ac4ca71c7..f43fefe43507 100644 --- a/include/svtools/acceleratorexecute.hxx +++ b/include/svtools/acceleratorexecute.hxx @@ -175,8 +175,6 @@ class SVT_DLLPUBLIC AcceleratorExecute final static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openModuleConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext , const css::uno::Reference< css::frame::XFrame >& xFrame); - static css::uno::Reference lok_createNewAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& rxContext, OUString sModule); - void lok_setModuleConfig(css::uno::Reference acceleratorConfig); /** TODO document me */ static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openDocConfig(const css::uno::Reference< css::frame::XModel >& xModel); diff --git a/offapi/com/sun/star/ui/XUIConfigurationManager.idl b/offapi/com/sun/star/ui/XUIConfigurationManager.idl index 492d388d4402..cf18387f0ecb 100644 --- a/offapi/com/sun/star/ui/XUIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/XUIConfigurationManager.idl @@ -218,13 +218,6 @@ interface XUIConfigurationManager : ::com::sun::star::uno::XInterface */ com::sun::star::ui::XAcceleratorConfiguration getShortCutManager(); - /** - @since LibreOffice 7.6 - Creates a new configuration manager in case there are different views with different languages. - This function enables those views to have short cut keys specific to the languages. - */ - com::sun::star::ui::XAcceleratorConfiguration createShortCutManager(); - /** retrieves the events manager from the user interface configuration manager.

diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 2f7fec749a9c..293deabad99d 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -378,11 +378,6 @@ std::vector& SfxApplication::GetViewShells_Impl() const return pImpl->maViewShells; } -std::unordered_map>& SfxApplication::GetAcceleratorConfs_Impl() const -{ - return pImpl->maAcceleratorConfs; -} - std::vector& SfxApplication::GetObjectShells_Impl() const { return pImpl->maObjShells; diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 05a4e19eb217..121ba43f5581 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -32,7 +32,6 @@ #include #include #include "sfxpicklist.hxx" -#include "com/sun/star/ui/XAcceleratorConfiguration.hpp" #include #include @@ -101,7 +100,6 @@ public: maStbCtrlFactories; std::vector maViewFrames; std::vector maViewShells; - std::unordered_map> maAcceleratorConfs; std::vector maObjShells; std::unique_ptr diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 8bf9d36d0beb..166aa124777e 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -170,13 +170,13 @@ void SfxLokHelper::setView(int nId) { DisableCallbacks dc; - if (pViewShell == SfxViewShell::Current()) - return; - // update the current LOK language and locale for the dialog tunneling comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale()); + if (pViewShell == SfxViewShell::Current()) + return; + SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); pViewFrame->MakeActive_Impl(false); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 1e847d2e5149..28b133174aef 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -47,7 +47,6 @@ #include #include #include -#include #include #include @@ -90,7 +89,6 @@ #include #include #include -#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -1412,50 +1410,11 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC, bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) { - bool setModuleConfig = false; // In case libreofficekit is active, we will re-set the module config class. if (!pImpl->m_xAccExec) { pImpl->m_xAccExec = ::svt::AcceleratorExecute::createAcceleratorHelper(); pImpl->m_xAccExec->init(::comphelper::getProcessComponentContext(), pFrame->GetFrame().GetFrameInterface()); - setModuleConfig = true; - } - - if (comphelper::LibreOfficeKit::isActive()) - { - // Get the module name. - css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext()); - css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext)); - OUString sModule = xModuleManager->identify(pFrame->GetFrame().GetFrameInterface()); - - // Get the language name. - OUString viewLang = GetLOKLanguageTag().getBcp47(); - - // Merge them & have a key. - OUString key = sModule + viewLang; - - // Check it in configurations map. Create a configuration manager if there isn't one for the key. - std::unordered_map>& acceleratorConfs = SfxApplication::Get()->GetAcceleratorConfs_Impl(); - if (acceleratorConfs.find(key) == acceleratorConfs.end()) - { - // Create a new configuration manager for the module. - - OUString actualLang = officecfg::Setup::L10N::ooLocale::get(); - - std::shared_ptr batch(comphelper::ConfigurationChanges::create()); - officecfg::Setup::L10N::ooLocale::set(viewLang, batch); - batch->commit(); - - // We have set the language. Time to create the config manager. - acceleratorConfs[key] = svt::AcceleratorExecute::lok_createNewAcceleratorConfiguration(::comphelper::getProcessComponentContext(), sModule); - - std::shared_ptr batch2(comphelper::ConfigurationChanges::create()); - officecfg::Setup::L10N::ooLocale::set(actualLang, batch2); - batch2->commit(); - } - - if (setModuleConfig) - pImpl->m_xAccExec->lok_setModuleConfig(acceleratorConfs[key]); } return pImpl->m_xAccExec->execute(aKey.GetKeyCode()); diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index bc25a45661bd..9fa76e56deaf 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -38,8 +38,6 @@ #include #include -#include - namespace svt { @@ -408,27 +406,6 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st return xAccCfg; } -css::uno::Reference AcceleratorExecute::lok_createNewAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& rxContext, OUString sModule) -{ - css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUISupplier(css::ui::theModuleUIConfigurationManagerSupplier::get(rxContext)); - - try - { - css::uno::Reference xUIManager = xUISupplier->getUIConfigurationManager(sModule); - - // Return new short cut manager in case current view's language is different from previous ones. - return xUIManager->createShortCutManager(); - } - catch(const css::container::NoSuchElementException&) - {} - - return css::uno::Reference(); -} - -void AcceleratorExecute::lok_setModuleConfig(css::uno::Reference acceleratorConfig) -{ - this->m_xModuleCfg = acceleratorConfig; -} css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openDocConfig(const css::uno::Reference< css::frame::XModel >& xModel) { -- cgit