diff options
-rw-r--r-- | svl/inc/svl/zforlist.hxx | 13 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 89 | ||||
-rw-r--r-- | svx/inc/svx/numfmtsh.hxx | 3 | ||||
-rw-r--r-- | svx/source/items/numfmtsh.cxx | 7 |
4 files changed, 53 insertions, 59 deletions
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index 10bac7e98267..b1e016269dee 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -318,18 +318,7 @@ public: typedef boost::ptr_vector<NfCurrencyEntry> NfCurrencyTable; -typedef String* WSStringPtr; -class SVL_DLLPUBLIC NfWSStringsDtor : public std::vector<WSStringPtr> -{ -public: - ~NfWSStringsDtor() - { - for( const_iterator it = begin(); it != end(); ++it ) - delete *it; - } - -}; - +typedef std::vector< ::rtl::OUString > NfWSStringsDtor; class SvNumberFormatterRegistry_Impl; diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 0228ac7aaabb..e40a224ec4df 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -3189,7 +3189,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat() DBG_ASSERT( aCurrList.size(), "where is the NewCurrency System standard format?!?" ); // if already loaded or user defined nDefaultSystemCurrencyFormat // will be set to the right value - PutEntry( *aCurrList[ nDefault ], nCheck, nType, + PutEntry( aCurrList[ nDefault ], nCheck, nType, nDefaultSystemCurrencyFormat, LANGUAGE_SYSTEM ); DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" ); DBG_ASSERT( nDefaultSystemCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND, @@ -3234,7 +3234,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat() // if already loaded or user defined nDefaultSystemCurrencyFormat // will be set to the right value short nType; - PutEntry( *aCurrList[ nDefault ], nCheck, nType, + PutEntry( aCurrList[ nDefault ], nCheck, nType, nDefaultCurrencyFormat, ActLnge ); DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" ); DBG_ASSERT( nDefaultCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND, @@ -3671,21 +3671,23 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr rCurr.BuildPositiveFormatString( aPositiveBank, true, *xLocaleData, 1 ); rCurr.BuildNegativeFormatString( aNegativeBank, true, *xLocaleData, 1 ); - WSStringPtr pFormat1 = new String( aPositiveBank ); - *pFormat1 += ';'; - WSStringPtr pFormat2 = new String( *pFormat1 ); + ::rtl::OUStringBuffer format1(aPositiveBank); + format1.append(';'); + format1.append(aNegativeBank); + rStrArr.push_back(format1.makeStringAndClear()); + + ::rtl::OUStringBuffer format2(aPositiveBank); + format2.append(';'); String aRed( '[' ); aRed += pFormatScanner->GetRedString(); aRed += ']'; - *pFormat2 += aRed; + format2.append(aRed); - *pFormat1 += aNegativeBank; - *pFormat2 += aNegativeBank; + format2.append(aNegativeBank); + rStrArr.push_back(format2.makeStringAndClear()); - rStrArr.push_back( pFormat1 ); - rStrArr.push_back( pFormat2 ); nDefault = rStrArr.size() - 1; } else @@ -3694,7 +3696,6 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr // duplicates if no decimals in currency. String aPositive, aNegative, aPositiveNoDec, aNegativeNoDec, aPositiveDashed, aNegativeDashed; - WSStringPtr pFormat1, pFormat2, pFormat3, pFormat4, pFormat5; String aRed( '[' ); aRed += pFormatScanner->GetRedString(); @@ -3702,6 +3703,11 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr rCurr.BuildPositiveFormatString( aPositive, false, *xLocaleData, 1 ); rCurr.BuildNegativeFormatString( aNegative, false, *xLocaleData, 1 ); + ::rtl::OUStringBuffer format1; + ::rtl::OUStringBuffer format2; + ::rtl::OUStringBuffer format3; + ::rtl::OUStringBuffer format4; + ::rtl::OUStringBuffer format5; if ( rCurr.GetDigits() ) { rCurr.BuildPositiveFormatString( aPositiveNoDec, false, *xLocaleData, 0 ); @@ -3709,45 +3715,42 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr rCurr.BuildPositiveFormatString( aPositiveDashed, false, *xLocaleData, 2 ); rCurr.BuildNegativeFormatString( aNegativeDashed, false, *xLocaleData, 2 ); - pFormat1 = new String( aPositiveNoDec ); - *pFormat1 += ';'; - pFormat3 = new String( *pFormat1 ); - pFormat5 = new String( aPositiveDashed ); - *pFormat5 += ';'; - - *pFormat1 += aNegativeNoDec; + format1.append(aPositiveNoDec); + format1.append(';'); + format1.append(aNegativeNoDec); - *pFormat3 += aRed; - *pFormat5 += aRed; + format3.append(aPositiveNoDec); + format3.append(';'); + format3.append(aRed); + format3.append(aNegativeNoDec); - *pFormat3 += aNegativeNoDec; - *pFormat5 += aNegativeDashed; - } - else - { - pFormat1 = NULL; - pFormat3 = NULL; - pFormat5 = NULL; + format5.append(aPositiveDashed); + format5.append(';'); + format5.append(aRed); + format5.append(aNegativeDashed); } - pFormat2 = new String( aPositive ); - *pFormat2 += ';'; - pFormat4 = new String( *pFormat2 ); + format2.append(aPositive); + format2.append(';'); + format2.append(aNegative); - *pFormat2 += aNegative; + format4.append(aPositive); + format4.append(';'); + format4.append(aRed); + format4.append(aNegative); - *pFormat4 += aRed; - *pFormat4 += aNegative; - - if ( pFormat1 ) - rStrArr.push_back( pFormat1 ); - rStrArr.push_back( pFormat2 ); - if ( pFormat3 ) - rStrArr.push_back( pFormat3 ); - rStrArr.push_back( pFormat4 ); + if (rCurr.GetDigits()) { + rStrArr.push_back(format1.makeStringAndClear()); + } + rStrArr.push_back(format2.makeStringAndClear()); + if (rCurr.GetDigits()) { + rStrArr.push_back(format3.makeStringAndClear()); + } + rStrArr.push_back(format4.makeStringAndClear()); nDefault = rStrArr.size() - 1; - if ( pFormat5 ) - rStrArr.push_back( pFormat5 ); + if (rCurr.GetDigits()) { + rStrArr.push_back(format5.makeStringAndClear()); + } } return nDefault; } diff --git a/svx/inc/svx/numfmtsh.hxx b/svx/inc/svx/numfmtsh.hxx index d6005ab572f3..ba3b04cc792f 100644 --- a/svx/inc/svx/numfmtsh.hxx +++ b/svx/inc/svx/numfmtsh.hxx @@ -183,7 +183,8 @@ public: void GetCurrencySymbols(std::vector<rtl::OUString>& rList, bool bFlag ); sal_uInt16 FindCurrencyTableEntry( const String& rFmtString, bool &bTestBanking ); - bool IsInTable(sal_uInt16 nPos,bool bTmpBanking,const String &rFmtString); + bool IsInTable(sal_uInt16 nPos, bool bTmpBanking, + ::rtl::OUString const& rFmtString); private: static const double DEFAULT_NUMVALUE; diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index ef25577453bb..014b548af5f1 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -1029,7 +1029,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL for( size_t i = 0, nPos = nOldListCount; i < aWSStringsDtor.size(); ++i ) { bool bFlag = true; - String aInsStr(*aWSStringsDtor[i]); + String aInsStr(aWSStringsDtor[i]); size_t j; for( j=0; j < aList.size(); ++j ) { @@ -1771,7 +1771,8 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat(const NfCurrencyEntry* pTmpC return (sal_uInt16) -1; } -bool SvxNumberFormatShell::IsInTable(sal_uInt16 nPos,bool bTmpBanking,const String &rFmtString) +bool SvxNumberFormatShell::IsInTable(sal_uInt16 const nPos, + bool const bTmpBanking, ::rtl::OUString const& rFmtString) { bool bFlag=false; @@ -1793,7 +1794,7 @@ bool SvxNumberFormatShell::IsInTable(sal_uInt16 nPos,bool bTmpBanking,const Stri for(sal_uInt16 i=0;i<aWSStringsDtor.size();i++) { - if(*aWSStringsDtor[i]==rFmtString) + if (aWSStringsDtor[i] == rFmtString) { bFlag=true; break; |