Kaydet (Commit) 99a8c8da authored tarafından Joseph Powers's avatar Joseph Powers

Replace List with std::vector< SvNumberFormatter* >

üst e5e19089
...@@ -100,26 +100,28 @@ static sal_uInt32 theIndexTable[NF_INDEX_TABLE_ENTRIES]; ...@@ -100,26 +100,28 @@ static sal_uInt32 theIndexTable[NF_INDEX_TABLE_ENTRIES];
also handles one instance of the SysLocale options also handles one instance of the SysLocale options
*/ */
typedef ::std::vector< SvNumberFormatter* > SvNumberFormatterList_impl;
class SvNumberFormatterRegistry_Impl : public utl::ConfigurationListener class SvNumberFormatterRegistry_Impl : public utl::ConfigurationListener
{ {
List aFormatters; SvNumberFormatterList_impl aFormatters;
SvtSysLocaleOptions aSysLocaleOptions; SvtSysLocaleOptions aSysLocaleOptions;
LanguageType eSysLanguage; LanguageType eSysLanguage;
public: public:
SvNumberFormatterRegistry_Impl(); SvNumberFormatterRegistry_Impl();
virtual ~SvNumberFormatterRegistry_Impl(); virtual ~SvNumberFormatterRegistry_Impl();
void Insert( SvNumberFormatter* pThis ) void Insert( SvNumberFormatter* pThis )
{ aFormatters.Insert( pThis, LIST_APPEND ); } { aFormatters.push_back( pThis ); }
SvNumberFormatter* Remove( SvNumberFormatter* pThis )
{ return (SvNumberFormatter*)aFormatters.Remove( pThis ); }
sal_uInt32 Count()
{ return aFormatters.Count(); }
virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); SvNumberFormatter* Remove( SvNumberFormatter* pThis );
};
size_t Count()
{ return aFormatters.size(); }
virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
};
SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl() SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl()
{ {
...@@ -134,26 +136,37 @@ SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl() ...@@ -134,26 +136,37 @@ SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl()
} }
void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint ) SvNumberFormatter* SvNumberFormatterRegistry_Impl::Remove( SvNumberFormatter* pThis )
{ {
for(
SvNumberFormatterList_impl::iterator it = aFormatters.begin();
it < aFormatters.end();
++it
) {
if ( *it == pThis ) {
aFormatters.erase( it );
break;
}
}
return pThis;
}
void SvNumberFormatterRegistry_Impl::ConfigurationChanged(
utl::ConfigurationBroadcaster*,
sal_uInt32 nHint
) {
if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE )
{ {
::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() );
for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); for( size_t i = 0, n = aFormatters.size(); i < n; ++i )
p; p = (SvNumberFormatter*)aFormatters.Next() ) aFormatters[ i ]->ReplaceSystemCL( eSysLanguage );
{
p->ReplaceSystemCL( eSysLanguage );
}
eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM );
} }
if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY )
{ {
::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() );
for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); for( size_t i = 0, n = aFormatters.size(); i < n; ++i )
p; p = (SvNumberFormatter*)aFormatters.Next() ) aFormatters[ i ]->ResetDefaultSystemCurrency();
{
p->ResetDefaultSystemCurrency();
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment