desktop/source/lib/init.cxx | 2 framework/IwyuFilter_framework.yaml | 2 framework/source/uiconfiguration/moduleuicfgsupplier.cxx | 6 - framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 4 framework/source/uiconfiguration/uiconfigurationmanager.cxx | 4 offapi/UnoApi_offapi.mk | 2 offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl | 2 offapi/com/sun/star/ui/UIConfigurationManager.idl | 2 offapi/com/sun/star/ui/XModuleUIConfigurationManager3.idl | 41 ++++++++++ offapi/com/sun/star/ui/XUIConfigurationManager.idl | 7 - offapi/com/sun/star/ui/XUIConfigurationManager3.idl | 39 +++++++++ sfx2/source/inc/appdata.hxx | 2 svtools/source/misc/acceleratorexecute.cxx | 6 + 13 files changed, 99 insertions(+), 20 deletions(-)
New commits: commit d5eec804048ccac4d3dce73c9d1695ca268e878f Author: Gökay Şatır <gokaysa...@collabora.com> AuthorDate: Thu Feb 16 16:47:22 2023 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Jun 5 11:29:25 2023 +0200 [API CHANGE] Add createShortCutManager function to uiconfigurationmanager. We need to have different accelerator classes for differnt languages. This PR creates a new accelerator class for different languages. Since current code uses single instance for accelerators, i needed to add a create function. Also we now have an unordered map for different languages and modules. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147157 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148680 Tested-by: Miklos Vajna <vmik...@collabora.com> Change-Id: Ia646f20b3206f430ece614fc127e8b748044e4c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151798 Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152381 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 9572a0c7779b..38283c2deef8 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -7209,7 +7209,7 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit: } /// Used by preloadData (LibreOfficeKit) for providing different shortcuts for different languages. -void preLoadShortCutAccelerators() +static void preLoadShortCutAccelerators() { std::unordered_map<OUString, css::uno::Reference<com::sun::star::ui::XAcceleratorConfiguration>>& acceleratorConfs = SfxLokHelper::getAcceleratorConfs(); css::uno::Sequence<OUString> installedLocales(officecfg::Setup::Office::InstalledLocales::get()->getElementNames()); diff --git a/framework/IwyuFilter_framework.yaml b/framework/IwyuFilter_framework.yaml index 88b8dfae4ae3..3d69d4315137 100644 --- a/framework/IwyuFilter_framework.yaml +++ b/framework/IwyuFilter_framework.yaml @@ -40,7 +40,7 @@ excludelist: - com/sun/star/beans/PropertyValue.hpp framework/source/fwe/helper/configimporter.cxx: # Actually used - - com/sun/star/ui/XUIConfigurationManager2.hpp + - com/sun/star/ui/XUIConfigurationManager3.hpp framework/source/fwe/helper/undomanagerhelper.cxx: # Actually used - com/sun/star/document/XUndoManager.hpp diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx index cdbd647c3108..f127c81d7fb9 100644 --- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx +++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx @@ -28,7 +28,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> -#include <com/sun/star/ui/XModuleUIConfigurationManager2.hpp> +#include <com/sun/star/ui/XModuleUIConfigurationManager3.hpp> #include <com/sun/star/frame/XModuleManager2.hpp> #include <comphelper/compbase.hxx> @@ -80,7 +80,7 @@ public: private: virtual void disposing(std::unique_lock<std::mutex>&) final override; - typedef std::unordered_map< OUString, css::uno::Reference< css::ui::XModuleUIConfigurationManager2 > > ModuleToModuleCfgMgr; + typedef std::unordered_map< OUString, css::uno::Reference< css::ui::XModuleUIConfigurationManager3 > > ModuleToModuleCfgMgr; //TODO_AS void impl_initStorages(); @@ -99,7 +99,7 @@ ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons Reference< XNameAccess > xNameAccess( m_xModuleMgr, UNO_QUERY_THROW ); const Sequence< OUString > aNameSeq = xNameAccess->getElementNames(); for ( const OUString& rName : aNameSeq ) - m_aModuleToModuleUICfgMgrMap.emplace( rName, Reference< XModuleUIConfigurationManager2 >() ); + m_aModuleToModuleUICfgMgrMap.emplace( rName, Reference< XModuleUIConfigurationManager3 >() ); } catch(...) { diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index d50b5c037cf2..d5c6a0b5b532 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/ui/ConfigurationEvent.hpp> #include <com/sun/star/ui/ModuleAcceleratorConfiguration.hpp> -#include <com/sun/star/ui/XModuleUIConfigurationManager2.hpp> +#include <com/sun/star/ui/XModuleUIConfigurationManager3.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/IllegalAccessException.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> @@ -83,7 +83,7 @@ namespace { class ModuleUIConfigurationManager : public cppu::WeakImplHelper< css::lang::XServiceInfo, css::lang::XComponent, - css::ui::XModuleUIConfigurationManager2 > + css::ui::XModuleUIConfigurationManager3 > { public: ModuleUIConfigurationManager( diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 874a627be805..d30af75a3aad 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -40,7 +40,7 @@ #include <com/sun/star/ui/ConfigurationEvent.hpp> #include <com/sun/star/ui/DocumentAcceleratorConfiguration.hpp> #include <com/sun/star/ui/XAcceleratorConfiguration.hpp> -#include <com/sun/star/ui/XUIConfigurationManager2.hpp> +#include <com/sun/star/ui/XUIConfigurationManager3.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -73,7 +73,7 @@ namespace { class UIConfigurationManager : public ::cppu::WeakImplHelper< css::lang::XServiceInfo , - css::ui::XUIConfigurationManager2 > + css::ui::XUIConfigurationManager3 > { public: virtual OUString SAL_CALL getImplementationName() override diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 5c8b8e4aad2b..92fd71dd8e12 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -4061,6 +4061,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ui,\ XImageManager \ XModuleUIConfigurationManager \ XModuleUIConfigurationManager2 \ + XModuleUIConfigurationManager3 \ XModuleUIConfigurationManagerSupplier \ XPanel \ XPanels \ @@ -4073,6 +4074,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ui,\ XUIConfigurationListener \ XUIConfigurationManager \ XUIConfigurationManager2 \ + XUIConfigurationManager3 \ XUIConfigurationManagerSupplier \ XUIConfigurationPersistence \ XUIConfigurationStorage \ diff --git a/offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl b/offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl index 6fe18b254fc6..56fd37bcbfef 100644 --- a/offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module ui { @since OOo 2.0 */ -service ModuleUIConfigurationManager : XModuleUIConfigurationManager2 +service ModuleUIConfigurationManager : XModuleUIConfigurationManager3 { /** provides a function to initialize a module user interface configuration manager instance. diff --git a/offapi/com/sun/star/ui/UIConfigurationManager.idl b/offapi/com/sun/star/ui/UIConfigurationManager.idl index bff584dcdb83..c0ae1683f106 100644 --- a/offapi/com/sun/star/ui/UIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/UIConfigurationManager.idl @@ -25,7 +25,7 @@ module com { module sun { module star { module ui { @since OOo 2.0 */ -service UIConfigurationManager : XUIConfigurationManager2; +service UIConfigurationManager : XUIConfigurationManager3; }; }; }; }; diff --git a/offapi/com/sun/star/ui/XModuleUIConfigurationManager3.idl b/offapi/com/sun/star/ui/XModuleUIConfigurationManager3.idl new file mode 100644 index 000000000000..494de200b2e9 --- /dev/null +++ b/offapi/com/sun/star/ui/XModuleUIConfigurationManager3.idl @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +module com { module sun { module star { module ui { + +/** + Provides a unified interface for the ModuleUIConfigurationManager service. + + @since LibreOffice 7.6 +*/ +interface XModuleUIConfigurationManager3 +{ + interface com::sun::star::ui::XModuleUIConfigurationManager2; + + /** + 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(); +}; + + +}; }; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/ui/XUIConfigurationManager.idl b/offapi/com/sun/star/ui/XUIConfigurationManager.idl index 19e380a07c43..f5902229f701 100644 --- a/offapi/com/sun/star/ui/XUIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/XUIConfigurationManager.idl @@ -204,13 +204,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. <p> diff --git a/offapi/com/sun/star/ui/XUIConfigurationManager3.idl b/offapi/com/sun/star/ui/XUIConfigurationManager3.idl new file mode 100644 index 000000000000..73652fc6c8ef --- /dev/null +++ b/offapi/com/sun/star/ui/XUIConfigurationManager3.idl @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +module com { module sun { module star { module ui { + +/** + @since LibreOffice 7.6 +*/ +interface XUIConfigurationManager3 +{ + interface com::sun::star::ui::XUIConfigurationManager2; + + /** + 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(); +}; + + +}; }; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 05a4e19eb217..92f7c5cda108 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -32,7 +32,7 @@ #include <sfx2/msgpool.hxx> #include <o3tl/enumarray.hxx> #include "sfxpicklist.hxx" -#include "com/sun/star/ui/XAcceleratorConfiguration.hpp" +#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> #include <bitset.hxx> #include <memory> diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index ebe93bf7daa4..134db44efc1d 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -24,6 +24,8 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManager3.hpp> +#include <com/sun/star/ui/XModuleUIConfigurationManager3.hpp> #include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/awt/KeyModifier.hpp> @@ -416,8 +418,10 @@ css::uno::Reference<css::ui::XAcceleratorConfiguration> AcceleratorExecute::lok_ { css::uno::Reference<css::ui::XUIConfigurationManager> xUIManager = xUISupplier->getUIConfigurationManager(sModule); + css::ui::XModuleUIConfigurationManager3* t = static_cast<css::ui::XModuleUIConfigurationManager3*>(xUIManager.get()); + // Return new short cut manager in case current view's language is different from previous ones. - return xUIManager->createShortCutManager(); + return t->createShortCutManager(); } catch(const css::container::NoSuchElementException&) {}