Rebased ref, commits from common ancestor:
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())
                     {
commit d5eb7f92582966de9276d726d0adae5f1a245d98
Author:     Karthik Godha <[email protected]>
AuthorDate: Tue Jan 27 20:28:39 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Feb 4 19:11:51 2026 +0100

    tdf#170498: Export dataOnRows attribute in PivotTable
    
    bug-document: forum-es-922.xls
    Change-Id: Ib78d5905665362277ef5fc9df307f68438655cef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198209
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit 76c3e6fdcdc522e0577097c7c4ff442e65129b94)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198526
    Tested-by: Michael Stahl <[email protected]>

diff --git a/sc/source/filter/excel/xepivotxml.cxx 
b/sc/source/filter/excel/xepivotxml.cxx
index c2d7a064538e..bf426177feb1 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -989,13 +989,17 @@ void XclExpXmlPivotTables::SavePivotTableXml( 
XclExpXmlStream& rStrm, const ScDP
     const ScDPSaveData::DimsType& rDims = rSaveData.GetDimensions();
     bool bTabularMode = false;
     bool bCompactMode = true;
+    bool bDataOnRows = false;
     for (const auto & i : rDims)
     {
         const ScDPSaveDimension& rDim = *i;
 
         tools::Long nPos = -1; // position in cache
         if (rDim.IsDataLayout())
+        {
             nPos = -2; // Excel uses an index of -2 to indicate a data layout 
field.
+            bDataOnRows = (rDim.GetOrientation() == 
sheet::DataPilotFieldOrientation_ROW);
+        }
         else
         {
             OUString aSrcName = 
ScDPUtil::getSourceDimensionName(rDim.GetName());
@@ -1047,6 +1051,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( 
XclExpXmlStream& rStrm, const ScDP
         XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
         XML_name, rDPObj.GetName().toUtf8(),
         XML_cacheId, OString::number(nCacheId),
+        XML_dataOnRows, ToPsz10(bDataOnRows),
         XML_applyNumberFormats, ToPsz10(false),
         XML_applyBorderFormats, ToPsz10(false),
         XML_applyFontFormats, ToPsz10(false),
commit 547f2e3ddab772bdc3bb6a3a40f953beb1d5be72
Author:     Karthik Godha <[email protected]>
AuthorDate: Fri Jan 23 18:25:22 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Feb 4 19:11:12 2026 +0100

    tdf#170452: Export external refs of Data Validation
    
    External references used in data validation are not exported. To export
    External references they should be registered with XclExpLinkManager.
    
    Add explicit function call to XclExpFormulaCompiler::CreateFormula,
    this will eventually call XclExpLinkManager::FindExtSheet, which is used
    to register external refs.
    
    bug-document: forum-mso-de-39647.xls
    
    Change-Id: I0f010f0b5e990ba098361996598d7363647b05ba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197954
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit 97c290624f6e0d992ea5a075f316405dcfca8d38)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198525
    Tested-by: Michael Stahl <[email protected]>

diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 4c903738a441..f4d7087cba49 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1829,34 +1829,20 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uInt32 
nScHandle ) :
                         2) List is taken from A1    -> formula is =A1 -> 
writes tRefNR token
                         Formula compiler supports this by offering two 
different functions
                         CreateDataValFormula() and CreateListValFormula(). */
-                    if(GetOutput() == EXC_OUTPUT_BINARY)
-                        mxTokArr1 = rFmlaComp.CreateFormula( 
EXC_FMLATYPE_LISTVAL, *xScTokArr );
-                    else
-                        msFormula1 = XclXmlUtils::ToOUString( 
GetCompileFormulaContext(), pValData->GetSrcPos(),
-                            xScTokArr.get());
+                    mxTokArr1 = rFmlaComp.CreateFormula(EXC_FMLATYPE_LISTVAL, 
*xScTokArr);
                 }
             }
             else
             {
                 // no list validation -> convert the formula
-                if(GetOutput() == EXC_OUTPUT_BINARY)
-                    mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_DATAVAL, 
*xScTokArr );
-                else
-                    msFormula1 = XclXmlUtils::ToOUString( 
GetCompileFormulaContext(), pValData->GetSrcPos(),
-                            xScTokArr.get());
+                mxTokArr1 = rFmlaComp.CreateFormula(EXC_FMLATYPE_DATAVAL, 
*xScTokArr);
             }
         }
 
         // second formula
         xScTokArr = pValData->CreateFlatCopiedTokenArray( 1 );
         if (xScTokArr)
