From ee05143cb845bf7f82cf1a55b5e72f7a932946c0 Mon Sep 17 00:00:00 2001 From: Jonathan Callen Date: Tue, 1 Feb 2011 01:32:54 -0500 Subject: [PATCH] Convert tools/list.hxx usage to std::list --- svtools/source/config/htmlcfg.cxx | 18 ++++++++---------- svtools/source/config/menuoptions.cxx | 33 +++++++++++++++------------------ svtools/source/config/miscopt.cxx | 22 +++++++++------------- 3 files changed, 32 insertions(+), 41 deletions(-) diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx index b44dfe2..2de1f14 100644 --- a/svtools/source/config/htmlcfg.cxx +++ b/svtools/source/config/htmlcfg.cxx @@ -33,9 +33,9 @@ #include #include #include -#include #include #include +#include // ----------------------------------------------------------------------- #define HTMLCFG_UNKNOWN_TAGS 0x01 @@ -54,13 +54,11 @@ using namespace com::sun::star::uno; static SvxHtmlOptions* pOptions = 0; -DECLARE_LIST( LinkList, Link * ) - #define C2U(cChar) OUString::createFromAscii(cChar) struct HtmlOptions_Impl { - LinkList aList; + ::std::list aList; sal_Int32 nFlags; sal_Int32 nExportMode; sal_Int32 aFontSizeArr[HTML_FONT_COUNT]; @@ -268,16 +266,16 @@ void SvxHtmlOptions::Commit() void SvxHtmlOptions::AddListenerLink( const Link& rLink ) { - pImp->aList.Insert( new Link( rLink ) ); + pImp->aList.push_back( rLink ); } void SvxHtmlOptions::RemoveListenerLink( const Link& rLink ) { - for ( USHORT n=0; naList.Count(); n++ ) + for ( ::std::list::iterator iter = pImp->aList.begin(); iter != pImp->aList.end(); ++iter ) { - if ( (*pImp->aList.GetObject(n) ) == rLink ) + if ( *iter == rLink ) { - delete pImp->aList.Remove(n); + pImp->aList.erase(iter); break; } } @@ -285,8 +283,8 @@ void SvxHtmlOptions::RemoveListenerLink( const Link& rLink ) void SvxHtmlOptions::CallListeners() { - for ( USHORT n = 0; n < pImp->aList.Count(); ++n ) - pImp->aList.GetObject(n)->Call( this ); + for ( ::std::list::const_iterator iter = pImp->aList.begin(); iter != pImp->aList.end(); ++iter ) + iter->Call( this ); } diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx index e0b57c5..7703738 100644 --- a/svtools/source/config/menuoptions.cxx +++ b/svtools/source/config/menuoptions.cxx @@ -40,6 +40,8 @@ #include #include "itemholder2.hxx" +#include + //_________________________________________________________________________________________________________________ // namespaces //_________________________________________________________________________________________________________________ @@ -71,8 +73,6 @@ using namespace ::com::sun::star::uno ; #define PROPERTYCOUNT 4 #include -#include -DECLARE_LIST( LinkList, Link * ) //_________________________________________________________________________________________________________________ // private declarations! @@ -85,7 +85,7 @@ class SvtMenuOptions_Impl : public ConfigItem //------------------------------------------------------------------------------------------------------------- private: - LinkList aList; + ::std::list aList; sal_Bool m_bDontHideDisabledEntries ; /// cache "DontHideDisabledEntries" of Menu section sal_Bool m_bFollowMouse ; /// cache "FollowMouse" of Menu section sal_Int16 m_nMenuIcons ; /// cache "MenuIcons" of Menu section @@ -171,8 +171,8 @@ class SvtMenuOptions_Impl : public ConfigItem { m_bDontHideDisabledEntries = bState; SetModified(); - for ( USHORT n=0; nCall( this ); + for ( ::std::list::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); Commit(); } @@ -180,8 +180,8 @@ class SvtMenuOptions_Impl : public ConfigItem { m_bFollowMouse = bState; SetModified(); - for ( USHORT n=0; nCall( this ); + for ( ::std::list::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); Commit(); } @@ -189,8 +189,8 @@ class SvtMenuOptions_Impl : public ConfigItem { m_nMenuIcons = nState; SetModified(); - for ( USHORT n=0; nCall( this ); + for ( ::std::list::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); Commit(); } @@ -300,9 +300,6 @@ SvtMenuOptions_Impl::~SvtMenuOptions_Impl() { Commit(); } - - for ( USHORT n=0; n& seqPropertyNames ) if ( bMenuSettingsChanged ) m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; - for ( USHORT n=0; nCall( this ); + for ( ::std::list::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); } //***************************************************************************************************************** @@ -417,16 +414,16 @@ Sequence< OUString > SvtMenuOptions_Impl::impl_GetPropertyNames() void SvtMenuOptions_Impl::AddListenerLink( const Link& rLink ) { - aList.Insert( new Link( rLink ) ); + aList.push_back( rLink ); } void SvtMenuOptions_Impl::RemoveListenerLink( const Link& rLink ) { - for ( USHORT n=0; n::iterator iter = aList.begin(); iter != aList.end(); ++iter ) { - if ( (*aList.GetObject(n) ) == rLink ) + if ( *iter == rLink ) { - delete aList.Remove(n); + aList.erase(iter); break; } } diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index f5aa5db..81f1a84 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -49,6 +48,8 @@ #include #include +#include + //_________________________________________________________________________________________________________________ // namespaces //_________________________________________________________________________________________________________________ @@ -94,8 +95,6 @@ using namespace ::com::sun::star; #define VCL_TOOLBOX_STYLE_FLAT ((USHORT)0x0004) // from -DECLARE_LIST( LinkList, Link * ) - //_________________________________________________________________________________________________________________ // private declarations! //_________________________________________________________________________________________________________________ @@ -107,7 +106,7 @@ class SvtMiscOptions_Impl : public ConfigItem //------------------------------------------------------------------------------------------------------------- private: - LinkList aList; + ::std::list aList; sal_Bool m_bUseSystemFileDialog; sal_Bool m_bIsUseSystemFileDialogRO; sal_Bool m_bTryODMADialog; @@ -469,9 +468,6 @@ SvtMiscOptions_Impl::~SvtMiscOptions_Impl() { Commit(); } - - for ( USHORT n=0; n& rPropertyNames ) void SvtMiscOptions_Impl::AddListenerLink( const Link& rLink ) { - aList.Insert( new Link( rLink ) ); + aList.push_back( rLink ); } void SvtMiscOptions_Impl::RemoveListenerLink( const Link& rLink ) { - for ( USHORT n=0; n::iterator iter = aList.begin(); iter != aList.end(); ++iter ) { - if ( (*aList.GetObject(n) ) == rLink ) + if ( *iter == rLink ) { - delete aList.Remove(n); + aList.erase(iter); break; } } @@ -597,8 +593,8 @@ void SvtMiscOptions_Impl::RemoveListenerLink( const Link& rLink ) void SvtMiscOptions_Impl::CallListeners() { - for ( USHORT n = 0; n < aList.Count(); ++n ) - aList.GetObject(n)->Call( this ); + for ( ::std::list::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); } void SvtMiscOptions_Impl::SetToolboxStyle( sal_Int16 nStyle, bool _bSetModified ) -- 1.7.4.rc3