summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2019-11-07 21:24:04 +0100
committerXisco Faulí <xiscofauli@libreoffice.org>2019-11-08 09:39:09 +0100
commit3b49477c31692730f15dc571c823515889ccaec9 (patch)
treee80c389ab931d7eb17fd20032d3b4b0d8bc982dc
parenta70d007ad6fef6820154c394d802e66491dc1576 (diff)
Resolves: tdf#128649 Do not insert duplicate LCID for currency
Fallout from commit d0f8daa0980ba8e403b32006831657c5a0a4ea17 CommitDate: Wed Aug 22 19:03:27 2018 +0200 Resolves: tdf#73063 preserve and roundtrip LCID from/to Excel number formats Change-Id: I356f37624786d753370a272b0f1b54b17b5d206c Reviewed-on: https://gerrit.libreoffice.org/82249 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r--svl/source/numbers/zformat.cxx34
1 files changed, 22 insertions, 12 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index eb2b47dc80af..ce04f095c68f 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -5239,6 +5239,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
{
aStr.append( aPrefix );
}
+ sal_Int32 nPosHaveLCID = -1;
sal_Int32 nPosInsertLCID = aStr.getLength();
sal_uInt32 nCalendarID = 0x0000000; // Excel ID of calendar used in sub-format see tdf#36038
if ( nCnt )
@@ -5318,6 +5319,10 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
if ( nCalendarID > 0 )
j = j+2;
break;
+ case NF_SYMBOLTYPE_CURREXT :
+ nPosHaveLCID = aStr.getLength();
+ aStr.append( rStrArray[j] );
+ break;
default:
aStr.append( rStrArray[j] );
}
@@ -5428,19 +5433,24 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
if ( aNatNum.GetDBNum() > 0 && nLanguageID == LANGUAGE_SYSTEM )
nLanguageID = MsLangId::getRealLanguage( aNatNum.GetLang());
}
- else if (!bSystemLanguage && nOriginalLang != LANGUAGE_DONTKNOW)
+ else if (nPosHaveLCID < 0)
{
- // Explicit locale, write only to the first subformat.
- if (n == 0)
- nLanguageID = MsLangId::getRealLanguage( nOriginalLang);
- }
- else if (bSystemLanguage && maLocale.meLanguageWithoutLocaleData != LANGUAGE_DONTKNOW)
- {
- // Explicit locale but no locale data thus assigned to system
- // locale, preserve for roundtrip, write only to the first
- // subformat.
- if (n == 0)
- nLanguageID = maLocale.meLanguageWithoutLocaleData;
+ // Do not insert a duplicated LCID that was already given with a
+ // currency format as [$R-1C09]
+ if (!bSystemLanguage && nOriginalLang != LANGUAGE_DONTKNOW)
+ {
+ // Explicit locale, write only to the first subformat.
+ if (n == 0)
+ nLanguageID = MsLangId::getRealLanguage( nOriginalLang);
+ }
+ else if (bSystemLanguage && maLocale.meLanguageWithoutLocaleData != LANGUAGE_DONTKNOW)
+ {
+ // Explicit locale but no locale data thus assigned to system
+ // locale, preserve for roundtrip, write only to the first
+ // subformat.
+ if (n == 0)
+ nLanguageID = maLocale.meLanguageWithoutLocaleData;
+ }
}
if ( nCalendarID > 0 )
{ // Add alphabet and language to calendar