-        {
-            if(GetOutput() == EXC_OUTPUT_BINARY)
-                mxTokArr2 = rFmlaComp.CreateFormula( EXC_FMLATYPE_DATAVAL, 
*xScTokArr );
-            else
-                msFormula2 = XclXmlUtils::ToOUString( 
GetCompileFormulaContext(), pValData->GetSrcPos(),
-                        xScTokArr.get());
-        }
+            mxTokArr2 = rFmlaComp.CreateFormula(EXC_FMLATYPE_DATAVAL, 
*xScTokArr);
     }
     else
     {
@@ -1929,18 +1915,41 @@ void XclExpDV::SaveXml( XclExpXmlStream& rStrm )
         rWorksheet->endElement(FSNS(XML_mc, XML_Fallback));
         rWorksheet->endElement(FSNS(XML_mc, XML_AlternateContent));
     }
-    if (msList.isEmpty() && !msFormula1.isEmpty())
-    {
-        rWorksheet->startElement(XML_formula1);
-        rWorksheet->writeEscaped( msFormula1 );
-        rWorksheet->endElement( XML_formula1 );
-    }
-    if( !msFormula2.isEmpty() )
+
+    if (const ScValidationData* pValData = 
GetDoc().GetValidationEntry(mnScHandle))
     {
-        rWorksheet->startElement(XML_formula2);
-        rWorksheet->writeEscaped( msFormula2 );
-        rWorksheet->endElement( XML_formula2 );
+        if (msList.isEmpty())
+        {
+            if (msFormula1.isEmpty())
+            {
+                if (const std::unique_ptr<ScTokenArray> xScTokArr
+                    = pValData->CreateFlatCopiedTokenArray(0))
+                {
+                    msFormula1 = 
XclXmlUtils::ToOUString(GetCompileFormulaContext(),
+                                                         
pValData->GetSrcPos(), xScTokArr.get());
+                }
+            }
+
+            if (!msFormula1.isEmpty())
+            {
+                rWorksheet->startElement(XML_formula1);
+                rWorksheet->writeEscaped(msFormula1);
+                rWorksheet->endElement(XML_formula1);
+            }
+        }
+        if (const std::unique_ptr<ScTokenArray> xScTokArr = 
pValData->CreateFlatCopiedTokenArray(1))
+        {
+            msFormula2 = XclXmlUtils::ToOUString(GetCompileFormulaContext(), 
pValData->GetSrcPos(),
+                                                 xScTokArr.get());
+            if (!msFormula2.isEmpty())
+            {
+                rWorksheet->startElement(XML_formula2);
+                rWorksheet->writeEscaped(msFormula2);
+                rWorksheet->endElement(XML_formula2);
+            }
+        }
     }
+
     rWorksheet->endElement( XML_dataValidation );
 }
 
commit 0f0a2c07e4ac7c700d638f9e6b2891a7feb16c85
Author:     Karthik Godha <[email protected]>
AuthorDate: Tue Jan 27 11:44:20 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Feb 4 19:08:54 2026 +0100

    XLSX: Discard unknown functions without names
    
    bug-document: forum-mso-de-36050.xls
    Change-Id: I62f24b888cf8c2d2e0592253c1ae431631493956
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198172
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit dd929408a45379d743d72cf18a2e447956555b4c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198524
    Tested-by: Michael Stahl <[email protected]>

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 4be78a4a47bd..f2bf1d709094 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -2522,27 +2522,13 @@ void FormulaCompiler::CreateStringFromTokenArray( 
OUStringBuffer& rBuffer )
     const FormulaToken* t = maArrIterator.First();
     while( t )
     {
-        // Skip writing unknown functions without a name in OOXML ex: #NAME!()
+        // Discard writing unknown functions without a name in OOXML ex: 
#NAME!()
         if (t->GetOpCode() == ocNoName && t->GetType() == svByte
             && FormulaGrammar::isOOXML(meGrammar))
         {
-            t = maArrIterator.Next();
-            sal_uInt16 nParenthesis = 0;
-            // traverse the array to match parentheses
-            if (t && t->GetOpCode() == ocOpen)
-            {
-                do
-                {
-                    if (t->GetOpCode() == ocOpen)
-                        nParenthesis++;
-                    else if (t->GetOpCode() == ocClose)
-                        nParenthesis--;
-
-                    t = maArrIterator.Next();
-
-                } while (nParenthesis > 0 && t);
-            }
-            continue;
+            rBuffer.setLength(0);
+            rBuffer.append(GetNativeSymbol(ocErrRef));
+            break;
         }
         t = CreateStringFromToken(rBuffer, t, true);
     }
