desktop/source/lib/init.cxx                                        |  138 
----------
 lingucomponent/config/Linguistic-lingucomponent-grammarchecker.xcu |    2 
 2 files changed, 1 insertion(+), 139 deletions(-)

New commits:
commit 8f1bd965e797110e8c447d41e16ab1d47802da1f
Author:     Szymon Kłos <[email protected]>
AuthorDate: Fri Feb 10 14:56:06 2023 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Jul 5 09:12:39 2023 +0200

    lok: remove old hack for LanguageTool locales
    
    Change-Id: I1098c51f03b4cdd4f21a635f7b6aae8e90fd9f9f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146779
    Reviewed-by: Henry Castro <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153962
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 26b44a25b941..70d049feac51 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5597,132 +5597,6 @@ static void 
doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, in
     pDoc->setGraphicSelection(nType, nX, nY);
 }
 
-static void getDocLanguages(LibreOfficeKitDocument* pThis, 
uno::Sequence<lang::Locale>& rSeq)
-{
-    SfxViewFrame* pViewFrame = SfxViewFrame::Current();
-    if (!pViewFrame)
-        return;
-
-    SfxDispatcher* pDispatcher = pViewFrame->GetBindings().GetDispatcher();
-    if (!pDispatcher)
-        return;
-
-    css::uno::Any aLangStatus;
-    pDispatcher->QueryState(SID_LANGUAGE_STATUS, aLangStatus);
-
-    OUString sCurrent;
-    OUString sKeyboard;
-    OUString sGuessText;
-    SvtScriptType eScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN
-        | SvtScriptType::COMPLEX;
-
-    Sequence<OUString> aSeqLang;
-    if (aLangStatus >>= aSeqLang)
-    {
-        if (aSeqLang.getLength() == 4)
-        {
-            sCurrent = aSeqLang[0];
-            eScriptType = static_cast<SvtScriptType>(aSeqLang[1].toInt32());
-            sKeyboard = aSeqLang[1];
-            sGuessText = aSeqLang[2];
-        }
-    }
-    else
-    {
-        aLangStatus >>= sCurrent;
-    }
-
-    LanguageType nLangType;
-    std::set<LanguageType> aLangItems;
-
-    if (!sCurrent.isEmpty())
-    {
-        nLangType = SvtLanguageTable::GetLanguageType(sCurrent);
-        if (nLangType != LANGUAGE_DONTKNOW)
-        {
-            aLangItems.insert(nLangType);
-        }
-    }
-
-    const AllSettings& rAllSettings = Application::GetSettings();
-    nLangType = rAllSettings.GetLanguageTag().getLanguageType();
-    if (nLangType != LANGUAGE_DONTKNOW &&
-        (eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-    {
-        aLangItems.insert(nLangType);
-    }
-
-    nLangType = rAllSettings.GetUILanguageTag().getLanguageType();
-    if (nLangType != LANGUAGE_DONTKNOW &&
-        (eScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-    {
-        aLangItems.insert(nLangType);
-    }
-
-    if (!sKeyboard.isEmpty())
-    {
-        nLangType = SvtLanguageTable::GetLanguageType(sKeyboard);
-        if (nLangType != LANGUAGE_DONTKNOW &&
-            (eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-        {
-            aLangItems.insert(nLangType);
-        }
-    }
-
-    if (!sGuessText.isEmpty())
-    {
-        Reference<linguistic2::XLanguageGuessing> xLangGuesser;
-        try
-        {
-            xLangGuesser = linguistic2::LanguageGuessing::create(xContext);
-        }
-        catch(...)
-        {
-        }
-
-        if (xLangGuesser.is())
-        {
-            lang::Locale aLocale = 
xLangGuesser->guessPrimaryLanguage(sGuessText, 0,
-                                                                      
sGuessText.getLength());
-            LanguageTag aLanguageTag(aLocale);
-            nLangType = aLanguageTag.getLanguageType(false);
-            if (nLangType != LANGUAGE_DONTKNOW &&
-                (eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-            {
-                aLangItems.insert(nLangType);
-            }
-        }
-    }
-
-    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
-    Reference<document::XDocumentLanguages> 
xDocumentLanguages(pDocument->mxComponent, UNO_QUERY);
-    if (xDocumentLanguages.is())
-    {
-        const Sequence<lang::Locale> 
aLocales(xDocumentLanguages->getDocumentLanguages(
-                                                  
static_cast<sal_Int16>(eScriptType), 64));
-
-        for (const lang::Locale& aLocale : aLocales)
-        {
-            nLangType = SvtLanguageTable::GetLanguageType(aLocale.Language);
-            if (nLangType != LANGUAGE_DONTKNOW &&
-                (eScriptType & 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType)))
-            {
-                aLangItems.insert(nLangType);
-            }
-        }
-    }
-
-    int nLocale = 0;
-    Sequence<lang::Locale> aLocales(aLangItems.size());
-    auto pLocales = aLocales.getArray();
-    for (const LanguageType& itLang : aLangItems)
-    {
-        pLocales[nLocale++] = LanguageTag::convertToLocale(itLang);
-    }
-
-    rSeq = aLocales;
-}
-
 static void doc_resetSelection(LibreOfficeKitDocument* pThis)
 {
     comphelper::ProfileZone aZone("doc_resetSelection");
@@ -5780,18 +5654,6 @@ static char* getLanguages(LibreOfficeKitDocument* pThis, 
const char* pCommand)
             uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xGC, 
uno::UNO_QUERY_THROW );
             aGrammarLocales = xSuppLoc->getLocales();
         }
-
-        // Fallback
-
-        /* FIXME: To obtain the document languages the spell checker can be 
disabled,
-           so a future re-work of the getLanguages function is needed in favor 
to use
-           getDocLanguages */
-        if (!aLocales.hasElements())
-        {
-            uno::Sequence< css::lang::Locale > aSeq;
-            getDocLanguages(pThis, aSeq);
-            aLocales = aSeq;
-        }
     }
 
     boost::property_tree::ptree aTree;
commit 46a891cac6d2ea8ebe6f31798962c8322534aa1b
Author:     Szymon Kłos <[email protected]>
AuthorDate: Fri Feb 10 14:40:33 2023 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Jul 5 09:12:31 2023 +0200

    lok: remove duplicated locales for LanguageTool
    
    Change-Id: I8fd1632f36a6c2c2d61331d6ce5dbd3cce83e2a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146776
    Reviewed-by: Henry Castro <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153961
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>

diff --git a/lingucomponent/config/Linguistic-lingucomponent-grammarchecker.xcu 
b/lingucomponent/config/Linguistic-lingucomponent-grammarchecker.xcu
index ce3d6033d0c2..6fa455d969b8 100644
--- a/lingucomponent/config/Linguistic-lingucomponent-grammarchecker.xcu
+++ b/lingucomponent/config/Linguistic-lingucomponent-grammarchecker.xcu
@@ -21,7 +21,7 @@
         <node oor:name="GrammarCheckers">
             <node oor:name="org.openoffice.lingu.LanguageToolGrammarChecker" 
oor:op="fuse">
                 <prop oor:name="Locales" oor:type="oor:string-list">
-                    <value>ar ast-ES be-BY br-FR ca-ES ca-ES-valencia zh-CN 
da-DK nl nl-BE en en-AU en-CA en-CA en-GB en-NZ en-ZA en-US fr gl-ES de de-AT 
de-DE de-DE de-CH el-GR ga-IE it ja-JP km-KH nb no fa pl-PL pt pt-AO pt-BR 
pt-MZ pt-PT ro-RO ru-RU de-DE-x-simple-language sk-SK sl-SI es es-AR sv tl-PH 
ta-IN uk-UA</value>
+                    <value>ar ast-ES be-BY br-FR ca-ES ca-ES-valencia zh-CN 
da-DK nl nl-BE en en-AU en-CA en-GB en-NZ en-ZA en-US fr gl-ES de de-AT de-DE 
de-CH el-GR ga-IE it ja-JP km-KH nb no fa pl-PL pt pt-AO pt-BR pt-MZ pt-PT 
ro-RO ru-RU de-DE-x-simple-language sk-SK sl-SI es es-AR sv tl-PH ta-IN 
uk-UA</value>
                 </prop>
             </node>
         </node>

Reply via email to