From 0979307bbf769399f97da10a29f04936a6cf117c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 6 Feb 2012 12:50:59 +0200 Subject: 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. --- svl/inc/svl/zforlist.hxx | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'svl/inc') diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index ac387d472f35..14229a06c6d1 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -30,7 +30,6 @@ #include "svl/svldllapi.h" #include -#include #include #include #include @@ -214,10 +213,10 @@ enum NfEvalDateFormat }; -DECLARE_TABLE (SvNumberFormatTable, SvNumberformat*) -DECLARE_TABLE (SvNumberFormatterIndexTable, sal_uInt32*) +typedef std::map SvNumberFormatTable; +typedef std::map 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 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(); } -- cgit