[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - svl/source

Dennis Francis dennis.francis at collabora.co.uk
Tue Nov 28 10:15:36 UTC 2017


 svl/source/numbers/zforlist.cxx |   67 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

New commits:
commit 1d1449fee3bff39c4a5f54e3938b414efcabd6b6
Author: Dennis Francis <dennis.francis at collabora.co.uk>
Date:   Wed Nov 22 16:46:46 2017 +0530

    Make SvNumberFormatter public methods threadsafe
    
    This is a requirement due to the recent threading work done
    on calc formulagroup interpreter.
    
    Change-Id: I5d567b4b957a4d86303f6a86b14d1cbfc730beda
    Reviewed-on: https://gerrit.libreoffice.org/45085
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Dennis Francis <dennis.francis at collabora.co.uk>
    (cherry picked from commit b1f829dae5cacc595f78c9647ce8487ca22225af)
    Reviewed-on: https://gerrit.libreoffice.org/45328
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index b38c3c317545..a6e7af89562f 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -326,6 +326,7 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang )
 
 void SvNumberFormatter::ChangeIntl(LanguageType eLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (ActLnge != eLnge)
     {
         ActLnge = eLnge;
@@ -374,11 +375,13 @@ SvNumberFormatterRegistry_Impl& SvNumberFormatter::GetFormatterRegistry()
 
 void SvNumberFormatter::SetColorLink( const Link<sal_uInt16,Color*>& rColorTableCallBack )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     aColorLink = rColorTableCallBack;
 }
 
 Color* SvNumberFormatter::GetUserDefColor(sal_uInt16 nIndex)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if( aColorLink.IsSet() )
     {
         return aColorLink.Call(nIndex);
@@ -393,32 +396,38 @@ void SvNumberFormatter::ChangeNullDate(sal_uInt16 nDay,
                                        sal_uInt16 nMonth,
                                        sal_Int16 nYear)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     pFormatScanner->ChangeNullDate(nDay, nMonth, nYear);
     pStringScanner->ChangeNullDate(nDay, nMonth, nYear);
 }
 
 const Date& SvNumberFormatter::GetNullDate() const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     return pFormatScanner->GetNullDate();
 }
 
 void SvNumberFormatter::ChangeStandardPrec(short nPrec)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     pFormatScanner->ChangeStandardPrec(nPrec);
 }
 
 void SvNumberFormatter::SetNoZero(bool bNZ)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     bNoZero = bNZ;
 }
 
 sal_uInt16 SvNumberFormatter::GetStandardPrec() const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     return pFormatScanner->GetStandardPrec();
 }
 
 bool SvNumberFormatter::GetNoZero() const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     return bNoZero;
 }
 
@@ -547,6 +556,7 @@ bool SvNumberFormatter::IsDecimalSep( const OUString& rStr ) const
 
 bool SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     const SvNumberformat* pFormat = GetFormatEntry(F_Index);
 
     return pFormat && pFormat->IsTextFormat();
