diff options
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 20 | ||||
-rw-r--r-- | svl/source/numbers/zforfind.hxx | 5 |
2 files changed, 24 insertions, 1 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 4c4d70e64d39..61af0c9c3c6a 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -1074,6 +1074,24 @@ bool ImpSvNumberInputScan::CanForceToIso8601( DateOrder eDateOrder ) } +bool ImpSvNumberInputScan::IsAcceptableIso8601( const SvNumberformat* pFormat ) +{ + if (pFormat && (pFormat->GetType() & css::util::NumberFormat::DATE)) + { + switch (pFormatter->GetEvalDateFormat()) + { + case NF_EVALDATEFORMAT_INTL: + return CanForceToIso8601( GetDateOrder()); + case NF_EVALDATEFORMAT_FORMAT: + return CanForceToIso8601( pFormat->GetDateOrder()); + default: + return CanForceToIso8601( GetDateOrder()) || CanForceToIso8601( pFormat->GetDateOrder()); + } + } + return CanForceToIso8601( GetDateOrder()); +} + + bool ImpSvNumberInputScan::MayBeMonthDate() { if (nMayBeMonthDate == 0) @@ -3631,7 +3649,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s // not. The count of numbers in pattern must match the // count of numbers in input. res = (GetDatePatternNumbers() == nNumericsCnt) - || MayBeIso8601() || nMatchedAllStrings; + || IsAcceptableIso8601( pFormat) || nMatchedAllStrings; } } break; diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx index 6a4ebf7ee9f2..a6fc36a12cb2 100644 --- a/svl/source/numbers/zforfind.hxx +++ b/svl/source/numbers/zforfind.hxx @@ -412,6 +412,11 @@ private: @see nMayBeMonthDate */ bool MayBeMonthDate(); + + /** Whether input is acceptable as ISO 8601 date format in the current + NfEvalDateFormat setting. + */ + bool IsAcceptableIso8601( const SvNumberformat* pFormat ); }; #endif // INCLUDED_SVL_SOURCE_NUMBERS_ZFORFIND_HXX |