desktop/source/lib/init.cxx    |   48 -----------------------------------------
 include/sfx2/lokhelper.hxx     |    3 --
 sfx2/source/view/lokhelper.cxx |    6 -----
 3 files changed, 1 insertion(+), 56 deletions(-)

New commits:
commit 5c594e23dedfb995c8aa87934a6737f20703583f
Author:     Gökay ŞATIR <gokaysa...@collabora.com>
AuthorDate: Thu Mar 16 07:22:39 2023 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Mar 20 07:37:58 2023 +0000

    Revert "Preload the accelerator configurations when libreofficekit is 
active."
    
    This reverts commit 8b1e20c164e11689894ca605735541fad9aea3b1.
    
    Reason for revert: This is for 23.05 branch.
    
    Change-Id: I6fc584ba063d9013e7cb5b05438b51a9169149df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148956
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 276ed4142c58..d6a0904210a2 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -212,10 +212,6 @@
 #include <unotools/viewoptions.hxx>
 #include <vcl/settings.hxx>
 
-#include <officecfg/Setup.hxx>
-#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
-#include <svtools/acceleratorexecute.hxx>
-
 using namespace css;
 using namespace vcl;
 using namespace desktop;
@@ -7050,47 +7046,6 @@ static void lo_status_indicator_callback(void *data, 
comphelper::LibreOfficeKit:
 
 void setLanguageToolConfig();
 
-/// Used by preloadData (LibreOfficeKit) for providing different shortcuts for 
different languages.
-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());
-    OUString actualLang = officecfg::Setup::L10N::ooLocale::get();
-
-    for (sal_Int32 i = 0; i < installedLocales.getLength(); i++)
-    {
-        OUString language = 
LanguageTag(installedLocales[i]).getLocale().Language;
-
-        if (!comphelper::LibreOfficeKit::isAllowlistedLanguage(language))
-        {
-            // Language is listed by COOL and also installed in core. We can 
create the short cut accelerator.
-
-            // Set the UI language to current one, before creating the 
accelerator.
-            std::shared_ptr<comphelper::ConfigurationChanges> 
batch(comphelper::ConfigurationChanges::create());
-            officecfg::Setup::L10N::ooLocale::set(installedLocales[i], batch);
-            batch->commit();
-
-            // Supported module names: Writer, Calc, Draw, Impress
-            std::vector<OUString> supportedModuleNames = { 
"com.sun.star.text.TextDocument", "com.sun.star.sheet.SpreadsheetDocument", 
"com.sun.star.drawing.DrawingDocument", 
"com.sun.star.presentation.PresentationDocument" };
-            // Create the accelerators.
-            for (std::size_t j = 0; j < supportedModuleNames.size(); j++)
-            {
-                OUString key = supportedModuleNames[j] + installedLocales[i];
-                acceleratorConfs[key] = 
svt::AcceleratorExecute::lok_createNewAcceleratorConfiguration(::comphelper::getProcessComponentContext(),
 supportedModuleNames[j]);
-            }
-        }
-        else
-        {
-            std::cerr << "Language is installed in core but not in the list of 
COOL languages: " << language << "\n";
-        }
-    }
-
-    // Set the UI language back to default one.
-    std::shared_ptr<comphelper::ConfigurationChanges> 
batch(comphelper::ConfigurationChanges::create());
-    officecfg::Setup::L10N::ooLocale::set(actualLang, batch);
-    batch->commit();
-}
-
 /// Used only by LibreOfficeKit when used by Online to pre-initialize
 static void preloadData()
 {
@@ -7157,9 +7112,6 @@ static void preloadData()
     ImageTree &images = ImageTree::get();
     images.getImageUrl("forcefed.png", "style", "FO_oo");
 
-    std::cerr << "Preload short cut accelerators\n";
-    preLoadShortCutAccelerators();
-
     std::cerr << "Preload languages\n";
 
     // force load language singleton
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 5b3debd9f7e6..95eb0a9f9f6f 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -23,7 +23,6 @@
 #include <rtl/string.hxx>
 #include <optional>
 #include <string_view>
-#include <sfx2/app.hxx>
 
 struct SFX2_DLLPUBLIC LokMouseEventData
 {
@@ -50,8 +49,6 @@ struct SFX2_DLLPUBLIC LokMouseEventData
 class SFX2_DLLPUBLIC SfxLokHelper
 {
 public:
-    /// Gets the short cut accelerators.
-    static std::unordered_map<OUString, 
css::uno::Reference<com::sun::star::ui::XAcceleratorConfiguration>>& 
getAcceleratorConfs();
     /// Create a new view shell from the current view frame.
     /// This assumes a single document is ever loaded.
     static int createView();
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 7f0ba8abf930..8bf9d36d0beb 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -23,6 +23,7 @@
 #include <vcl/commandevent.hxx>
 #include <vcl/window.hxx>
 #include <sal/log.hxx>
+#include <sfx2/app.hxx>
 #include <sfx2/msg.hxx>
 #include <sfx2/viewsh.hxx>
 #include <sfx2/request.hxx>
@@ -109,11 +110,6 @@ int SfxLokHelper::createView()
     return createView(pViewShell->GetViewFrame(), pViewShell->GetDocId());
 }
 
-std::unordered_map<OUString, 
css::uno::Reference<com::sun::star::ui::XAcceleratorConfiguration>>& 
SfxLokHelper::getAcceleratorConfs()
-{
-    return SfxApplication::GetOrCreate()->GetAcceleratorConfs_Impl();
-}
-
 int SfxLokHelper::createView(int nDocId)
 {
     const SfxApplication* pApp = SfxApplication::Get();

Reply via email to