diff options
author | Eike Rathke <erack@redhat.com> | 2018-08-20 20:03:43 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-08-20 22:16:51 +0200 |
commit | b262e4e691d71defa5aa45e6bd647f112e1513c4 (patch) | |
tree | 5872efd686fdd23d3a1fcb8ed59acc3d301746b0 /svl/source | |
parent | f34747e39ae034bb7bbfef6fd071662f1abcfa98 (diff) |
Avoid searching "[DBNum" if not inserted, tdf#73063 prep
Change-Id: I731f2813a2b29d3d7013d559c481f9b59fe7fa43
Reviewed-on: https://gerrit.libreoffice.org/59343
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'svl/source')
-rw-r--r-- | svl/source/numbers/zformat.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 7667e200fb31..e682b63cb161 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -5012,13 +5012,13 @@ static void lcl_SvNumberformat_AddLimitStringImpl( OUString& rStr, rStr += "]"; } -void lcl_insertLCID( OUStringBuffer& rFormatStr, sal_uInt32 nLCID, sal_Int32 nPosInsertLCID ) +void lcl_insertLCID( OUStringBuffer& rFormatStr, sal_uInt32 nLCID, sal_Int32 nPosInsertLCID, bool bDBNumInserted ) { if ( nLCID == 0 ) return; OUStringBuffer aLCIDString = OUString::number( nLCID , 16 ).toAsciiUpperCase(); // Search for only last DBNum which is the last element before insertion position - if ( nPosInsertLCID >= 8 + if ( bDBNumInserted && nPosInsertLCID >= 8 && aLCIDString.getLength() > 4 && rFormatStr.indexOf( "[DBNum", nPosInsertLCID-8) == nPosInsertLCID-8 ) { // remove DBNumX code if long LCID @@ -5142,6 +5142,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords, } SvNumberNatNum aNatNum = NumFor[n].GetNatNum(); + bool bDBNumInserted = false; if (aNatNum.IsComplete() && (aNatNum.GetDBNum() > 0 || nOriginalLang != LANGUAGE_DONTKNOW)) { // GetFormatStringForExcel() may have changed language to en_US if (aNatNum.GetLang() == LANGUAGE_ENGLISH_US && nOriginalLang != LANGUAGE_DONTKNOW) @@ -5151,6 +5152,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords, aPrefix += "[DBNum"; aPrefix += OUString::number( aNatNum.GetDBNum() ); aPrefix += "]"; + bDBNumInserted = true; } } @@ -5367,7 +5369,8 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords, if ( nLanguageID == LANGUAGE_SYSTEM && nOriginalLang != LANGUAGE_DONTKNOW ) nLanguageID = nOriginalLang; } - lcl_insertLCID( aStr, nAlphabetID + nCalendarID + static_cast<sal_uInt16>(nLanguageID), nPosInsertLCID ); + lcl_insertLCID( aStr, nAlphabetID + nCalendarID + static_cast<sal_uInt16>(nLanguageID), nPosInsertLCID, + bDBNumInserted); } for ( ; nSub<4 && bDefault[nSub]; ++nSub ) { // append empty subformats |