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

Laurent Balland-Poirier laurent.balland-poirier at laposte.net
Mon Jul 25 12:42:24 UTC 2016


 svl/source/numbers/zforscan.cxx |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit cb94d2fbd9596aca45d915a599caa671a261c2a2
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Sun Jul 24 22:55:08 2016 +0200

    tdf#101096 Improve minute/month disambiguation
    
    To fix tdf#95339 M-H was treated as minute-hour
    But for "D.M.H" it should be treated as day.month.hour
    THis commit extends test to detect if
    - in case of M.H: there is day or year previous M => M stands for month
    - in case of S.M: there is day or year after M => M stands for month
    Some ambiguous cases like S.M.D are now treated as it was previously (month)
    
    Change-Id: I048eb227a738b6c453e39d9208bef0d1fda136a0
    Reviewed-on: https://gerrit.libreoffice.org/27493
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index bc43643..0fecb54 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1150,15 +1150,15 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
                 nIndexPre = PreviousKeyword(i);
                 nIndexNex = NextKeyword(i);
                 cChar = PreviousChar(i);
-                if (nIndexPre == NF_KEY_H   ||      // H
-                    nIndexPre == NF_KEY_HH  ||      // HH
-                    nIndexPre == NF_KEY_S   ||      // S before M tdf#95339
-                    nIndexPre == NF_KEY_SS  ||      // SS
-                    nIndexNex == NF_KEY_H   ||      // H after M tdf#95339
-                    nIndexNex == NF_KEY_HH  ||      // HH
-                    nIndexNex == NF_KEY_S   ||      // S
-                    nIndexNex == NF_KEY_SS  ||      // SS
-                    cChar == '['  )                 // [M
+                if ( nIndexPre == NF_KEY_H  || nIndexPre == NF_KEY_HH       // H | HH before M
+                  || nIndexNex == NF_KEY_S  || nIndexNex == NF_KEY_SS       // S | SS after M
+                  || ( (nIndexPre == NF_KEY_S ||  nIndexPre == NF_KEY_SS)   // S | SS before M tdf#95339
+                      && nIndexNex != NF_KEY_D  && nIndexNex != NF_KEY_DD && nIndexNex != NF_KEY_DDD && nIndexNex != NF_KEY_DDDD
+                      && nIndexNex != NF_KEY_YY && nIndexNex != NF_KEY_YYYY ) // except if day or year after M tdf#101096
+                  || ( (nIndexNex == NF_KEY_H   || nIndexNex == NF_KEY_HH ) // H | HH after M tdf#95339
+                      && nIndexPre != NF_KEY_D  && nIndexPre != NF_KEY_DD && nIndexPre != NF_KEY_DDD && nIndexPre != NF_KEY_DDDD
+                      && nIndexPre != NF_KEY_YY && nIndexPre != NF_KEY_YYYY ) // except if day or year before M tdf#101096
+                  || cChar == '['  )                                        // [M
                 {
                     eNewType = css::util::NumberFormat::TIME;
                     nTypeArray[i] -= 2;             // 6 -> 4, 7 -> 5


More information about the Libreoffice-commits mailing list