summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2023-02-10 14:56:06 +0100
committerAndras Timar <andras.timar@collabora.com>2023-07-05 09:12:39 +0200
commit8f1bd965e797110e8c447d41e16ab1d47802da1f (patch)
tree9fdd0a55f05d11f348c61c97926604fa7a0b8a20 /desktop
parent46a891cac6d2ea8ebe6f31798962c8322534aa1b (diff)
lok: remove old hack for LanguageTool locales
Change-Id: I1098c51f03b4cdd4f21a635f7b6aae8e90fd9f9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146779 Reviewed-by: Henry Castro <hcastro@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153962 Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx138
1 files changed, 0 insertions, 138 deletions
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;