svl/source/numbers/zformat.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
New commits: commit b262e4e691d71defa5aa45e6bd647f112e1513c4 Author: Eike Rathke <er...@redhat.com> AuthorDate: Mon Aug 20 20:03:43 2018 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Mon Aug 20 22:16:51 2018 +0200 Avoid searching "[DBNum" if not inserted, tdf#73063 prep Change-Id: I731f2813a2b29d3d7013d559c481f9b59fe7fa43 Reviewed-on: https://gerrit.libreoffice.org/59343 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits