[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source

Eike Rathke erack at redhat.com
Fri Jan 6 19:39:15 UTC 2017


 sc/source/filter/xml/xmlcelli.cxx |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

New commits:
commit cb7ab49dde0ae21c472300f126cce4555a3e0ae5
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jan 6 18:28:42 2017 +0100

    recognize the broken "Err:xxx" written by 5.2 and earlier, tdf#105024 related
    
    ... and handle same as "#ERRxxx!" if present.
    
    Change-Id: I1ebb31d628b080c52b450a8fe624c20e9e1188b7
    (cherry picked from commit 75d963bc7bb87429f304d29138c27178880c039a)
    Reviewed-on: https://gerrit.libreoffice.org/32793
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 3b38ac4..8fd7eda 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1357,11 +1357,22 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
         }
         else
         {
-            OUString aFormulaNmsp = maFormula->second;
-            if( eGrammar != formula::FormulaGrammar::GRAM_EXTERNAL )
-                aFormulaNmsp.clear();
-            pCode->AssignXMLString( aText, aFormulaNmsp );
-            rDoc.getDoc().IncXMLImportedFormulaCount( aText.getLength() );
+            // 5.2 and earlier wrote broken "Err:xxx" as formula to designate
+            // an error formula cell.
+            if (aText.startsWithIgnoreAsciiCase("Err:") && aText.getLength() <= 9 &&
+                    ((nError =
+                      GetScImport().GetFormulaErrorConstant( "#ERR" + aText.copy(4) + "!")) != FormulaError::NONE))
+            {
+                pCode->SetCodeError(nError);
+            }
+            else
+            {
+                OUString aFormulaNmsp = maFormula->second;
+                if( eGrammar != formula::FormulaGrammar::GRAM_EXTERNAL )
+                    aFormulaNmsp.clear();
+                pCode->AssignXMLString( aText, aFormulaNmsp );
+                rDoc.getDoc().IncXMLImportedFormulaCount( aText.getLength() );
+            }
         }
 
         ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, pCode, eGrammar, MM_NONE);


More information about the Libreoffice-commits mailing list