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

Laurent Balland-Poirier laurent.balland-poirier at laposte.net
Fri Jul 15 19:59:49 UTC 2016


 svl/source/numbers/zformat.cxx  |    4 +++-
 svl/source/numbers/zforscan.cxx |   18 ++++++++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit b719a57d5ff2a88dba6234a7064aca6ad5a44089
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Sun Jul 10 19:37:52 2016 +0200

    tdf#100834 Treat string between integer and fraction as delimiter
    
    In fraction number format, strings located between integer and fraction
    should be treated as blank delimiter
    
    Change-Id: I83e78fb0fe08178ee194fc2a213ee260ce15c639
    Reviewed-on: https://gerrit.libreoffice.org/27128
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index f3321da..9d5de1c 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -4707,10 +4707,12 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
                     case NF_SYMBOLTYPE_TIME100SECSEP :
                         aStr.append( rLocWrp.getTime100SecSep() );
                         break;
+                    case NF_SYMBOLTYPE_FRACBLANK :
                     case NF_SYMBOLTYPE_STRING :
                         if ( pStr[j].getLength() == 1 )
                         {
-                            aStr.append( '\\' );
+                            if ( pType[j] == NF_SYMBOLTYPE_STRING )
+                                aStr.append( '\\' );
                             aStr.append( pStr[j] );
                         }
                         else
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 1e4ba47..bc43643 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1651,7 +1651,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
                     nTypeArray[i] = NF_SYMBOLTYPE_EXP;
                 }
                 else if (eScannedType == css::util::NumberFormat::FRACTION &&
-                         sStrArray[i][0] == ' ')
+                    (sStrArray[i][0] == ' ' || ( nTypeArray[i] == NF_SYMBOLTYPE_STRING && (sStrArray[i][0] < '0' || sStrArray[i][0] > '9') ) ) )
                 {
                     if (!bBlank && !bFrac) // Not double or after a /
                     {
@@ -1659,12 +1659,17 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
                         {
                             return nPos; // Error
                         }
-                        bBlank = true;
-                        nBlankPos = i;
-                        nCntPre = nCounter;
-                        nCounter = 0;
+                        if (sStrArray[i][0] == ' ' ||  nCounter > 0 )   // treat string as integer/fraction delimiter only if there is integer
+                        {
+                            bBlank = true;
+                            nBlankPos = i;
+                            nCntPre = nCounter;
+                            nCounter = 0;
+                            nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK;
+                        }
                     }
-                    nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK;
+                    else if ( sStrArray[i][0] == ' ' )
+                        nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK;
                 }
                 else if (nTypeArray[i] == NF_KEY_THAI_T)
                 {
@@ -2691,6 +2696,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
         switch ( nTypeArray[i] )
         {
         case NF_SYMBOLTYPE_STRING :
+        case NF_SYMBOLTYPE_FRACBLANK :
             nStringPos = rString.getLength();
             do
             {


More information about the Libreoffice-commits mailing list