0da26ed
From d665a7510e42a124d240eb453c224932a5c876e7 Mon Sep 17 00:00:00 2001
0da26ed
Message-Id: <d665a7510e42a124d240eb453c224932a5c876e7.1424442690.git.erack@redhat.com>
0da26ed
From: Eike Rathke <erack@redhat.com>
0da26ed
Date: Fri, 20 Feb 2015 15:11:36 +0100
0da26ed
Subject: [PATCH] Resolves: tdf#89500 catch ISO 8601 datetime in all locales
0da26ed
MIME-Version: 1.0
0da26ed
Content-Type: multipart/mixed; boundary="------------erAck-patch-parts"
0da26ed
0da26ed
This is a multi-part message in MIME format.
0da26ed
--------------erAck-patch-parts
0da26ed
Content-Type: text/plain; charset=UTF-8; format=fixed
0da26ed
Content-Transfer-Encoding: 8bit
0da26ed
0da26ed
0da26ed
Change-Id: I906ebdc6aa5c365df98a29e9e0f319f89f6833c6
0da26ed
(cherry picked from commit 5d572e673dec3396487b14bb1f9e86aa8ab86786)
0da26ed
---
0da26ed
 svl/source/numbers/zforfind.cxx | 33 ++++++++++++++++++++++++++-------
0da26ed
 1 file changed, 26 insertions(+), 7 deletions(-)
0da26ed
0da26ed
0da26ed
--------------erAck-patch-parts
0da26ed
Content-Type: text/x-patch; name="0001-Resolves-tdf-89500-catch-ISO-8601-datetime-in-all-lo.patch"
0da26ed
Content-Transfer-Encoding: 8bit
0da26ed
Content-Disposition: attachment; filename="0001-Resolves-tdf-89500-catch-ISO-8601-datetime-in-all-lo.patch"
0da26ed
0da26ed
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
0da26ed
index 5aee40d..f709cfe 100644
0da26ed
--- a/svl/source/numbers/zforfind.cxx
0da26ed
+++ b/svl/source/numbers/zforfind.cxx
0da26ed
@@ -2439,16 +2439,35 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
0da26ed
                     SkipBlanks( rString, nPos );
0da26ed
                 }
0da26ed
             }
0da26ed
-            else if (nStringPos == 5 && nPos == 0 && rString.getLength() == 1 &&
0da26ed
-                     rString[ 0 ] == 'T' && MayBeIso8601())
0da26ed
+            else if (nPos == 0 && rString.getLength() == 1 && MayBeIso8601())
0da26ed
             {
0da26ed
-                // ISO 8601 combined date and time, yyyy-mm-ddThh:mm
0da26ed
-                ++nPos;
0da26ed
+                if (nStringPos == 5 && rString[0] == 'T')
0da26ed
+                {
0da26ed
+                    // ISO 8601 combined date and time, yyyy-mm-ddThh:mm
0da26ed
+                    ++nPos;
0da26ed
+                }
0da26ed
+                else if (nStringPos == 7 && rString[0] == ':')
0da26ed
+                {
0da26ed
+                    // ISO 8601 combined date and time, the time part; we reach
0da26ed
+                    // here if the locale's separator is not ':' so it couldn't
0da26ed
+                    // be detected above in the time block.
0da26ed
+                    if (nAnzNums >= 5)
0da26ed
+                        eScannedType = NUMBERFORMAT_DATETIME;
0da26ed
+                    ++nPos;
0da26ed
+                }
0da26ed
             }
0da26ed
             break;
0da26ed
-#if NF_RECOGNIZE_ISO8601_TIMEZONES
0da26ed
         case NUMBERFORMAT_DATETIME:
0da26ed
-            if (nPos == 0 && rString.getLength() == 1 && nStringPos >= 9 && MayBeIso8601())
0da26ed
+            if (nPos == 0 && rString.getLength() == 1 && MayBeIso8601())
0da26ed
+            {
0da26ed
+                if (nStringPos == 9 && rString[0] == ':')
0da26ed
+                {
0da26ed
+                    // ISO 8601 combined date and time, the time part continued.
0da26ed
+                    ++nPos;
0da26ed
+                }
0da26ed
+            }
0da26ed
+#if NF_RECOGNIZE_ISO8601_TIMEZONES
0da26ed
+            else if (nPos == 0 && rString.getLength() == 1 && nStringPos >= 9 && MayBeIso8601())
0da26ed
             {
0da26ed
                 // ISO 8601 timezone offset
0da26ed
                 switch (rString[ 0 ])
0da26ed
@@ -2475,8 +2494,8 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
0da26ed
                     break;
0da26ed
                 }
0da26ed
             }
0da26ed
-            break;
0da26ed
 #endif
0da26ed
+            break;
0da26ed
         }
0da26ed
     }
0da26ed
 
0da26ed
0da26ed
--------------erAck-patch-parts--
0da26ed
0da26ed