diff options
author | Eike Rathke <erack@redhat.com> | 2018-08-16 15:50:02 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-08-16 18:54:31 +0200 |
commit | 5b8007afdb97d416ee7c22bf9226e927d61e9bd3 (patch) | |
tree | d7299707f0a418bfa62fd0104adbe19ec0ce70d0 /svl/source/numbers | |
parent | 6e03d7ee5734c94d245aea5900c0924fbef2a246 (diff) |
Resolves: tdf#119013 do not over-aggressively reorder date particles
In particular not when reading documents as we don't know what the
original (default/system) locale was when the date format was
created and stored and whether the format's date order actually
matched the locale's ordering.
Regression from
commit 51478cefaa4e265b42e3f67eda0a64767ff3efba
CommitDate: Tue Apr 18 17:01:27 2017 +0200
Resolves: tdf#107012 follow date order of the target locale
Change-Id: I9d3bdbd512d95ed81ff6459e368a2d7497ec8a2d
Reviewed-on: https://gerrit.libreoffice.org/59182
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'svl/source/numbers')
-rw-r--r-- | svl/source/numbers/numfmuno.cxx | 4 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 12 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 2 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 4 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.hxx | 6 |
5 files changed, 15 insertions, 13 deletions
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index 3d465ed17183..52ca8e18d696 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -458,7 +458,9 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const OUString& aFormat, sal_uInt32 nKey = 0; sal_Int32 nCheckPos = 0; SvNumFormatType nType = SvNumFormatType::ALL; - bool bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang ); + // This is used also when reading OOXML documents, there's no indicator + // whether to convert date particle order as well, so don't. See tdf#119013 + bool bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang, false); if (bOk || nKey > 0) nRet = nKey; else if (nCheckPos) diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 266adfd48048..f3af3ac13418 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -462,7 +462,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage ) // convert additional and user defined from old system to new system SvNumberformat* pStdFormat = GetFormatEntry( nCLOffset + ZF_STANDARD ); sal_uInt32 nLastKey = nMaxBuiltin; - pFormatScanner->SetConvertMode( eOldLanguage, LANGUAGE_SYSTEM, true ); + pFormatScanner->SetConvertMode( eOldLanguage, LANGUAGE_SYSTEM, true , true); while ( !aOldTable.empty() ) { nKey = aOldTable.begin()->first; @@ -628,7 +628,7 @@ bool SvNumberFormatter::PutandConvertEntry(OUString& rString, sal_uInt32& nKey, LanguageType eLnge, LanguageType eNewLnge, - bool bForExcelExport ) + bool bConvertDateOrder ) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); bool bRes; @@ -636,7 +636,7 @@ bool SvNumberFormatter::PutandConvertEntry(OUString& rString, { eNewLnge = IniLnge; } - pFormatScanner->SetConvertMode(eLnge, eNewLnge, false, bForExcelExport); + pFormatScanner->SetConvertMode(eLnge, eNewLnge, false, bConvertDateOrder); bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge); pFormatScanner->SetConvertMode(false); return bRes; @@ -655,7 +655,7 @@ bool SvNumberFormatter::PutandConvertEntrySystem(OUString& rString, { eNewLnge = IniLnge; } - pFormatScanner->SetConvertMode(eLnge, eNewLnge, true); + pFormatScanner->SetConvertMode(eLnge, eNewLnge, true, true); bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge); pFormatScanner->SetConvertMode(false); return bRes; @@ -1718,7 +1718,7 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString, // Try English -> other or convert english to other LanguageType eFormatLang = LANGUAGE_ENGLISH_US; - pFormatScanner->SetConvertMode( LANGUAGE_ENGLISH_US, eLnge ); + pFormatScanner->SetConvertMode( LANGUAGE_ENGLISH_US, eLnge, false, false); sTmpString = sFormatString; pEntry.reset(new SvNumberformat( sTmpString, pFormatScanner.get(), pStringScanner.get(), nCheckPos, eFormatLang )); @@ -1743,7 +1743,7 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString, sal_Int32 nCheckPos2 = -1; // try other --> english eFormatLang = eLnge; - pFormatScanner->SetConvertMode( eLnge, LANGUAGE_ENGLISH_US ); + pFormatScanner->SetConvertMode( eLnge, LANGUAGE_ENGLISH_US, false, false); sTmpString = sFormatString; std::unique_ptr<SvNumberformat> pEntry2(new SvNumberformat( sTmpString, pFormatScanner.get(), pStringScanner.get(), nCheckPos2, eFormatLang )); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 38b8f243f22d..7667e200fb31 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1883,7 +1883,7 @@ void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter, SvNumFormatType nType = eType; OUString aFormatString( sFormatstring ); rConverter.PutandConvertEntry( aFormatString, nCheckPos, nType, - nKey, eConvertFrom, eConvertTo ); + nKey, eConvertFrom, eConvertTo, false); const SvNumberformat* pFormat = rConverter.GetEntry( nKey ); DBG_ASSERT( pFormat, "SvNumberformat::ConvertLanguage: Conversion without format" ); if ( pFormat ) diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index debfc1e70370..8ececca57bba 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -121,7 +121,7 @@ ImpSvNumberformatScan::ImpSvNumberformatScan( SvNumberFormatter* pFormatterP ) pFormatter = pFormatterP; xNFC = css::i18n::NumberFormatMapper::create( pFormatter->GetComponentContext() ); bConvertMode = false; - mbConvertForExcelExport = false; + mbConvertDateOrder = false; bConvertSystemToSystem = false; bKeywordsNeedInit = true; // locale dependent and not locale dependent keywords bCompatCurNeedInit = true; // locale dependent compatibility currency strings @@ -1784,7 +1784,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) // Adapt date order to target locale, but Excel does not handle date // particle re-ordering for the target locale when loading documents, // though it does exchange separators, tdf#113889 - bNewDateOrder = (!mbConvertForExcelExport && eOldDateOrder != pLoc->getDateOrder()); + bNewDateOrder = (mbConvertDateOrder && eOldDateOrder != pLoc->getDateOrder()); } const CharClass* pChrCls = pFormatter->GetCharClass(); diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index b7ee25d2ce52..0080d1dfeef3 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -148,13 +148,13 @@ public: void ReplaceBooleanEquivalent( OUString& rString ); void SetConvertMode(LanguageType eTmpLge, LanguageType eNewLge, - bool bSystemToSystem = false, bool bForExcelExport = false) + bool bSystemToSystem, bool bConvertDateOrder) { bConvertMode = true; eNewLnge = eNewLge; eTmpLnge = eTmpLge; bConvertSystemToSystem = bSystemToSystem; - mbConvertForExcelExport = bForExcelExport; + mbConvertDateOrder = bConvertDateOrder; } // Only changes the bool variable, in order to temporarily pause the convert mode void SetConvertMode(bool bMode) { bConvertMode = bMode; } @@ -213,7 +213,7 @@ private: // Private section static const OUString sErrStr; // String for error output bool bConvertMode; // Set in the convert mode - bool mbConvertForExcelExport; // Set in the convert mode whether to convert for Excel export + bool mbConvertDateOrder; // Set in the convert mode whether to convert date particles order LanguageType eNewLnge; // Language/country which the scanned string is converted to (for Excel filter) LanguageType eTmpLnge; // Language/country which the scanned string is converted from (for Excel filter) |