[Libreoffice-commits] .: 2 commits - sc/source svl/inc svl/source svx/inc svx/source vcl/source xmloff/source
Eike Rathke
erack at kemper.freedesktop.org
Wed Feb 8 04:15:37 PST 2012
sc/source/core/data/document.cxx | 2
sc/source/core/data/patattr.cxx | 18 +-
sc/source/core/data/stlpool.cxx | 9 -
svl/inc/svl/zforlist.hxx | 31 +++-
svl/source/misc/inettype.cxx | 1
svl/source/numbers/numfmuno.cxx | 7 -
svl/source/numbers/zforlist.cxx | 265 ++++++++++++++++++---------------------
svx/inc/svx/numfmtsh.hxx | 5
svx/source/items/numfmtsh.cxx | 37 ++---
vcl/source/control/combobox.cxx | 1
xmloff/source/style/xmlnumfe.cxx | 9 -
11 files changed, 198 insertions(+), 187 deletions(-)
New commits:
commit 9472e9c77d55a0b9cdf75ce91375765243c0e1f1
Author: Eike Rathke <erack at redhat.com>
Date: Wed Feb 8 13:04:17 2012 +0100
changes to "tools/table.hxx to std::map conversion"
* use consistent indenting with 4 spaces (instead of tabs (plus one space))
* use erase(it++) instead of erase(it); ++it to not access invalidated
iterator
* for First(); Remove(); Next() loops over entire Table use map::clear()
at the end if it isn't in a dtor
* use existing typedef SvNumberFormatTable in numfmtsh.hxx instead of
redefining, which means include zforlist.hxx now and some other forward
declarations can be removed
* removed inlined duplicated code of GetEntry(), implemented it in
zforlist.cxx instead and made const GetFormatEntry() just call GetEntry()
* removed the temporary sal_uIntPtr nFormat to be used as key, the sal_uIntPtr
was only used because Table effectively had pointer size as keys.
* made initial assignments of nDefaultFormat and nDefaultCurrencyFormat use
the ternary conditional operator
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 14229a0..a8cca86 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -561,8 +561,7 @@ public:
sal_uInt32 GetEntryKey( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW );
/// Return the format for a format index
- const SvNumberformat* GetEntry(sal_uInt32 nKey) const
- { SvNumberFormatTable::const_iterator it = aFTable.find(nKey); return it == aFTable.end() ? 0 : it->second; }
+ const SvNumberformat* GetEntry( sal_uInt32 nKey ) const;
/// Return the format index of the standard default number format for language/country
sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
@@ -800,7 +799,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager;
::com::sun::star::lang::Locale aLocale;
SvNumberFormatTable aFTable; // Table of format keys to format entries
- typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap;
+ typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap;
DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys
SvNumberFormatTable* pFormatTable; // For the UI dialog
SvNumberFormatterIndexTable* pMergeTable; // List of indices for merging two formatters
@@ -913,8 +912,12 @@ private:
sal_Int32 nCount, bool bCheckCorrectness = true
);
- SVL_DLLPRIVATE SvNumberformat* GetFormatEntry(sal_uInt32 nKey);
- SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry(sal_uInt32 nKey) const;
+ // Obtain the format entry for a given key index.
+ SVL_DLLPRIVATE SvNumberformat* GetFormatEntry( sal_uInt32 nKey );
+ SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry( sal_uInt32 nKey ) const
+ {
+ return GetEntry( nKey);
+ }
// used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry()
#ifndef DBG_UTIL
@@ -1001,13 +1004,13 @@ public:
inline sal_uInt32 SvNumberFormatter::GetMergeFmtIndex( sal_uInt32 nOldFmt ) const
{
- if (pMergeTable)
- {
- SvNumberFormatterIndexTable::iterator it = pMergeTable->find(nOldFmt);
- if (it != pMergeTable->end())
- return it->second;
- }
- return nOldFmt;
+ if (pMergeTable)
+ {
+ SvNumberFormatterIndexTable::iterator it = pMergeTable->find(nOldFmt);
+ if (it != pMergeTable->end())
+ return it->second;
+ }
+ return nOldFmt;
}
inline bool SvNumberFormatter::HasMergeFmtTbl() const
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index ceb316b..d17a584 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -466,8 +466,8 @@ uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType
sal_uInt32 nCount = rTable.size();
uno::Sequence<sal_Int32> aSeq(nCount);
sal_Int32* pAry = aSeq.getArray();
- sal_uInt32 i=0;
- for (SvNumberFormatTable::iterator it = rTable.begin(); it != rTable.end(); ++it, ++i)
+ sal_uInt32 i=0;
+ for (SvNumberFormatTable::iterator it = rTable.begin(); it != rTable.end(); ++it, ++i)
pAry[i] = it->first;
return aSeq;
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index e540ac3..2ee058f 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -216,8 +216,8 @@ SvNumberFormatter::~SvNumberFormatter()
}
}
- for (SvNumberFormatTable::iterator it = aFTable.begin(); it != aFTable.end(); ++it)
- delete it->second;
+ for (SvNumberFormatTable::iterator it = aFTable.begin(); it != aFTable.end(); ++it)
+ delete it->second;
delete pFormatTable;
delete pCharClass;
delete pStringScanner;
@@ -357,21 +357,21 @@ void SvNumberFormatter::ImpChangeSysCL( LanguageType eLnge, bool bLoadingSO5 )
{
IniLnge = eLnge;
ChangeIntl(eLnge);
- // delete old formats
- for (SvNumberFormatTable::iterator it = aFTable.begin(); it != aFTable.end(); ++it)
- delete it->second;
+ // delete old formats
+ for (SvNumberFormatTable::iterator it = aFTable.begin(); it != aFTable.end(); ++it)
+ delete it->second;
+ aFTable.clear();
ImpGenerateFormats( 0, bLoadingSO5 ); // new standard formats
}
else if ( bLoadingSO5 )
{ // delete additional standard formats
sal_uInt32 nKey;
- SvNumberFormatTable::iterator it = aFTable.find( SV_MAX_ANZ_STANDARD_FORMATE + 1 );
+ SvNumberFormatTable::iterator it = aFTable.find( SV_MAX_ANZ_STANDARD_FORMATE + 1 );
while ( (nKey = it->first) > SV_MAX_ANZ_STANDARD_FORMATE &&
nKey < SV_COUNTRY_LANGUAGE_OFFSET )
{
delete it->second;
- aFTable.erase( it );
- ++it;
+ aFTable.erase( it++ );
}
}
}
@@ -392,8 +392,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
while ( it != aFTable.end() && (nKey = it->first) >= nCLOffset && nKey <= nMaxBuiltin )
{
delete it->second;
- aFTable.erase( it );
- ++it;
+ aFTable.erase( it++ );
}
// move additional and user defined to temporary table
@@ -401,8 +400,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
while ( it != aFTable.end() && (nKey = it->first) >= nCLOffset && nKey < nNextCL )
{
aOldTable[ nKey ] = it->second;
- aFTable.erase( it );
- ++it;
+ aFTable.erase( it++ );
}
// generate new old builtin formats
@@ -442,7 +440,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
else
pNewEntry->SetType( NUMBERFORMAT_DEFINED );
- if ( !aFTable.insert( make_pair(nKey, pNewEntry) ).second )
+ if ( !aFTable.insert( make_pair( nKey, pNewEntry) ).second )
delete pNewEntry;
else
bCheck = true;
@@ -463,7 +461,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
bool SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const
{
- const SvNumberformat* pFormat = GetFormatEntry(F_Index);
+ const SvNumberformat* pFormat = GetFormatEntry(F_Index);
if (!pFormat)
return false;
else
@@ -521,7 +519,7 @@ bool SvNumberFormatter::PutEntry(String& rString,
OSL_FAIL("SvNumberFormatter:: Zu viele Formate pro CL");
delete p_Entry;
}
- else if (!aFTable.insert(make_pair(nPos+1,p_Entry)).second)
+ else if (!aFTable.insert(make_pair( nPos+1,p_Entry)).second)
delete p_Entry;
else
{
@@ -820,7 +818,7 @@ bool SvNumberFormatter::Load( SvStream& rStream )
if (pEnt)
pEnt->SetLastInsertKey(pEntry->GetLastInsertKey());
}
- if (!aFTable.insert(make_pair(nPos, pEntry)).second)
+ if (!aFTable.insert(make_pair( nPos, pEntry)).second)
delete pEntry;
rStream >> nPos;
}
@@ -873,7 +871,7 @@ bool SvNumberFormatter::Save( SvStream& rStream ) const
SvNumberFormatTable::const_iterator it = pTable->begin();
while (it != pTable->end())
{
- SvNumberformat* pEntry = it->second;
+ SvNumberformat* pEntry = it->second;
// Gespeichert werden alle markierten, benutzerdefinierten Formate und
// jeweils das Standardformat zu allen angewaehlten CL-Kombinationen
// sowie NewStandardDefined
@@ -952,7 +950,7 @@ sal_uInt32 SvNumberFormatter::ImpGetCLOffset(LanguageType eLnge) const
sal_uInt32 nOffset = 0;
while (nOffset <= MaxCLOffset)
{
- const SvNumberformat* pFormat = GetFormatEntry(nOffset);
+ const SvNumberformat* pFormat = GetFormatEntry(nOffset);
if (pFormat && pFormat->GetLanguage() == eLnge)
return nOffset;
nOffset += SV_COUNTRY_LANGUAGE_OFFSET;
@@ -965,7 +963,7 @@ sal_uInt32 SvNumberFormatter::ImpIsEntry(const String& rString,
LanguageType eLnge)
{
sal_uInt32 res = NUMBERFORMAT_ENTRY_NOT_FOUND;
- SvNumberFormatTable::iterator it = aFTable.find(nCLOffset);
+ SvNumberFormatTable::iterator it = aFTable.find( nCLOffset);
while ( res == NUMBERFORMAT_ENTRY_NOT_FOUND &&
it != aFTable.end() && it->second->GetLanguage() == eLnge )
{
@@ -1110,14 +1108,14 @@ SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
// (e.g. currency) => has to be done before collecting formats.
sal_uInt32 nDefaultIndex = GetStandardFormat( eType, ActLnge );
- SvNumberFormatTable::iterator it = aFTable.find(CLOffset);
+ SvNumberFormatTable::iterator it = aFTable.find( CLOffset);
if (eType == NUMBERFORMAT_ALL)
{
while (it != aFTable.end() && it->second->GetLanguage() == ActLnge)
{ // copy all entries to output table
(*pFormatTable)[ it->first ] = it->second;
- ++it;
+ ++it;
}
}
else
@@ -1126,7 +1124,7 @@ SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
{ // copy entries of queried type to output table
if ((it->second->GetType()) & eType)
(*pFormatTable)[ it->first ] = it->second;
- ++it;
+ ++it;
}
}
if ( !pFormatTable->empty() )
@@ -1287,15 +1285,14 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
default:
nSearch = CLOffset + ZF_STANDARD;
}
- sal_uInt32 nDefaultFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
- DefaultFormatKeysMap::iterator it = aDefaultFormatKeys.find(nSearch);
- if ( it != aDefaultFormatKeys.end() )
- nDefaultFormat = it->second;
+ DefaultFormatKeysMap::iterator it = aDefaultFormatKeys.find( nSearch);
+ sal_uInt32 nDefaultFormat = (it != aDefaultFormatKeys.end() ?
+ it->second : NUMBERFORMAT_ENTRY_NOT_FOUND);
if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
{ // look for a defined standard
sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
sal_uInt32 nKey;
- SvNumberFormatTable::iterator it2 = aFTable.find( CLOffset );
+ SvNumberFormatTable::iterator it2 = aFTable.find( CLOffset );
while ( (nKey = it2->first ) >= CLOffset && nKey < nStopKey )
{
const SvNumberformat* pEntry = it2->second;
@@ -1331,8 +1328,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
nDefaultFormat = CLOffset + ZF_STANDARD;
}
}
- sal_uIntPtr nFormat = nDefaultFormat;
- aDefaultFormatKeys[ nSearch ] = nFormat;
+ aDefaultFormatKeys[ nSearch ] = nDefaultFormat;
}
return nDefaultFormat;
}
@@ -1490,7 +1486,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
String& sOutString)
{
Color* pColor;
- SvNumberformat* pFormat = GetFormatEntry( nFIndex );
+ SvNumberformat* pFormat = GetFormatEntry( nFIndex );
if (!pFormat)
pFormat = GetFormatEntry(ZF_STANDARD);
LanguageType eLang = pFormat->GetLanguage();
@@ -1887,7 +1883,7 @@ SvNumberformat* SvNumberFormatter::ImpInsertFormat(
return NULL;
}
}
- if ( !aFTable.insert( make_pair(nPos, pFormat) ).second )
+ if ( !aFTable.insert( make_pair( nPos, pFormat) ).second )
{
if (LocaleDataWrapper::areChecksEnabled())
{
@@ -1931,7 +1927,7 @@ void SvNumberFormatter::GetFormatSpecialInfo(sal_uInt32 nFormat,
sal_uInt16& nAnzLeading)
{
- SvNumberformat* pFormat = GetFormatEntry( nFormat );
+ SvNumberformat* pFormat = GetFormatEntry( nFormat );
if (pFormat)
pFormat->GetFormatSpecialInfo(bThousand, IsRed,
nPrecision, nAnzLeading);
@@ -1946,7 +1942,7 @@ void SvNumberFormatter::GetFormatSpecialInfo(sal_uInt32 nFormat,
sal_uInt16 SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const
{
- const SvNumberformat* pFormat = GetFormatEntry( nFormat );
+ const SvNumberformat* pFormat = GetFormatEntry( nFormat );
if ( pFormat )
return pFormat->GetFormatPrecision();
else
@@ -1956,7 +1952,7 @@ sal_uInt16 SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const
String SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const
{
- const SvNumberformat* pFormat = GetFormatEntry(nFormat);
+ const SvNumberformat* pFormat = GetFormatEntry(nFormat);
if ( !pFormat || pFormat->GetLanguage() == ActLnge )
return GetNumDecimalSep();
@@ -2181,20 +2177,20 @@ sal_Int32 SvNumberFormatter::ImpAdjustFormatCodeDefault(
return nDef;
}
-SvNumberformat* SvNumberFormatter::GetFormatEntry(sal_uInt32 nKey)
+SvNumberformat* SvNumberFormatter::GetFormatEntry( sal_uInt32 nKey )
{
- SvNumberFormatTable::iterator it = aFTable.find(nKey);
- if (it != aFTable.end())
- return it->second;
- return 0;
+ SvNumberFormatTable::iterator it = aFTable.find( nKey);
+ if (it != aFTable.end())
+ return it->second;
+ return 0;
}
-const SvNumberformat* SvNumberFormatter::GetFormatEntry(sal_uInt32 nKey) const
+const SvNumberformat* SvNumberFormatter::GetEntry( sal_uInt32 nKey ) const
{
- SvNumberFormatTable::const_iterator it = aFTable.find(nKey);
- if (it != aFTable.end())
- return it->second;
- return 0;
+ SvNumberFormatTable::const_iterator it = aFTable.find( nKey);
+ if (it != aFTable.end())
+ return it->second;
+ return 0;
}
void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bLoadingSO5 )
@@ -2754,7 +2750,7 @@ void SvNumberFormatter::GenerateFormat(String& sString,
const xub_StrLen nDigitsInFirstGroup = static_cast<xub_StrLen>(aGrouping.get());
const String& rThSep = GetNumThousandSep();
- SvNumberformat* pFormat = GetFormatEntry( nIndex );
+ SvNumberformat* pFormat = GetFormatEntry( nIndex );
if (nAnzLeading == 0)
{
@@ -2898,7 +2894,7 @@ bool SvNumberFormatter::IsUserDefined(const String& sStr,
sal_uInt32 nKey = ImpIsEntry(sStr, CLOffset, eLnge);
if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND)
return true;
- SvNumberformat* pEntry = GetFormatEntry( nKey );
+ SvNumberformat* pEntry = GetFormatEntry( nKey );
if ( pEntry && ((pEntry->GetType() & NUMBERFORMAT_DEFINED) != 0) )
return true;
return false;
@@ -2924,7 +2920,7 @@ sal_uInt32 SvNumberFormatter::GetStandardIndex(LanguageType eLnge)
short SvNumberFormatter::GetType(sal_uInt32 nFIndex)
{
short eType;
- SvNumberformat* pFormat = GetFormatEntry( nFIndex );
+ SvNumberformat* pFormat = GetFormatEntry( nFIndex );
if (!pFormat)
eType = NUMBERFORMAT_UNDEFINED;
else
@@ -2953,10 +2949,10 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
sal_uInt32 nCLOffset = 0;
sal_uInt32 nOldKey, nOffset, nNewKey;
SvNumberformat* pNewEntry;
- SvNumberFormatTable::iterator it = rTable.aFTable.begin();
+ SvNumberFormatTable::iterator it = rTable.aFTable.begin();
while (it != rTable.aFTable.end())
{
- SvNumberformat* pFormat = it->second;
+ SvNumberformat* pFormat = it->second;
nOldKey = it->first;
nOffset = nOldKey % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex
if (nOffset == 0) // 1. Format von CL
@@ -2965,11 +2961,11 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
if (nOffset <= SV_MAX_ANZ_STANDARD_FORMATE) // Std.form.
{
nNewKey = nCLOffset + nOffset;
- if (aFTable.find(nNewKey) == aFTable.end()) // noch nicht da
+ if (aFTable.find( nNewKey) == aFTable.end()) // noch nicht da
{
// pNewEntry = new SvNumberformat(*pFormat); // Copy reicht nicht !!!
pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner );
- if (!aFTable.insert(make_pair(nNewKey, pNewEntry)).second)
+ if (!aFTable.insert(make_pair( nNewKey, pNewEntry)).second)
delete pNewEntry;
}
if (nNewKey != nOldKey) // neuer Index
@@ -2998,8 +2994,8 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
"SvNumberFormatter:: Zu viele Formate pro CL");
delete pNewEntry;
}
- else if (!aFTable.insert(make_pair(nNewKey, pNewEntry)).second)
- delete pNewEntry;
+ else if (!aFTable.insert(make_pair( nNewKey, pNewEntry)).second)
+ delete pNewEntry;
else
pStdFormat->SetLastInsertKey((sal_uInt16) (nNewKey - nCLOffset));
}
@@ -3008,7 +3004,7 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
(*pMergeTable)[nOldKey] = nNewKey;
}
}
- ++it;
+ ++it;
}
return pMergeTable;
}
@@ -3021,10 +3017,10 @@ SvNumberFormatterMergeMap SvNumberFormatter::ConvertMergeTableToMap()
SvNumberFormatterMergeMap aMap;
for (SvNumberFormatterIndexTable::iterator it = pMergeTable->begin(); it != pMergeTable->end(); ++it)
- {
+ {
sal_uInt32 nOldKey = it->first;
aMap[ nOldKey ] = it->second;
- }
+ }
ClearMergeTable();
return aMap;
}
@@ -3258,12 +3254,9 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat()
sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
{
sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge );
- sal_uInt32 nDefaultCurrencyFormat;
- DefaultFormatKeysMap::iterator it = aDefaultFormatKeys.find( CLOffset + ZF_STANDARD_CURRENCY );
- if ( it != aDefaultFormatKeys.end() )
- nDefaultCurrencyFormat = it->second;
- else
- nDefaultCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ DefaultFormatKeysMap::iterator it = aDefaultFormatKeys.find( CLOffset + ZF_STANDARD_CURRENCY );
+ sal_uInt32 nDefaultCurrencyFormat = (it != aDefaultFormatKeys.end() ?
+ it->second : NUMBERFORMAT_ENTRY_NOT_FOUND);
if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
{
// look for a defined standard
@@ -3278,7 +3271,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
nDefaultCurrencyFormat = nKey;
break; // while
}
- ++it2;
+ ++it2;
}
if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
@@ -3304,13 +3297,12 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
nDefaultCurrencyFormat = CLOffset + ZF_STANDARD_CURRENCY+3;
else
{ // mark as standard so that it is found next time
- SvNumberformat* pEntry = GetFormatEntry( nDefaultCurrencyFormat );
+ SvNumberformat* pEntry = GetFormatEntry( nDefaultCurrencyFormat );
if ( pEntry )
pEntry->SetStandard();
}
}
- sal_uIntPtr nFormat = nDefaultCurrencyFormat;
- aDefaultFormatKeys[ CLOffset + ZF_STANDARD_CURRENCY ] = nFormat;
+ aDefaultFormatKeys[ CLOffset + ZF_STANDARD_CURRENCY ] = nDefaultCurrencyFormat;
}
return nDefaultCurrencyFormat;
}
@@ -3372,7 +3364,7 @@ bool SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat,
*ppEntry = NULL;
if ( pBank )
*pBank = false;
- const SvNumberformat* pFormat = GetFormatEntry(nFormat);
+ const SvNumberformat* pFormat = GetFormatEntry(nFormat);
if ( pFormat )
{
String aSymbol, aExtension;
diff --git a/svx/inc/svx/numfmtsh.hxx b/svx/inc/svx/numfmtsh.hxx
index 32a7da3..850b46d 100644
--- a/svx/inc/svx/numfmtsh.hxx
+++ b/svx/inc/svx/numfmtsh.hxx
@@ -34,15 +34,12 @@
#include "svx/svxdllapi.h"
#include <svl/svstdarr.hxx>
+#include <svl/zforlist.hxx>
#include <vector>
#include <map>
class Color;
-class SvNumberFormatter;
-class SvNumberformat;
-typedef std::map<sal_uInt32, SvNumberformat*> SvNumberFormatTable;
-class NfCurrencyEntry;
enum SvxNumberValueType
{
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 4c23829..d3fe22d 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -842,12 +842,12 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<String*>& rLi
if(nCurCategory!=NUMBERFORMAT_ALL)
{
- SvNumberFormatTable::iterator it = pCurFmtTable->begin();
+ SvNumberFormatTable::iterator it = pCurFmtTable->begin();
while ( it != pCurFmtTable->end() )
{
sal_uInt32 nKey = it->first;
- pNumEntry = it->second;
+ pNumEntry = it->second;
if ( !IsRemoved_Impl( nKey ))
{
@@ -878,7 +878,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<String*>& rLi
aCurEntryList.push_back( nKey );
}
}
- ++it;
+ ++it;
}
}
return nSelPos;
@@ -945,11 +945,11 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL
pTmpCurrencyEntry->BuildSymbolString(rShortSymbol,bTmpBanking,true);
}
- SvNumberFormatTable::iterator it = pCurFmtTable->begin();
+ SvNumberFormatTable::iterator it = pCurFmtTable->begin();
while ( it != pCurFmtTable->end() )
{
sal_uInt32 nKey = it->first;
- const SvNumberformat* pNumEntry = it->second;
+ const SvNumberformat* pNumEntry = it->second;
if ( !IsRemoved_Impl( nKey ) )
{
@@ -964,7 +964,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL
bool bInsFlag = false;
if ( pNumEntry->HasNewCurrency() )
{
- bInsFlag = true; // merge locale formats into currency selection
+ bInsFlag = true; // merge locale formats into currency selection
}
else if( (!bTmpBanking && aNewFormNInfo.Search(rSymbol)!=STRING_NOTFOUND) ||
(bTmpBanking && aNewFormNInfo.Search(rBankSymbol)!=STRING_NOTFOUND) )
@@ -994,7 +994,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL
}
}
}
- ++it;
+ ++it;
}
NfWSStringsDtor aWSStringsDtor;
@@ -1101,11 +1101,11 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<String*>& rList,
bool bAdditional = (nPrivCat != CAT_USERDEFINED &&
nCurCategory != NUMBERFORMAT_ALL);
- SvNumberFormatTable::iterator it = pCurFmtTable->begin();
+ SvNumberFormatTable::iterator it = pCurFmtTable->begin();
while ( it != pCurFmtTable->end() )
{
sal_uInt32 nKey = it->first;
- const SvNumberformat* pNumEntry = it->second;
+ const SvNumberformat* pNumEntry = it->second;
if ( !IsRemoved_Impl( nKey ) )
{
@@ -1134,7 +1134,7 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<String*>& rList,
}
}
}
- ++it;
+ ++it;
}
return nSelPos;
}
commit 0979307bbf769399f97da10a29f04936a6cf117c
Author: Noel Grandin <noel at peralex.com>
Date: Mon Feb 6 12:50:59 2012 +0200
tools/table.hxx to std::map conversion in SV, SVL and SVX modules
This patch converts one use of tools/table.hxx in
svl/inc/svl/zforlist.hxx, whose use in turn spans 3 modules.
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 13ccc62..a7e66cd 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2163,7 +2163,7 @@ void ScDocument::MergeNumberFormatter(ScDocument* pSrcDoc)
{
SvNumberFormatterIndexTable* pExchangeList =
pThisFormatter->MergeFormatter(*(pOtherFormatter));
- if (pExchangeList->Count() > 0)
+ if (!pExchangeList->empty())
pFormatExchangeList = pExchangeList;
}
}
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 6de3e0a..5dfa7be 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -970,9 +970,12 @@ SfxStyleSheetBase* lcl_CopyStyleToPool
rSrcSet.GetItemState( ATTR_VALUE_FORMAT, false, &pSrcItem ) == SFX_ITEM_SET )
{
sal_uLong nOldFormat = static_cast<const SfxUInt32Item*>(pSrcItem)->GetValue();
- sal_uInt32* pNewFormat = static_cast<sal_uInt32*>(pFormatExchangeList->Get( nOldFormat ));
- if (pNewFormat)
- rDestSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, *pNewFormat ) );
+ SvNumberFormatterIndexTable::const_iterator it = pFormatExchangeList->find(nOldFormat);
+ if (it != pFormatExchangeList->end())
+ {
+ sal_uInt32 nNewFormat = it->second;
+ rDestSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
+ }
}
// ggF. abgeleitete Styles erzeugen, wenn nicht vorhanden:
@@ -1075,9 +1078,12 @@ ScPatternAttr* ScPatternAttr::PutInPool( ScDocument* pDestDoc, ScDocument* pSrcD
// Zahlformate nach Exchange-Liste
sal_uLong nOldFormat = ((const SfxUInt32Item*)pSrcItem)->GetValue();
- sal_uInt32* pNewFormat = static_cast<sal_uInt32*>(pDestDoc->GetFormatExchangeList()->Get(nOldFormat));
- if (pNewFormat)
- pNewItem = new SfxUInt32Item( ATTR_VALUE_FORMAT, (sal_uInt32) (*pNewFormat) );
+ SvNumberFormatterIndexTable::const_iterator it = pDestDoc->GetFormatExchangeList()->find(nOldFormat);
+ if (it != pDestDoc->GetFormatExchangeList()->end())
+ {
+ sal_uInt32 nNewFormat = it->second;
+ pNewItem = new SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat );
+ }
}
if ( pNewItem )
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index f9dbef0..e98f33e 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -198,9 +198,12 @@ void ScStyleSheetPool::CopyStyleFrom( ScStyleSheetPool* pSrcPool,
rSourceSet.GetItemState( ATTR_VALUE_FORMAT, false, &pItem ) == SFX_ITEM_SET )
{
sal_uLong nOldFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
- sal_uInt32* pNewFormat = static_cast<sal_uInt32*>(pDoc->GetFormatExchangeList()->Get( nOldFormat ));
- if (pNewFormat)
- rDestSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, *pNewFormat ) );
+ SvNumberFormatterIndexTable::const_iterator it = pDoc->GetFormatExchangeList()->find(nOldFormat);
+ if (it != pDoc->GetFormatExchangeList()->end())
+ {
+ sal_uInt32 nNewFormat = it->second;
+ rDestSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
+ }
}
}
}
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index ac387d4..14229a0 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -30,7 +30,6 @@
#include "svl/svldllapi.h"
#include <tools/string.hxx>
-#include <tools/table.hxx>
#include <i18npool/lang.h>
#include <svl/svarray.hxx>
#include <com/sun/star/uno/Reference.hxx>
@@ -214,10 +213,10 @@ enum NfEvalDateFormat
};
-DECLARE_TABLE (SvNumberFormatTable, SvNumberformat*)
-DECLARE_TABLE (SvNumberFormatterIndexTable, sal_uInt32*)
+typedef std::map<sal_uInt32, SvNumberformat*> SvNumberFormatTable;
+typedef std::map<sal_uInt16, sal_uInt32> SvNumberFormatterIndexTable;
-typedef ::std::map< sal_uInt32, sal_uInt32 > SvNumberFormatterMergeMap;
+typedef ::std::map< sal_uInt32, sal_uInt32> SvNumberFormatterMergeMap;
typedef ::std::set< LanguageType > NfInstalledLocales;
@@ -563,7 +562,7 @@ public:
/// Return the format for a format index
const SvNumberformat* GetEntry(sal_uInt32 nKey) const
- { return (SvNumberformat*) aFTable.Get(nKey); }
+ { SvNumberFormatTable::const_iterator it = aFTable.find(nKey); return it == aFTable.end() ? 0 : it->second; }
/// Return the format index of the standard default number format for language/country
sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
@@ -801,7 +800,8 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager;
::com::sun::star::lang::Locale aLocale;
SvNumberFormatTable aFTable; // Table of format keys to format entries
- Table aDefaultFormatKeys; // Table of default standard to format keys
+ typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap;
+ DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys
SvNumberFormatTable* pFormatTable; // For the UI dialog
SvNumberFormatterIndexTable* pMergeTable; // List of indices for merging two formatters
CharClass* pCharClass; // CharacterClassification
@@ -913,6 +913,9 @@ private:
sal_Int32 nCount, bool bCheckCorrectness = true
);
+ SVL_DLLPRIVATE SvNumberformat* GetFormatEntry(sal_uInt32 nKey);
+ SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry(sal_uInt32 nKey) const;
+
// used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry()
#ifndef DBG_UTIL
inline
@@ -998,13 +1001,18 @@ public:
inline sal_uInt32 SvNumberFormatter::GetMergeFmtIndex( sal_uInt32 nOldFmt ) const
{
- sal_uInt32* pU = (pMergeTable && pMergeTable->Count()) ? (sal_uInt32*)pMergeTable->Get( nOldFmt ) : 0;
- return pU ? *pU : nOldFmt;
+ if (pMergeTable)
+ {
+ SvNumberFormatterIndexTable::iterator it = pMergeTable->find(nOldFmt);
+ if (it != pMergeTable->end())
+ return it->second;
+ }
+ return nOldFmt;
}
inline bool SvNumberFormatter::HasMergeFmtTbl() const
{
- return pMergeTable && (0 != pMergeTable->Count());
+ return pMergeTable && !pMergeTable->empty();
}
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index c68e528..edf11cb 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -26,7 +26,6 @@
*
************************************************************************/
-#include <tools/table.hxx>
#include <tools/wldcrd.hxx>
#include <rtl/instance.hxx>
#include <svl/inettype.hxx>
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index cd7761e..ceb316b 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -463,11 +463,12 @@ uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType
SvNumberFormatTable& rTable = bCreate ?
pFormatter->ChangeCL( nType, nIndex, eLang ) :
pFormatter->GetEntryTable( nType, nIndex, eLang );
- sal_uInt32 nCount = rTable.Count();
+ sal_uInt32 nCount = rTable.size();
uno::Sequence<sal_Int32> aSeq(nCount);
sal_Int32* pAry = aSeq.getArray();
- for (sal_uInt32 i=0; i<nCount; i++)
- pAry[i] = rTable.GetObjectKey( i );
+ sal_uInt32 i=0;
+ for (SvNumberFormatTable::iterator it = rTable.begin(); it != rTable.end(); ++it, ++i)
+ pAry[i] = it->first;
return aSeq;
}
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 1f5085d..e540ac3 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -62,6 +62,7 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::i18n;
using namespace ::com::sun::star::lang;
+using namespace ::std;
using ::rtl::OUString;
@@ -215,12 +216,8 @@ SvNumberFormatter::~SvNumberFormatter()
}
}
- SvNumberformat* pEntry = aFTable.First();
- while (pEntry)
- {
- delete pEntry;
- pEntry = aFTable.Next();
- }
+ for (SvNumberFormatTable::iterator it = aFTable.begin(); it != aFTable.end(); ++it)
+ delete it->second;
delete pFormatTable;
delete pCharClass;
delete pStringScanner;
@@ -360,24 +357,21 @@ void SvNumberFormatter::ImpChangeSysCL( LanguageType eLnge, bool bLoadingSO5 )
{
IniLnge = eLnge;
ChangeIntl(eLnge);
- SvNumberformat* pEntry = aFTable.First();
- while (pEntry) // delete old formats
- {
- pEntry = (SvNumberformat*) aFTable.Remove(aFTable.GetCurKey());
- delete pEntry;
- pEntry = (SvNumberformat*) aFTable.First();
- }
+ // delete old formats
+ for (SvNumberFormatTable::iterator it = aFTable.begin(); it != aFTable.end(); ++it)
+ delete it->second;
ImpGenerateFormats( 0, bLoadingSO5 ); // new standard formats
}
else if ( bLoadingSO5 )
{ // delete additional standard formats
sal_uInt32 nKey;
- aFTable.Seek( SV_MAX_ANZ_STANDARD_FORMATE + 1 );
- while ( (nKey = aFTable.GetCurKey()) > SV_MAX_ANZ_STANDARD_FORMATE &&
+ SvNumberFormatTable::iterator it = aFTable.find( SV_MAX_ANZ_STANDARD_FORMATE + 1 );
+ while ( (nKey = it->first) > SV_MAX_ANZ_STANDARD_FORMATE &&
nKey < SV_COUNTRY_LANGUAGE_OFFSET )
{
- SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey );
- delete pEntry;
+ delete it->second;
+ aFTable.erase( it );
+ ++it;
}
}
}
@@ -394,19 +388,21 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
sal_uInt32 nKey;
// remove old builtin formats
- aFTable.Seek( nCLOffset );
- while ( (nKey = aFTable.GetCurKey()) >= nCLOffset && nKey <= nMaxBuiltin && aFTable.Count() )
+ SvNumberFormatTable::iterator it = aFTable.find( nCLOffset );
+ while ( it != aFTable.end() && (nKey = it->first) >= nCLOffset && nKey <= nMaxBuiltin )
{
- SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey );
- delete pEntry;
+ delete it->second;
+ aFTable.erase( it );
+ ++it;
}
// move additional and user defined to temporary table
- Table aOldTable;
- while ( (nKey = aFTable.GetCurKey()) >= nCLOffset && nKey < nNextCL && aFTable.Count() )
+ SvNumberFormatTable aOldTable;
+ while ( it != aFTable.end() && (nKey = it->first) >= nCLOffset && nKey < nNextCL )
{
- SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey );
- aOldTable.Insert( nKey, pEntry );
+ aOldTable[ nKey ] = it->second;
+ aFTable.erase( it );
+ ++it;
}
// generate new old builtin formats
@@ -416,16 +412,16 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
ImpGenerateFormats( nCLOffset, true );
// convert additional and user defined from old system to new system
- SvNumberformat* pStdFormat = (SvNumberformat*) aFTable.Get( nCLOffset + ZF_STANDARD );
+ SvNumberformat* pStdFormat = GetFormatEntry( nCLOffset + ZF_STANDARD );
sal_uInt32 nLastKey = nMaxBuiltin;
pFormatScanner->SetConvertMode( eOldLanguage, LANGUAGE_SYSTEM, true );
- aOldTable.First();
- while ( aOldTable.Count() )
+ while ( !aOldTable.empty() )
{
- nKey = aOldTable.GetCurKey();
+ nKey = aOldTable.begin()->first;
if ( nLastKey < nKey )
nLastKey = nKey;
- SvNumberformat* pOldEntry = (SvNumberformat*) aOldTable.Remove( nKey );
+ SvNumberformat* pOldEntry = aOldTable.begin()->second;
+ aOldTable.erase( nKey );
String aString( pOldEntry->GetFormatstring() );
xub_StrLen nCheckPos = STRING_NOTFOUND;
@@ -446,7 +442,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
else
pNewEntry->SetType( NUMBERFORMAT_DEFINED );
- if ( !aFTable.Insert( nKey, pNewEntry ) )
+ if ( !aFTable.insert( make_pair(nKey, pNewEntry) ).second )
delete pNewEntry;
else
bCheck = true;
@@ -467,7 +463,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
bool SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const
{
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index);
+ const SvNumberformat* pFormat = GetFormatEntry(F_Index);
if (!pFormat)
return false;
else
@@ -518,14 +514,14 @@ bool SvNumberFormatter::PutEntry(String& rString,
else
{
SvNumberformat* pStdFormat =
- (SvNumberformat*) aFTable.Get(CLOffset + ZF_STANDARD);
+ GetFormatEntry(CLOffset + ZF_STANDARD);
sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey();
if (nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
{
OSL_FAIL("SvNumberFormatter:: Zu viele Formate pro CL");
delete p_Entry;
}
- else if (!aFTable.Insert(nPos+1,p_Entry))
+ else if (!aFTable.insert(make_pair(nPos+1,p_Entry)).second)
delete p_Entry;
else
{
@@ -658,8 +654,8 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString,
void SvNumberFormatter::DeleteEntry(sal_uInt32 nKey)
{
- SvNumberformat* pEntry = aFTable.Remove(nKey);
- delete pEntry;
+ delete aFTable[nKey];
+ aFTable.erase(nKey);
}
bool SvNumberFormatter::Load( SvStream& rStream )
@@ -820,11 +816,11 @@ bool SvNumberFormatter::Load( SvStream& rStream )
}
if ( nOffset == 0 ) // StandardFormat
{
- SvNumberformat* pEnt = aFTable.Get(nPos);
+ SvNumberformat* pEnt = GetFormatEntry(nPos);
if (pEnt)
pEnt->SetLastInsertKey(pEntry->GetLastInsertKey());
}
- if (!aFTable.Insert(nPos, pEntry))
+ if (!aFTable.insert(make_pair(nPos, pEntry)).second)
delete pEntry;
rStream >> nPos;
}
@@ -873,23 +869,24 @@ bool SvNumberFormatter::Save( SvStream& rStream ) const
// ab 364i wird gespeichert was SYSTEM wirklich war, vorher hart LANGUAGE_SYSTEM
rStream << (sal_uInt16) SV_NUMBERFORMATTER_VERSION;
rStream << (sal_uInt16) SvtSysLocale().GetLanguage() << (sal_uInt16) IniLnge;
- SvNumberFormatTable* pTable = (SvNumberFormatTable*) &aFTable;
- SvNumberformat* pEntry = (SvNumberformat*) pTable->First();
- while (pEntry)
+ const SvNumberFormatTable* pTable = &aFTable;
+ SvNumberFormatTable::const_iterator it = pTable->begin();
+ while (it != pTable->end())
{
+ SvNumberformat* pEntry = it->second;
// Gespeichert werden alle markierten, benutzerdefinierten Formate und
// jeweils das Standardformat zu allen angewaehlten CL-Kombinationen
// sowie NewStandardDefined
if ( pEntry->GetUsed() || (pEntry->GetType() & NUMBERFORMAT_DEFINED) ||
pEntry->GetNewStandardDefined() ||
- (pTable->GetCurKey() % SV_COUNTRY_LANGUAGE_OFFSET == 0) )
+ (it->first % SV_COUNTRY_LANGUAGE_OFFSET == 0) )
{
- rStream << static_cast<sal_uInt32>(pTable->GetCurKey())
+ rStream << it->first
<< (sal_uInt16) LANGUAGE_SYSTEM
<< (sal_uInt16) pEntry->GetLanguage();
pEntry->Save(rStream, aHdr);
}
- pEntry = (SvNumberformat*) pTable->Next();
+ ++it;
}
rStream << NUMBERFORMAT_ENTRY_NOT_FOUND; // EndeKennung
@@ -911,7 +908,7 @@ void SvNumberFormatter::GetUsedLanguages( std::vector<sal_uInt16>& rList )
sal_uInt32 nOffset = 0;
while (nOffset <= MaxCLOffset)
{
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nOffset);
+ SvNumberformat* pFormat = GetFormatEntry(nOffset);
if (pFormat)
rList.push_back( pFormat->GetLanguage() );
nOffset += SV_COUNTRY_LANGUAGE_OFFSET;
@@ -952,11 +949,10 @@ String SvNumberFormatter::GetStandardName( LanguageType eLnge )
sal_uInt32 SvNumberFormatter::ImpGetCLOffset(LanguageType eLnge) const
{
- SvNumberformat* pFormat;
sal_uInt32 nOffset = 0;
while (nOffset <= MaxCLOffset)
{
- pFormat = (SvNumberformat*) aFTable.Get(nOffset);
+ const SvNumberformat* pFormat = GetFormatEntry(nOffset);
if (pFormat && pFormat->GetLanguage() == eLnge)
return nOffset;
nOffset += SV_COUNTRY_LANGUAGE_OFFSET;
@@ -969,15 +965,14 @@ sal_uInt32 SvNumberFormatter::ImpIsEntry(const String& rString,
LanguageType eLnge)
{
sal_uInt32 res = NUMBERFORMAT_ENTRY_NOT_FOUND;
- SvNumberformat* pEntry;
- pEntry = (SvNumberformat*) aFTable.Seek(nCLOffset);
+ SvNumberFormatTable::iterator it = aFTable.find(nCLOffset);
while ( res == NUMBERFORMAT_ENTRY_NOT_FOUND &&
- pEntry && pEntry->GetLanguage() == eLnge )
+ it != aFTable.end() && it->second->GetLanguage() == eLnge )
{
- if ( rString == pEntry->GetFormatstring() )
- res = aFTable.GetCurKey();
+ if ( rString == it->second->GetFormatstring() )
+ res = it->first;
else
- pEntry = (SvNumberformat*) aFTable.Next();
+ ++it;
}
return res;
}
@@ -993,7 +988,7 @@ SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable(
rLnge = IniLnge;
else
{
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(FIndex);
+ SvNumberformat* pFormat = GetFormatEntry(FIndex);
if (!pFormat)
{
// OSL_FAIL("SvNumberFormatter:: Unbekanntes altes Zahlformat (1)");
@@ -1105,7 +1100,7 @@ SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
LanguageType eLnge)
{
if ( pFormatTable )
- pFormatTable->Clear();
+ pFormatTable->clear();
else
pFormatTable = new SvNumberFormatTable;
ChangeIntl(eLnge);
@@ -1115,30 +1110,29 @@ SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
// (e.g. currency) => has to be done before collecting formats.
sal_uInt32 nDefaultIndex = GetStandardFormat( eType, ActLnge );
- SvNumberformat* pEntry;
- pEntry = (SvNumberformat*) aFTable.Seek(CLOffset);
+ SvNumberFormatTable::iterator it = aFTable.find(CLOffset);
if (eType == NUMBERFORMAT_ALL)
{
- while (pEntry && pEntry->GetLanguage() == ActLnge)
+ while (it != aFTable.end() && it->second->GetLanguage() == ActLnge)
{ // copy all entries to output table
- pFormatTable->Insert( aFTable.GetCurKey(), pEntry );
- pEntry = (SvNumberformat*) aFTable.Next();
+ (*pFormatTable)[ it->first ] = it->second;
+ ++it;
}
}
else
{
- while (pEntry && pEntry->GetLanguage() == ActLnge)
+ while (it != aFTable.end() && it->second->GetLanguage() == ActLnge)
{ // copy entries of queried type to output table
- if ((pEntry->GetType()) & eType)
- pFormatTable->Insert(aFTable.GetCurKey(),pEntry);
- pEntry = (SvNumberformat*) aFTable.Next();
+ if ((it->second->GetType()) & eType)
+ (*pFormatTable)[ it->first ] = it->second;
+ ++it;
}
}
- if ( pFormatTable->Count() > 0 )
+ if ( !pFormatTable->empty() )
{ // select default if queried format doesn't exist or queried type or
// language differ from existing format
- pEntry = aFTable.Get(FIndex);
+ SvNumberformat* pEntry = GetFormatEntry(FIndex);
if ( !pEntry || !(pEntry->GetType() & eType) || pEntry->GetLanguage() != ActLnge )
FIndex = nDefaultIndex;
}
@@ -1150,7 +1144,7 @@ bool SvNumberFormatter::IsNumberFormat(const String& sString,
double& fOutNumber)
{
short FType;
- const SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index);
+ const SvNumberformat* pFormat = GetFormatEntry(F_Index);
if (!pFormat)
{
ChangeIntl(IniLnge);
@@ -1293,25 +1287,25 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
default:
nSearch = CLOffset + ZF_STANDARD;
}
- sal_uInt32 nDefaultFormat = (sal_uInt32)(sal_uLong) aDefaultFormatKeys.Get( nSearch );
- if ( !nDefaultFormat )
- nDefaultFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ sal_uInt32 nDefaultFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ DefaultFormatKeysMap::iterator it = aDefaultFormatKeys.find(nSearch);
+ if ( it != aDefaultFormatKeys.end() )
+ nDefaultFormat = it->second;
if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
{ // look for a defined standard
sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
sal_uInt32 nKey;
- aFTable.Seek( CLOffset );
- while ( (nKey = aFTable.GetCurKey()) >= CLOffset && nKey < nStopKey )
+ SvNumberFormatTable::iterator it2 = aFTable.find( CLOffset );
+ while ( (nKey = it2->first ) >= CLOffset && nKey < nStopKey )
{
- const SvNumberformat* pEntry =
- (const SvNumberformat*) aFTable.GetCurObject();
+ const SvNumberformat* pEntry = it2->second;
if ( pEntry->IsStandard() && ((pEntry->GetType() &
~NUMBERFORMAT_DEFINED) == nType) )
{
nDefaultFormat = nKey;
break; // while
}
- aFTable.Next();
+ ++it2;
}
if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
@@ -1338,7 +1332,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
}
}
sal_uIntPtr nFormat = nDefaultFormat;
- aDefaultFormatKeys.Insert( nSearch, (void*) nFormat );
+ aDefaultFormatKeys[ nSearch ] = nFormat;
}
return nDefaultFormat;
}
@@ -1495,11 +1489,10 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
sal_uInt32 nFIndex,
String& sOutString)
{
- SvNumberformat* pFormat;
Color* pColor;
- pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
+ SvNumberformat* pFormat = GetFormatEntry( nFIndex );
if (!pFormat)
- pFormat = aFTable.Get(ZF_STANDARD);
+ pFormat = GetFormatEntry(ZF_STANDARD);
LanguageType eLang = pFormat->GetLanguage();
ChangeIntl( eLang );
short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED;
@@ -1519,7 +1512,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
}
sal_uInt32 nKey = GetEditFormat( fOutNumber, nFIndex, eType, eLang, pFormat);
if ( nKey != nFIndex )
- pFormat = (SvNumberformat*) aFTable.Get( nKey );
+ pFormat = GetFormatEntry( nKey );
if (pFormat)
{
if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() )
@@ -1552,9 +1545,9 @@ void SvNumberFormatter::GetOutputString(const double& fOutNumber,
sOutString.Erase();
return;
}
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
+ SvNumberformat* pFormat = GetFormatEntry( nFIndex );
if (!pFormat)
- pFormat = aFTable.Get(ZF_STANDARD);
+ pFormat = GetFormatEntry(ZF_STANDARD);
ChangeIntl(pFormat->GetLanguage());
pFormat->GetOutputString(fOutNumber, sOutString, ppColor);
}
@@ -1564,9 +1557,9 @@ void SvNumberFormatter::GetOutputString(String& sString,
String& sOutString,
Color** ppColor)
{
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
+ SvNumberformat* pFormat = GetFormatEntry( nFIndex );
if (!pFormat)
- pFormat = aFTable.Get(ZF_STANDARD_TEXT);
+ pFormat = GetFormatEntry(ZF_STANDARD_TEXT);
if (!pFormat->IsTextFormat() && !pFormat->HasTextFormat())
{
*ppColor = NULL;
@@ -1894,7 +1887,7 @@ SvNumberformat* SvNumberFormatter::ImpInsertFormat(
return NULL;
}
}
- if ( !aFTable.Insert( nPos, pFormat ) )
+ if ( !aFTable.insert( make_pair(nPos, pFormat) ).second )
{
if (LocaleDataWrapper::areChecksEnabled())
{
@@ -1938,7 +1931,7 @@ void SvNumberFormatter::GetFormatSpecialInfo(sal_uInt32 nFormat,
sal_uInt16& nAnzLeading)
{
- const SvNumberformat* pFormat = aFTable.Get(nFormat);
+ SvNumberformat* pFormat = GetFormatEntry( nFormat );
if (pFormat)
pFormat->GetFormatSpecialInfo(bThousand, IsRed,
nPrecision, nAnzLeading);
@@ -1953,7 +1946,7 @@ void SvNumberFormatter::GetFormatSpecialInfo(sal_uInt32 nFormat,
sal_uInt16 SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const
{
- const SvNumberformat* pFormat = aFTable.Get( nFormat );
+ const SvNumberformat* pFormat = GetFormatEntry( nFormat );
if ( pFormat )
return pFormat->GetFormatPrecision();
else
@@ -1963,7 +1956,7 @@ sal_uInt16 SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const
String SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const
{
- const SvNumberformat* pFormat = aFTable.Get( nFormat );
+ const SvNumberformat* pFormat = GetFormatEntry(nFormat);
if ( !pFormat || pFormat->GetLanguage() == ActLnge )
return GetNumDecimalSep();
@@ -2188,6 +2181,21 @@ sal_Int32 SvNumberFormatter::ImpAdjustFormatCodeDefault(
return nDef;
}
+SvNumberformat* SvNumberFormatter::GetFormatEntry(sal_uInt32 nKey)
+{
+ SvNumberFormatTable::iterator it = aFTable.find(nKey);
+ if (it != aFTable.end())
+ return it->second;
+ return 0;
+}
+
+const SvNumberformat* SvNumberFormatter::GetFormatEntry(sal_uInt32 nKey) const
+{
+ SvNumberFormatTable::const_iterator it = aFTable.find(nKey);
+ if (it != aFTable.end())
+ return it->second;
+ return 0;
+}
void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bLoadingSO5 )
{
@@ -2259,9 +2267,9 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bLoadingSO
pFormatScanner, pStringScanner, nCheckPos, ActLnge );
pNewFormat->SetType(NUMBERFORMAT_LOGICAL);
pNewFormat->SetStandard();
- if ( !aFTable.Insert(
+ if ( !aFTable.insert(make_pair(
CLOffset + SetIndexTable( NF_BOOLEAN, ZF_STANDARD_LOGICAL ),
- pNewFormat))
+ pNewFormat)).second)
delete pNewFormat;
// Text
@@ -2270,9 +2278,9 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bLoadingSO
pFormatScanner, pStringScanner, nCheckPos, ActLnge );
pNewFormat->SetType(NUMBERFORMAT_TEXT);
pNewFormat->SetStandard();
- if ( !aFTable.Insert(
+ if ( !aFTable.insert(make_pair(
CLOffset + SetIndexTable( NF_TEXT, ZF_STANDARD_TEXT ),
- pNewFormat))
+ pNewFormat)).second)
delete pNewFormat;
@@ -2642,8 +2650,7 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset,
{
using namespace ::com::sun::star;
- SvNumberformat* pStdFormat =
- (SvNumberformat*) aFTable.Get( CLOffset + ZF_STANDARD );
+ SvNumberformat* pStdFormat = GetFormatEntry( CLOffset + ZF_STANDARD );
if ( !pStdFormat )
{
SAL_WARN( "svl.numbers", "ImpGenerateAdditionalFormats: no GENERAL format" );
@@ -2747,7 +2754,7 @@ void SvNumberFormatter::GenerateFormat(String& sString,
const xub_StrLen nDigitsInFirstGroup = static_cast<xub_StrLen>(aGrouping.get());
const String& rThSep = GetNumThousandSep();
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nIndex);
+ SvNumberformat* pFormat = GetFormatEntry( nIndex );
if (nAnzLeading == 0)
{
@@ -2891,7 +2898,7 @@ bool SvNumberFormatter::IsUserDefined(const String& sStr,
sal_uInt32 nKey = ImpIsEntry(sStr, CLOffset, eLnge);
if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND)
return true;
- SvNumberformat* pEntry = aFTable.Get(nKey);
+ SvNumberformat* pEntry = GetFormatEntry( nKey );
if ( pEntry && ((pEntry->GetType() & NUMBERFORMAT_DEFINED) != 0) )
return true;
return false;
@@ -2917,7 +2924,7 @@ sal_uInt32 SvNumberFormatter::GetStandardIndex(LanguageType eLnge)
short SvNumberFormatter::GetType(sal_uInt32 nFIndex)
{
short eType;
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
+ SvNumberformat* pFormat = GetFormatEntry( nFIndex );
if (!pFormat)
eType = NUMBERFORMAT_UNDEFINED;
else
@@ -2933,13 +2940,7 @@ void SvNumberFormatter::ClearMergeTable()
{
if ( pMergeTable )
{
- sal_uInt32* pIndex = (sal_uInt32*) pMergeTable->First();
- while (pIndex)
- {
- delete pIndex;
- pIndex = pMergeTable->Next();
- }
- pMergeTable->Clear();
+ pMergeTable->clear();
}
}
@@ -2951,12 +2952,12 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
pMergeTable = new SvNumberFormatterIndexTable;
sal_uInt32 nCLOffset = 0;
sal_uInt32 nOldKey, nOffset, nNewKey;
- sal_uInt32* pNewIndex;
SvNumberformat* pNewEntry;
- SvNumberformat* pFormat = rTable.aFTable.First();
- while (pFormat)
+ SvNumberFormatTable::iterator it = rTable.aFTable.begin();
+ while (it != rTable.aFTable.end())
{
- nOldKey = rTable.aFTable.GetCurKey();
+ SvNumberformat* pFormat = it->second;
+ nOldKey = it->first;
nOffset = nOldKey % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex
if (nOffset == 0) // 1. Format von CL
nCLOffset = ImpGenerateCL(pFormat->GetLanguage());
@@ -2964,18 +2965,16 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
if (nOffset <= SV_MAX_ANZ_STANDARD_FORMATE) // Std.form.
{
nNewKey = nCLOffset + nOffset;
- if (!aFTable.Get(nNewKey)) // noch nicht da
+ if (aFTable.find(nNewKey) == aFTable.end()) // noch nicht da
{
// pNewEntry = new SvNumberformat(*pFormat); // Copy reicht nicht !!!
pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner );
- if (!aFTable.Insert(nNewKey, pNewEntry))
+ if (!aFTable.insert(make_pair(nNewKey, pNewEntry)).second)
delete pNewEntry;
}
if (nNewKey != nOldKey) // neuer Index
{
- pNewIndex = new sal_uInt32(nNewKey);
- if (!pMergeTable->Insert(nOldKey,pNewIndex))
- delete pNewIndex;
+ (*pMergeTable)[nOldKey] = nNewKey;
}
}
else // benutzerdef.
@@ -2990,7 +2989,7 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
else
{
SvNumberformat* pStdFormat =
- (SvNumberformat*) aFTable.Get(nCLOffset + ZF_STANDARD);
+ GetFormatEntry(nCLOffset + ZF_STANDARD);
sal_uInt32 nPos = nCLOffset + pStdFormat->GetLastInsertKey();
nNewKey = nPos+1;
if (nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
@@ -2999,19 +2998,17 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
"SvNumberFormatter:: Zu viele Formate pro CL");
delete pNewEntry;
}
- else if (!aFTable.Insert(nNewKey, pNewEntry))
+ else if (!aFTable.insert(make_pair(nNewKey, pNewEntry)).second)
delete pNewEntry;
else
pStdFormat->SetLastInsertKey((sal_uInt16) (nNewKey - nCLOffset));
}
if (nNewKey != nOldKey) // neuer Index
{
- pNewIndex = new sal_uInt32(nNewKey);
- if (!pMergeTable->Insert(nOldKey,pNewIndex))
- delete pNewIndex;
+ (*pMergeTable)[nOldKey] = nNewKey;
}
}
- pFormat = rTable.aFTable.Next();
+ ++it;
}
return pMergeTable;
}
@@ -3023,11 +3020,11 @@ SvNumberFormatterMergeMap SvNumberFormatter::ConvertMergeTableToMap()
return SvNumberFormatterMergeMap();
SvNumberFormatterMergeMap aMap;
- for (sal_uInt32* pIndex = pMergeTable->First(); pIndex; pIndex = pMergeTable->Next())
- {
- sal_uInt32 nOldKey = pMergeTable->GetCurKey();
- aMap.insert( SvNumberFormatterMergeMap::value_type( nOldKey, *pIndex));
- }
+ for (SvNumberFormatterIndexTable::iterator it = pMergeTable->begin(); it != pMergeTable->end(); ++it)
+ {
+ sal_uInt32 nOldKey = it->first;
+ aMap[ nOldKey ] = it->second;
+ }
ClearMergeTable();
return aMap;
}
@@ -3261,26 +3258,27 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat()
sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
{
sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge );
- sal_uInt32 nDefaultCurrencyFormat =
- (sal_uInt32)(sal_uLong) aDefaultFormatKeys.Get( CLOffset + ZF_STANDARD_CURRENCY );
- if ( !nDefaultCurrencyFormat )
+ sal_uInt32 nDefaultCurrencyFormat;
+ DefaultFormatKeysMap::iterator it = aDefaultFormatKeys.find( CLOffset + ZF_STANDARD_CURRENCY );
+ if ( it != aDefaultFormatKeys.end() )
+ nDefaultCurrencyFormat = it->second;
+ else
nDefaultCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
{
// look for a defined standard
sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
sal_uInt32 nKey;
- aFTable.Seek( CLOffset );
- while ( (nKey = aFTable.GetCurKey()) >= CLOffset && nKey < nStopKey )
+ SvNumberFormatTable::iterator it2 = aFTable.lower_bound( CLOffset );
+ while ( (nKey = it2->first) >= CLOffset && nKey < nStopKey )
{
- const SvNumberformat* pEntry =
- (const SvNumberformat*) aFTable.GetCurObject();
+ const SvNumberformat* pEntry = it2->second;
if ( pEntry->IsStandard() && (pEntry->GetType() & NUMBERFORMAT_CURRENCY) )
{
nDefaultCurrencyFormat = nKey;
break; // while
}
- aFTable.Next();
+ ++it2;
}
if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
@@ -3306,14 +3304,13 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
nDefaultCurrencyFormat = CLOffset + ZF_STANDARD_CURRENCY+3;
else
{ // mark as standard so that it is found next time
- SvNumberformat* pEntry = aFTable.Get( nDefaultCurrencyFormat );
+ SvNumberformat* pEntry = GetFormatEntry( nDefaultCurrencyFormat );
if ( pEntry )
pEntry->SetStandard();
}
}
sal_uIntPtr nFormat = nDefaultCurrencyFormat;
- aDefaultFormatKeys.Insert( CLOffset + ZF_STANDARD_CURRENCY,
- (void*) nFormat );
+ aDefaultFormatKeys[ CLOffset + ZF_STANDARD_CURRENCY ] = nFormat;
}
return nDefaultCurrencyFormat;
}
@@ -3375,7 +3372,7 @@ bool SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat,
*ppEntry = NULL;
if ( pBank )
*pBank = false;
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get( nFormat );
+ const SvNumberformat* pFormat = GetFormatEntry(nFormat);
if ( pFormat )
{
String aSymbol, aExtension;
diff --git a/svx/inc/svx/numfmtsh.hxx b/svx/inc/svx/numfmtsh.hxx
index e9b4772..32a7da3 100644
--- a/svx/inc/svx/numfmtsh.hxx
+++ b/svx/inc/svx/numfmtsh.hxx
@@ -36,10 +36,12 @@
#include <svl/svstdarr.hxx>
#include <vector>
+#include <map>
class Color;
class SvNumberFormatter;
-class SvNumberFormatTable;
+class SvNumberformat;
+typedef std::map<sal_uInt32, SvNumberformat*> SvNumberFormatTable;
class NfCurrencyEntry;
enum SvxNumberValueType
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index c76f7a4..4c23829 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -672,7 +672,7 @@ short SvxNumberFormatShell::FillEListWithFormats_Impl( std::vector<String*>& rLi
DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
- const SvNumberformat* pNumEntry = pCurFmtTable->First();
+ const SvNumberformat* pNumEntry = pCurFmtTable->empty() ? 0 : pCurFmtTable->begin()->second;
sal_uInt32 nNFEntry;
String aStrComment;
String aNewFormNInfo;
@@ -717,7 +717,7 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<String*>& rL
DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
- const SvNumberformat* pNumEntry = pCurFmtTable->First();
+ const SvNumberformat* pNumEntry = pCurFmtTable->empty() ? 0 : pCurFmtTable->begin()->second;
sal_uInt32 nNFEntry;
String aStrComment;
String aNewFormNInfo;
@@ -801,7 +801,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<String*>& rLi
DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
- const SvNumberformat* pNumEntry = pCurFmtTable->First();
+ const SvNumberformat* pNumEntry = pCurFmtTable->empty() ? 0 : pCurFmtTable->begin()->second;
sal_uInt32 nNFEntry;
String aStrComment;
String aNewFormNInfo;
@@ -842,10 +842,12 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<String*>& rLi
if(nCurCategory!=NUMBERFORMAT_ALL)
{
- pNumEntry = pCurFmtTable->First();
- while ( pNumEntry )
+ SvNumberFormatTable::iterator it = pCurFmtTable->begin();
+
+ while ( it != pCurFmtTable->end() )
{
- sal_uInt32 nKey = pCurFmtTable->GetCurKey();
+ sal_uInt32 nKey = it->first;
+ pNumEntry = it->second;
if ( !IsRemoved_Impl( nKey ))
{
@@ -876,7 +878,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<String*>& rLi
aCurEntryList.push_back( nKey );
}
}
- pNumEntry = pCurFmtTable->Next();
+ ++it;
}
}
return nSelPos;
@@ -943,11 +945,11 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL
pTmpCurrencyEntry->BuildSymbolString(rShortSymbol,bTmpBanking,true);
}
- const SvNumberformat* pNumEntry = pCurFmtTable->First();
-
- while ( pNumEntry )
+ SvNumberFormatTable::iterator it = pCurFmtTable->begin();
+ while ( it != pCurFmtTable->end() )
{
- sal_uInt32 nKey = pCurFmtTable->GetCurKey();
+ sal_uInt32 nKey = it->first;
+ const SvNumberformat* pNumEntry = it->second;
if ( !IsRemoved_Impl( nKey ) )
{
@@ -992,7 +994,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL
}
}
}
- pNumEntry = pCurFmtTable->Next();
+ ++it;
}
NfWSStringsDtor aWSStringsDtor;
@@ -1090,7 +1092,6 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<String*>& rList,
DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
- const SvNumberformat* pNumEntry = pCurFmtTable->First();
String aStrComment;
String aNewFormNInfo;
String aPrevString;
@@ -1100,9 +1101,11 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<String*>& rList,
bool bAdditional = (nPrivCat != CAT_USERDEFINED &&
nCurCategory != NUMBERFORMAT_ALL);
- while ( pNumEntry )
+ SvNumberFormatTable::iterator it = pCurFmtTable->begin();
+ while ( it != pCurFmtTable->end() )
{
- sal_uInt32 nKey = pCurFmtTable->GetCurKey();
+ sal_uInt32 nKey = it->first;
+ const SvNumberformat* pNumEntry = it->second;
if ( !IsRemoved_Impl( nKey ) )
{
@@ -1131,7 +1134,7 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<String*>& rList,
}
}
}
- pNumEntry = pCurFmtTable->Next();
+ ++it;
}
return nSelPos;
}
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index a93dc67..3d9823f 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -29,7 +29,6 @@
#include <set>
#include <comphelper/string.hxx>
-#include <tools/table.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
#include <vcl/decoview.hxx>
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 7025a3d..517a9bf 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1699,10 +1699,11 @@ void SvXMLNumFmtExport::Export( sal_Bool bIsAutoStyle )
sal_uInt32 nDefaultIndex = 0;
SvNumberFormatTable& rTable = pFormatter->GetEntryTable(
NUMBERFORMAT_DEFINED, nDefaultIndex, nLang );
- pFormat = rTable.First();
- while (pFormat)
+ SvNumberFormatTable::iterator it2 = rTable.begin();
+ while (it2 != rTable.end())
{
- nKey = rTable.GetCurKey();
+ nKey = it2->first;
+ pFormat = it2->second;
if (!pUsedList->IsUsed(nKey))
{
DBG_ASSERT((pFormat->GetType() & NUMBERFORMAT_DEFINED) != 0, "a not user defined numberformat found");
@@ -1712,7 +1713,7 @@ void SvXMLNumFmtExport::Export( sal_Bool bIsAutoStyle )
pUsedList->SetUsed(nKey);
}
- pFormat = rTable.Next();
+ ++it2;
}
}
}
More information about the Libreoffice-commits
mailing list