diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-07-24 22:55:08 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-07-25 12:41:55 +0000 |
commit | cb94d2fbd9596aca45d915a599caa671a261c2a2 (patch) | |
tree | ef4f7eab705e0438c491013251ce0415c754f04e /svl/source/numbers/zforscan.cxx | |
parent | fb2c146752074b132d665e40343a08dcb2e6672e (diff) |
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@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl/source/numbers/zforscan.cxx')
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index bc436431a820..0fecb5403d49 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 |