[Libreoffice-commits] core.git: svl/source

Eike Rathke erack at redhat.com
Mon Sep 4 09:19:53 UTC 2017


 svl/source/numbers/zformat.cxx |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 8cb3faca4b1d1d9c68faba103c6c6117853e639e
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Sep 4 11:18:49 2017 +0200

    Resolves: tdf#52510 handle trailing ';' specifying empty following subformat
    
    Change-Id: Ic84065f11619542fe735f45e72c9303897ea5755

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 65f06418d1df..d40c7d977f17 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1175,8 +1175,26 @@ SvNumberformat::SvNumberformat(OUString& rString,
         }
         if (sBuff.getLength() == nPos)
         {
-            if ( nIndex == 2 && eSymbolType == BRACKET_SYMBOLTYPE_FORMAT &&
-                 sBuff[nPos - 1] == ';' )
+            if (nIndex < 3 && rString[rString.getLength()-1] == ';')
+            {
+                // A trailing ';' is significant and specifies the following
+                // subformat to be empty. We don't enter the scanning loop
+                // above again though.
+                // Note that the operators apply to the current last scanned
+                // subformat.
+                if (nIndex == 0 && eOp1 == NUMBERFORMAT_OP_NO)
+                {
+                    eOp1 = NUMBERFORMAT_OP_GT;  // undefined condition, default: > 0
+                }
+                else if (nIndex == 1 && eOp2 == NUMBERFORMAT_OP_NO)
+                {
+                    eOp2 = NUMBERFORMAT_OP_LT;  // undefined condition, default: < 0
+                }
+                NumFor[nIndex+1].Info().eScannedType = css::util::NumberFormat::EMPTY;
+                if (sBuff[nPos-1] != ';')
+                    sBuff.insert( nPos++, ';');
+            }
+            if (nIndex == 2 && eSymbolType == BRACKET_SYMBOLTYPE_FORMAT && sBuff[nPos-1] == ';')
             {
                 // #83510# A 4th subformat explicitly specified to be empty
                 // hides any text. Need the type here for HasTextFormat()


More information about the Libreoffice-commits mailing list