Kaydet (Commit) 43624d93 authored tarafından Eike Rathke's avatar Eike Rathke

resolved fdo#34724 Jan1 or 1Jan without separating character is not date

Change-Id: I2cf02a26b81fa634c842df455de669f1c60241bc
üst d2a19aad
...@@ -2054,10 +2054,14 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString, ...@@ -2054,10 +2054,14 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
} }
else else
{ {
nMonth = GetMonth(rString, nPos); const sal_Int32 nMonthStart = nPos;
if ( nMonth ) // month (Jan 1)? short nTempMonth = GetMonth(rString, nPos);
if ( nTempMonth ) // month (Jan 1)?
{
if (nPos < rString.getLength()) // Jan1 without separator is not a date
{ {
eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!! eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!!
nMonth = nTempMonth;
nMonthPos = 1; // month at the beginning nMonthPos = 1; // month at the beginning
if ( nMonth < 0 ) if ( nMonth < 0 )
{ {
...@@ -2066,6 +2070,11 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString, ...@@ -2066,6 +2070,11 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
SkipBlanks(rString, nPos); SkipBlanks(rString, nPos);
} }
else else
{
nPos = nMonthStart; // rewind month
}
}
else
{ {
int nDayOfWeek = GetDayOfWeek( rString, nPos ); int nDayOfWeek = GetDayOfWeek( rString, nPos );
if ( nDayOfWeek ) if ( nDayOfWeek )
...@@ -2089,9 +2098,12 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString, ...@@ -2089,9 +2098,12 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
SkipString( pFormatter->GetLocaleData()->getLongDateDayOfWeekSep(), rString, nPos ); SkipString( pFormatter->GetLocaleData()->getLongDateDayOfWeekSep(), rString, nPos );
} }
SkipBlanks(rString, nPos); SkipBlanks(rString, nPos);
nMonth = GetMonth(rString, nPos); nTempMonth = GetMonth(rString, nPos);
if ( nMonth ) // month (Jan 1)? if ( nTempMonth ) // month (Jan 1)?
{ {
if (nPos < rString.getLength()) // Jan1 without separator is not a date
{
nMonth = nTempMonth;
nMonthPos = 1; // month a the beginning nMonthPos = 1; // month a the beginning
if ( nMonth < 0 ) if ( nMonth < 0 )
{ {
...@@ -2099,6 +2111,11 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString, ...@@ -2099,6 +2111,11 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
} }
SkipBlanks(rString, nPos); SkipBlanks(rString, nPos);
} }
else
{
nPos = nMonthStart; // rewind month
}
}
} }
if (!nMonth) if (!nMonth)
{ {
...@@ -2282,6 +2299,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, ...@@ -2282,6 +2299,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
} }
} }
const sal_Int32 nMonthStart = nPos;
short nTempMonth = GetMonth(rString, nPos); // month in the middle (10 Jan 94) short nTempMonth = GetMonth(rString, nPos); // month in the middle (10 Jan 94)
if (nTempMonth) if (nTempMonth)
{ {
...@@ -2294,6 +2312,8 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, ...@@ -2294,6 +2312,8 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
{ {
return MatchedReturn(); return MatchedReturn();
} }
if (nMonthStart > 0 && nPos < rString.getLength()) // 10Jan or Jan94 without separator are not dates
{
eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date
nMonth = nTempMonth; nMonth = nTempMonth;
nMonthPos = 2; // month in the middle nMonthPos = 2; // month in the middle
...@@ -2304,6 +2324,11 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, ...@@ -2304,6 +2324,11 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
SkipString( pLoc->getLongDateMonthSep(), rString, nPos ); SkipString( pLoc->getLongDateMonthSep(), rString, nPos );
SkipBlanks(rString, nPos); SkipBlanks(rString, nPos);
} }
else
{
nPos = nMonthStart; // rewind month
}
}
if ( SkipChar('E', rString, nPos) || // 10E, 10e, 10,Ee if ( SkipChar('E', rString, nPos) || // 10E, 10e, 10,Ee
SkipChar('e', rString, nPos) ) SkipChar('e', rString, nPos) )
...@@ -2630,6 +2655,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, ...@@ -2630,6 +2655,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
} }
} }
const sal_Int32 nMonthStart = nPos;
short nTempMonth = GetMonth(rString, nPos); // 10 Jan short nTempMonth = GetMonth(rString, nPos); // 10 Jan
if (nTempMonth) if (nTempMonth)
{ {
...@@ -2642,6 +2668,8 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, ...@@ -2642,6 +2668,8 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
{ {
return MatchedReturn(); return MatchedReturn();
} }
if (nMonthStart > 0) // 10Jan without separator is not a date
{
eScannedType = NUMBERFORMAT_DATE; eScannedType = NUMBERFORMAT_DATE;
nMonth = nTempMonth; nMonth = nTempMonth;
nMonthPos = 3; // month at end nMonthPos = 3; // month at end
...@@ -2651,6 +2679,11 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString, ...@@ -2651,6 +2679,11 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
} }
SkipBlanks(rString, nPos); SkipBlanks(rString, nPos);
} }
else
{
nPos = nMonthStart; // rewind month
}
}
sal_Int32 nOrigPos = nPos; sal_Int32 nOrigPos = nPos;
if (GetTimeAmPm(rString, nPos)) if (GetTimeAmPm(rString, nPos))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment