sc/source/ui/docshell/docsh4.cxx | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-)
New commits: commit 48a5c1c215bc5b0b9471ac67bee0a278fe8984dc Author: Dennis Francis <[email protected]> AuthorDate: Wed Jan 28 23:02:10 2026 +0530 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Tue Feb 3 05:33:29 2026 +0100 sc: lok: spell check is still based on document language... This is a follow-up to commit: f2d52fd83a1d4fd42c90780357c1552dbed605b4 lok: sc: use view specific calendar conforming to init. locale/language. Not calling ScDocument::SetLanguage() while a view changes its language is problematic since the spell-checker presently only uses the document language and not the lok-view language. Lok-view language is only used to init the calendar as of now. Signed-off-by: Dennis Francis <[email protected]> Change-Id: I1951ce36a7657ef275e781927674f75311afa4f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198327 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 6e161d02a015..43f9e2ac251b 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -249,6 +249,7 @@ public: void lcl_setLOKLanguageAndLocale(ScDocShell& rDocSh, ScTabViewShell& rViewShell, const LanguageType eLang) { OUString aLang = LanguageTag(eLang).getBcp47(); + /// This is only used for building the lok calendar as of date. SfxLokHelper::setViewLanguageAndLocale(SfxLokHelper::getView(rViewShell), aLang); if (SfxBindings* pBindings = rDocSh.GetViewBindings()) { @@ -273,10 +274,10 @@ void ScDocShell::SetLanguage(LanguageType eLatin, LanguageType eCjk, LanguageTyp lcl_setLOKLanguageAndLocale(*this, *pViewShell, eLatin); } } - else - { - GetDocument().SetLanguage(eLatin, eCjk, eCtl); - } + + // Update the document language even in lok mode as + // the spell-check is still based on document language. + GetDocument().SetLanguage(eLatin, eCjk, eCtl); } void ScDocShell::Execute( SfxRequest& rReq ) @@ -1383,17 +1384,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) bool bParagraph = false; ScDocument& rDoc = GetDocument(); - if (comphelper::LibreOfficeKit::isActive()) - { - if (ScTabViewShell* pViewShell = GetBestViewShell()) - { - eLatin = pViewShell->GetLOKLocale().getLanguageType(); - } - } - else - { - rDoc.GetLanguage( eLatin, eCjk, eCtl ); - } + rDoc.GetLanguage( eLatin, eCjk, eCtl ); sal_Int32 nPos = 0; if ( aLangText == "*" ) @@ -2574,15 +2565,13 @@ void ScDocShell::GetState( SfxItemSet &rSet ) if (comphelper::LibreOfficeKit::isActive()) { - if (ScTabViewShell* pViewShell = GetBestViewShell()) - { - eLatin = pViewShell->GetLOKLocale().getLanguageType(); - sLanguage = SvtLanguageTable::GetLanguageString(eLatin); - if (eLatin == LANGUAGE_NONE) - sLanguage += ";-"; - else - sLanguage += ";" + LanguageTag(eLatin).getBcp47(false); - } + GetDocument().GetLanguage( eLatin, eCjk, eCtl ); + sLanguage = SvtLanguageTable::GetLanguageString(eLatin); + + if (eLatin == LANGUAGE_NONE) + sLanguage += ";-"; + else + sLanguage += ";" + LanguageTag(eLatin).getBcp47(false); } else if (ScTabViewShell* pViewShell = GetBestViewShell()) {