@@ -558,6 +568,7 @@ bool SvNumberFormatter::PutEntry(OUString& rString,
                                  sal_uInt32& nKey,      // format key
                                  LanguageType eLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     nKey = 0;
     if (rString.isEmpty())                             // empty string
     {
@@ -626,6 +637,7 @@ bool SvNumberFormatter::PutandConvertEntry(OUString& rString,
                                            LanguageType eNewLnge,
                                            bool bForExcelExport )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     bool bRes;
     if (eNewLnge == LANGUAGE_DONTKNOW)
     {
@@ -644,6 +656,7 @@ bool SvNumberFormatter::PutandConvertEntrySystem(OUString& rString,
                                                  LanguageType eLnge,
                                                  LanguageType eNewLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     bool bRes;
     if (eNewLnge == LANGUAGE_DONTKNOW)
     {
@@ -659,6 +672,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( OUString & rString,
                                                             LanguageType eSysLnge, short & rType,
                                                             bool & rNewInserted, sal_Int32 & rCheckPos )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     sal_uInt32 nKey = NUMBERFORMAT_ENTRY_NOT_FOUND;
     rNewInserted = false;
     rCheckPos = 0;
@@ -732,12 +746,14 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( OUString & rString,
 
 void SvNumberFormatter::DeleteEntry(sal_uInt32 nKey)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     delete aFTable[nKey];
     aFTable.erase(nKey);
 }
 
 void SvNumberFormatter::GetUsedLanguages( std::vector<LanguageType>& rList )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     rList.clear();
 
     sal_uInt32 nOffset = 0;
@@ -756,6 +772,7 @@ void SvNumberFormatter::GetUsedLanguages( std::vector<LanguageType>& rList )
 void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords,
                                           LanguageType eLang )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     ChangeIntl( eLang );
     const NfKeywordTable & rTable = pFormatScanner->GetKeywords();
     for ( sal_uInt16 i = 0; i < NF_KEYWORD_ENTRIES_COUNT; ++i )
@@ -767,6 +784,7 @@ void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords,
 
 void SvNumberFormatter::FillKeywordTableForExcel( NfKeywordTable& rKeywords )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     FillKeywordTable( rKeywords, LANGUAGE_ENGLISH_US );
 
     // Replace upper case "GENERAL" with proper case "General".
@@ -784,6 +802,7 @@ void SvNumberFormatter::FillKeywordTableForExcel( NfKeywordTable& rKeywords )
 OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKeywordTable& rKeywords,
         SvNumberFormatter& rTempFormatter ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     OUString aFormatStr;
     if (const SvNumberformat* pEntry = GetEntry( nKey))
     {
@@ -839,6 +858,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKe
 
 OUString SvNumberFormatter::GetKeyword( LanguageType eLnge, sal_uInt16 nIndex )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     ChangeIntl(eLnge);
     const NfKeywordTable & rTable = pFormatScanner->GetKeywords();
     if ( nIndex < NF_KEYWORD_ENTRIES_COUNT )
@@ -852,6 +872,7 @@ OUString SvNumberFormatter::GetKeyword( LanguageType eLnge, sal_uInt16 nIndex )
 
 OUString SvNumberFormatter::GetStandardName( LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     ChangeIntl( eLnge );
     return pFormatScanner->GetStandardName();
 }
@@ -899,6 +920,7 @@ SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable(
                                                       sal_uInt32& FIndex,
                                                       LanguageType& rLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     short eTypetmp = eType;
     if (eType == css::util::NumberFormat::ALL)                  // empty cell or don't care
     {
@@ -1001,6 +1023,7 @@ SvNumberFormatTable& SvNumberFormatter::ChangeCL(short eType,
                                                  sal_uInt32& FIndex,
                                                  LanguageType eLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     ImpGenerateCL(eLnge);
     return GetEntryTable(eType, FIndex, ActLnge);
 }
@@ -1010,6 +1033,7 @@ SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
                                                     sal_uInt32& FIndex,
                                                     LanguageType eLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if ( pFormatTable )
     {
         pFormatTable->clear();
@@ -1135,6 +1159,7 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString,
 
 LanguageType SvNumberFormatter::GetLanguage() const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     return IniLnge;
 }
 
@@ -1278,6 +1303,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
 
 sal_uInt32 SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (eLnge == LANGUAGE_DONTKNOW)
     {
         eLnge = IniLnge;
@@ -1311,6 +1337,7 @@ sal_uInt32 SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge
 bool SvNumberFormatter::IsSpecialStandardFormat( sal_uInt32 nFIndex,
                                                  LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     return
         nFIndex == GetFormatIndex( NF_TIME_MMSS00, eLnge ) ||
         nFIndex == GetFormatIndex( NF_TIME_HH_MMSS00, eLnge ) ||
@@ -1321,6 +1348,7 @@ bool SvNumberFormatter::IsSpecialStandardFormat( sal_uInt32 nFIndex,
 sal_uInt32 SvNumberFormatter::GetStandardFormat( sal_uInt32 nFIndex, short eType,
                                                  LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if ( IsSpecialStandardFormat( nFIndex, eLnge ) )
         return nFIndex;
     else
@@ -1329,6 +1357,7 @@ sal_uInt32 SvNumberFormatter::GetStandardFormat( sal_uInt32 nFIndex, short eType
 
 sal_uInt32 SvNumberFormatter::GetTimeFormat( double fNumber, LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     bool bSign;
     if ( fNumber < 0.0 )
     {
@@ -1357,6 +1386,7 @@ sal_uInt32 SvNumberFormatter::GetTimeFormat( double fNumber, LanguageType eLnge
 sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIndex,
                                                  short eType, LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if ( IsSpecialStandardFormat( nFIndex, eLnge ) )
         return nFIndex;
 
@@ -1371,6 +1401,7 @@ sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIn
 
 sal_uInt32 SvNumberFormatter::GuessDateTimeFormat( short& rType, double fNumber, LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     // Categorize the format according to the implementation of
     // SvNumberFormatter::GetEditFormat(), making assumptions about what
     // would be time only.
@@ -1406,6 +1437,7 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex,
                                              short eType, LanguageType eLang,
                                              SvNumberformat const * pFormat )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     sal_uInt32 nKey = nFIndex;
     switch ( eType )
     {
@@ -1469,6 +1501,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
                                            sal_uInt32 nFIndex,
                                            OUString& sOutString)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     Color* pColor;
     sal_uInt32 nRealKey = nFIndex;
     SvNumberformat* pFormat = ImpSubstituteEntry( GetFormatEntry( nFIndex ), &nRealKey);
@@ -1532,6 +1565,7 @@ void SvNumberFormatter::GetOutputString(const OUString& sString,
                                         Color** ppColor,
                                         bool bUseStarFormat )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     SvNumberformat* pFormat = GetFormatEntry( nFIndex );
     // ImpSubstituteEntry() is unnecessary here because so far only numeric
     // (time and date) are substituted.
@@ -1565,6 +1599,7 @@ void SvNumberFormatter::GetOutputString(const double& fOutNumber,
                                         Color** ppColor,
                                         bool bUseStarFormat )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (bNoZero && fOutNumber == 0.0)
     {
         sOutString.clear();
@@ -1588,6 +1623,7 @@ bool SvNumberFormatter::GetPreviewString(const OUString& sFormatString,
                                          LanguageType eLnge,
                                          bool bUseStarFormat )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (sFormatString.isEmpty())                       // no empty string
     {
         return false;
@@ -1640,6 +1676,7 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
                                                Color** ppColor,
                                                LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (sFormatString.isEmpty())                       // no empty string
     {
         return false;
@@ -1736,6 +1773,7 @@ bool SvNumberFormatter::GetPreviewString( const OUString& sFormatString,
                                           Color** ppColor,
                                           LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (sFormatString.isEmpty())               // no empty string
     {
         return false;
@@ -1789,6 +1827,7 @@ bool SvNumberFormatter::GetPreviewString( const OUString& sFormatString,
 sal_uInt32 SvNumberFormatter::TestNewString(const OUString& sFormatString,
                                             LanguageType eLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (sFormatString.isEmpty())                       // no empty string
     {
         return NUMBERFORMAT_ENTRY_NOT_FOUND;
@@ -1945,6 +1984,7 @@ void SvNumberFormatter::GetFormatSpecialInfo(sal_uInt32 nFormat,
                                              sal_uInt16& nLeadingCnt)
 
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     SvNumberformat* pFormat = GetFormatEntry( nFormat );
     if (pFormat)
         pFormat->GetFormatSpecialInfo(bThousand, IsRed,
@@ -1960,6 +2000,7 @@ void SvNumberFormatter::GetFormatSpecialInfo(sal_uInt32 nFormat,
 
 sal_uInt16 SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     const SvNumberformat* pFormat = GetFormatEntry( nFormat );
     if ( pFormat )
         return pFormat->GetFormatPrecision();
@@ -1969,6 +2010,7 @@ sal_uInt16 SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const
 
 sal_uInt16 SvNumberFormatter::GetFormatIntegerDigits( sal_uInt32 nFormat ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     const SvNumberformat* pFormat = GetFormatEntry( nFormat );
     if ( pFormat )
         return pFormat->GetFormatIntegerDigits();
@@ -1978,6 +2020,7 @@ sal_uInt16 SvNumberFormatter::GetFormatIntegerDigits( sal_uInt32 nFormat ) const
 
 OUString SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     const SvNumberformat* pFormat = GetFormatEntry(nFormat);
     if ( !pFormat || pFormat->GetLanguage() == ActLnge )
     {
@@ -2005,6 +2048,7 @@ sal_uInt32 SvNumberFormatter::GetFormatSpecialInfo( const OUString& rFormatStrin
                                                     sal_uInt16& nLeadingCnt, LanguageType eLnge )
 
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (eLnge == LANGUAGE_DONTKNOW)
     {
         eLnge = IniLnge;
@@ -2202,6 +2246,7 @@ const SvNumberformat* SvNumberFormatter::GetFormatEntry( sal_uInt32 nKey ) const
 
 const SvNumberformat* SvNumberFormatter::GetEntry( sal_uInt32 nKey ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     SvNumberFormatTable::const_iterator it = aFTable.find( nKey);
     if (it != aFTable.end())
         return it->second;
@@ -2210,6 +2255,7 @@ const SvNumberformat* SvNumberFormatter::GetEntry( sal_uInt32 nKey ) const
 
 const SvNumberformat* SvNumberFormatter::GetSubstitutedEntry( sal_uInt32 nKey, sal_uInt32 & o_rNewKey ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     // A tad ugly, but GetStandardFormat() and GetFormatIndex() in
     // ImpSubstituteEntry() may have to add the LANGUAGE_SYSTEM formats if not
     // already present (which in practice most times they are).
@@ -2808,6 +2854,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
                                            sal_uInt16 nPrecision,
                                            sal_uInt16 nLeadingZeros)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (eLnge == LANGUAGE_DONTKNOW)
     {
         eLnge = IniLnge;
@@ -3003,6 +3050,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
 bool SvNumberFormatter::IsUserDefined(const OUString& sStr,
                                       LanguageType eLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (eLnge == LANGUAGE_DONTKNOW)
     {
         eLnge = IniLnge;
@@ -3022,6 +3070,7 @@ bool SvNumberFormatter::IsUserDefined(const OUString& sStr,
 sal_uInt32 SvNumberFormatter::GetEntryKey(const OUString& sStr,
                                           LanguageType eLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (eLnge == LANGUAGE_DONTKNOW)
     {
         eLnge = IniLnge;
@@ -3032,6 +3081,7 @@ sal_uInt32 SvNumberFormatter::GetEntryKey(const OUString& sStr,
 
 sal_uInt32 SvNumberFormatter::GetStandardIndex(LanguageType eLnge)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (eLnge == LANGUAGE_DONTKNOW)
     {
         eLnge = IniLnge;
@@ -3041,6 +3091,7 @@ sal_uInt32 SvNumberFormatter::GetStandardIndex(LanguageType eLnge)
 
 short SvNumberFormatter::GetType(sal_uInt32 nFIndex)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     short eType;
     SvNumberformat* pFormat = GetFormatEntry( nFIndex );
     if (!pFormat)
@@ -3060,6 +3111,7 @@ short SvNumberFormatter::GetType(sal_uInt32 nFIndex)
 
 void SvNumberFormatter::ClearMergeTable()
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if ( pMergeTable )
     {
         pMergeTable->clear();
@@ -3068,6 +3120,7 @@ void SvNumberFormatter::ClearMergeTable()
 
 SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter& rTable)
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if ( pMergeTable )
     {
         ClearMergeTable();
@@ -3149,6 +3202,7 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
 
 SvNumberFormatterMergeMap SvNumberFormatter::ConvertMergeTableToMap()
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (!HasMergeFormatTable())
     {
         return SvNumberFormatterMergeMap();
@@ -3167,6 +3221,7 @@ SvNumberFormatterMergeMap SvNumberFormatter::ConvertMergeTableToMap()
 sal_uInt32 SvNumberFormatter::GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat,
                                                              LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if ( eLnge == LANGUAGE_DONTKNOW )
     {
         eLnge = IniLnge;
@@ -3188,6 +3243,7 @@ sal_uInt32 SvNumberFormatter::GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat,
 sal_uInt32 SvNumberFormatter::GetFormatIndex( NfIndexTableOffset nTabOff,
                                               LanguageType eLnge )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (nTabOff >= NF_INDEX_TABLE_ENTRIES)
         return NUMBERFORMAT_ENTRY_NOT_FOUND;
 
@@ -3205,6 +3261,7 @@ sal_uInt32 SvNumberFormatter::GetFormatIndex( NfIndexTableOffset nTabOff,
 
 NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset( sal_uInt32 nFormat ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET;      // relative index
     if ( nOffset > SV_MAX_COUNT_STANDARD_FORMATS )
     {
@@ -3221,22 +3278,26 @@ NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset( sal_uInt32 nFormat )
 
 void SvNumberFormatter::SetEvalDateFormat( NfEvalDateFormat eEDF )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     eEvalDateFormat = eEDF;
 }
 
 NfEvalDateFormat SvNumberFormatter::GetEvalDateFormat() const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     return eEvalDateFormat;
 }
 
 void SvNumberFormatter::SetYear2000( sal_uInt16 nVal )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     pStringScanner->SetYear2000( nVal );
 }
 
 
 sal_uInt16 SvNumberFormatter::GetYear2000() const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     return pStringScanner->GetYear2000();
 }
 
@@ -3532,6 +3593,7 @@ bool SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat, OUString
                                                     const NfCurrencyEntry** ppEntry /* = NULL */,
                                                     bool* pBank /* = NULL */ ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if ( ppEntry )
         *ppEntry = nullptr;
     if ( pBank )
@@ -3595,6 +3657,7 @@ const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( bool & bFoundBank,
                                                             LanguageType eFormatLanguage,
                                                             bool bOnlyStringLanguage )
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     sal_Int32 nExtLen = rExtension.getLength();
     LanguageType eExtLang;
     if ( nExtLen )
@@ -3680,6 +3743,7 @@ const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( bool & bFoundBank,
 
 void SvNumberFormatter::GetCompatibilityCurrency( OUString& rSymbol, OUString& rAbbrev ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     css::uno::Sequence< css::i18n::Currency2 >
         xCurrencies( xLocaleData->getAllCurrencies() );
 
@@ -3934,6 +3998,7 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
                                                         const NfCurrencyEntry& rCurr,
                                                         bool bBank ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     OUString aRed = "["
                   + pFormatScanner->GetRedString()
                   + "]";
@@ -4021,6 +4086,7 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
 
 sal_uInt32 SvNumberFormatter::GetMergeFormatIndex( sal_uInt32 nOldFmt ) const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     if (pMergeTable)
     {
         SvNumberFormatterIndexTable::const_iterator it = pMergeTable->find(nOldFmt);
@@ -4034,6 +4100,7 @@ sal_uInt32 SvNumberFormatter::GetMergeFormatIndex( sal_uInt32 nOldFmt ) const
 
 bool SvNumberFormatter::HasMergeFormatTable() const
 {
+    ::osl::MutexGuard aGuard( GetMutex() );
     return pMergeTable && !pMergeTable->empty();
 }
 


More information about the Libreoffice-commits mailing list