commit e4cf73a4389cc81c9f80223e5495dfc3cd2cf294
Author:     Karthik Godha <[email protected]>
AuthorDate: Wed Jan 21 20:58:19 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Feb 4 19:04:51 2026 +0100

    tdf#170292: R1C1 reference style in defined names
    
    Defined names can't contian R1C1 references as name
    
    bug-document: forum-mso-de-23552.xls
    
    Change-Id: I4798b783cc1e1d84c04d236a11710bd778c6af49
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197762
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit d7c06bd82504c66aad79edc2193827b23ba47481)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198522
    Tested-by: Michael Stahl <[email protected]>

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index dc769e468eaf..c209b59c3549 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5810,7 +5810,10 @@ void ScCompiler::CreateStringFromIndex( OUStringBuffer& 
rBuffer, const FormulaTo
                 }
                 OUString sName = pData->GetName();
                 // If the name is a valid reference then add underscore to the 
name
-                if (ScAddress().Parse(sName, rDoc, FormulaGrammar::CONV_XL_A1) 
& ScRefFlags::VALID)
+                if ((ScAddress().Parse(sName, rDoc, 
::formula::FormulaGrammar::CONV_XL_A1)
+                     != ScRefFlags::ZERO)
+                    || (ScRange().Parse(sName, rDoc, 
::formula::FormulaGrammar::CONV_XL_R1C1)
+                        != ScRefFlags::ZERO))
                     sName = "_" + sName;
                 aBuffer.append(sName);
             }
diff --git a/sc/source/filter/excel/xename.cxx 
b/sc/source/filter/excel/xename.cxx
index 7d8de704b8a5..9e9ce1bd2a00 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -356,8 +356,10 @@ void XclExpName::SaveXml( XclExpXmlStream& rStrm )
     else
     {
         // If the name is a valid reference then add underscore to the name
-        if (ScAddress().Parse(sName, GetDoc(), 
::formula::FormulaGrammar::CONV_XL_A1)
-            & ScRefFlags::VALID)
+        if ((ScAddress().Parse(sName, GetDoc(), 
::formula::FormulaGrammar::CONV_XL_A1)
+             != ScRefFlags::ZERO)
+            || (ScRange().Parse(sName, GetDoc(), 
::formula::FormulaGrammar::CONV_XL_R1C1)
+                != ScRefFlags::ZERO))
             sName = "_" + sName;
     }
 
commit 759d8f9ee97c331a1af058691b311bd225b2dcb4
Author:     Karthik Godha <[email protected]>
AuthorDate: Fri Jan 23 14:36:11 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Feb 4 19:04:03 2026 +0100

    sc: XLSX - Use correct index in svExternalName
    
    This is related to f85d860ccbebd99bc128218148e2992c9415f221, for
    `svExternalName` use the index calculated during export.
    
    bug-document: forum-mso-de-38936.xls
    
    Change-Id: I4a75a2432ab9bd6f46d36c46fe985bbc33252154
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197917
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit b14a56012663adfe529b32fb78033a98af1b3847)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198523
    Tested-by: Michael Stahl <[email protected]>

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e610e758a892..dc769e468eaf 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5377,7 +5377,8 @@ void ScCompiler::CreateStringFromExternal( 
OUStringBuffer& rBuffer, const Formul
     switch (t->GetType())
     {
         case svExternalName:
-            rBuffer.append(pConv->makeExternalNameStr( nFileId, *pFileName, 
t->GetString().getString()));
+            rBuffer.append(
+                pConv->makeExternalNameStr(nUsedFileId, *pFileName, 
t->GetString().getString()));
         break;
         case svExternalSingleRef:
             pConv->makeExternalRefStr(rDoc.GetSheetLimits(),

Reply via email to