sc/source/ui/docshell/docsh4.cxx |   36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

New commits:
commit 9b4357e5e7d2aea36bb0c44c25e7b4e3c8b3ba0b
Author:     Dennis Francis <[email protected]>
AuthorDate: Wed Jan 28 23:02:10 2026 +0530
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Feb 4 22:04:08 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.
    
    Conflicts:
            sc/source/ui/docshell/docsh4.cxx
    
    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]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198700
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index ff3adac82114..1aa65d41f9d9 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -271,10 +271,10 @@ void ScDocShell::SetLanguage(LanguageType eLatin, 
LanguageType eCjk, LanguageTyp
             lcl_setLOKLocale(*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 )
@@ -1381,17 +1381,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 == "*" )
@@ -2572,15 +2562,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())
                     {

Reply via email to