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

Eike Rathke erack at redhat.com
Sun Jan 8 23:25:55 UTC 2017


 sc/source/filter/xml/xmlcelli.cxx |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 7f3e71d2a6e34e33d04739bdf48ea3c18beef1be
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jan 6 17:16:25 2017 +0100

    display error constants written by 5.3+ in the for 5.2 usual way, tdf#105024
    
    Change-Id: I5b61ed58144ae1583d74056389478e9d5c86d2cb
    Reviewed-on: https://gerrit.libreoffice.org/32794
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 5c8a4f1..4670aed 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1404,11 +1404,26 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
             sal_uInt32 nEnglish = pFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US);
             double fVal;
             if ( pFormatter->IsNumberFormat( aText, nEnglish, fVal ) )
+            {
                 rDoc.setNumericCell(rCellPos, fVal);
-            //the (english) number format will not be set
-            //search matching local format and apply it
+                //the (english) number format will not be set
+                //search matching local format and apply it
+            }
             else
+            {
+                // Error constants are stored as "#ERRxxx!" by 5.3+, error
+                // numbers are sal_uInt16 so at most 5 decimal digits, no
+                // other expression must be present.
+                if (aText.startsWithIgnoreAsciiCase("#ERR") && aText.getLength() <= 10 &&
+                        aText[aText.getLength()-1] == '!')
+                {
+                    // Display error constants written by 5.3+ in the for 5.2 usual way.
+                    sal_uInt32 nErr = aText.copy( 4, aText.getLength() - 5).toUInt32();
+                    if (0 < nErr && nErr <= SAL_MAX_UINT16)
+                        aText = ScGlobal::GetErrorString(nErr);
+                }
                 rDoc.setStringCell(rCellPos, aText);
+            }
         }
     }
 }


More information about the Libreoffice-commits mailing list