From 9df180a0fcf085686c16c4720fe4e983208d5658 Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Fri, 10 Dec 2010 20:42:06 -0800 Subject: Remove DECLARE_LIST( MacroList, SbMethod* ) & Cleanup previous patch --- UnoControls/source/controls/progressmonitor.cxx | 18 ++++++++------ basctl/source/basicide/macrodlg.cxx | 33 +++++++++++-------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx index ca206b1f44c4..ca74167638aa 100644 --- a/UnoControls/source/controls/progressmonitor.cxx +++ b/UnoControls/source/controls/progressmonitor.cxx @@ -43,7 +43,7 @@ #include #include #include - +#include //____________________________________________________________________________________________________________ // includes of my project //____________________________________________________________________________________________________________ @@ -61,7 +61,7 @@ using namespace ::com::sun::star::lang ; using namespace ::com::sun::star::awt ; using ::std::vector; - +using ::std::find; namespace unocontrols{ @@ -308,15 +308,17 @@ void SAL_CALL ProgressMonitor::removeText ( const OUString& rTopic, sal_Bool bbe // ... delete item from right list ... if ( bbeforeProgress == sal_True ) { - vector< IMPL_TextlistItem* >::iterator itr = maTextlist_Top.begin(); - while ( (itr < maTextlist_Top.end()) && (*itr != pSearchItem) ) ++itr; - maTextlist_Top.erase(itr); + vector< IMPL_TextlistItem* >::iterator + itr = find( maTextlist_Top.begin(), maTextlist_Top.end(), pSearchItem ); + if (itr != maTextlist_Top.end()) + maTextlist_Top.erase(itr); } else { - vector< IMPL_TextlistItem* >::iterator itr = maTextlist_Bottom.begin(); - while ( (itr < maTextlist_Bottom.end()) && (*itr != pSearchItem) ) ++itr; - maTextlist_Bottom.erase(itr); + vector< IMPL_TextlistItem* >::iterator + itr = find( maTextlist_Bottom.begin(), maTextlist_Bottom.end(), pSearchItem ); + if (itr != maTextlist_Bottom.end()) + maTextlist_Bottom.erase(itr); } delete pSearchItem ; diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index e3f21bba669a..155079ed30f0 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -56,12 +56,12 @@ #include #include +#include +using ::std::list; + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; - -DECLARE_LIST( MacroList, SbMethod* ) - MacroChooser::MacroChooser( Window* pParnt, BOOL bCreateEntries ) : SfxModalDialog( pParnt, IDEResId( RID_MACROCHOOSER ) ), aMacroNameTxt( this, IDEResId( RID_TXT_MACRONAME ) ), @@ -552,39 +552,36 @@ IMPL_LINK( MacroChooser, BasicSelectHdl, SvTreeListBox *, pBox ) // Die Macros sollen in der Reihenfolge angezeigt werden, // wie sie im Modul stehen. - MacroList aMacros; - USHORT nMacroCount = pModule->GetMethods()->Count(); - USHORT nRealMacroCount = 0; - USHORT iMeth; - for ( iMeth = 0; iMeth < nMacroCount; iMeth++ ) + + list< SbMethod* > aMacros; + size_t nMacroCount = pModule->GetMethods()->Count(); + for ( size_t iMeth = 0; iMeth < nMacroCount; iMeth++ ) { SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( iMeth ); if( pMethod->IsHidden() ) continue; - ++nRealMacroCount; DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); - ULONG nPos = LIST_APPEND; // Eventuell weiter vorne ? USHORT nStart, nEnd; pMethod->GetLineRange( nStart, nEnd ); - for ( ULONG n = 0; n < aMacros.Count(); n++ ) + list< SbMethod* >::iterator itr; + for ( itr = aMacros.begin(); itr != aMacros.end(); ++itr ) { USHORT nS, nE; - SbMethod* pM = aMacros.GetObject( n ); + SbMethod* pM = *itr; DBG_ASSERT( pM, "Macro nicht in Liste ?!" ); pM->GetLineRange( nS, nE ); - if ( nS > nStart ) - { - nPos = n; + if ( nS > nStart ) { break; } } - aMacros.Insert( pMethod, nPos ); + if ( itr != aMacros.end() ) ++itr; + aMacros.insert( itr, pMethod ); } aMacroBox.SetUpdateMode( FALSE ); - for ( iMeth = 0; iMeth < nRealMacroCount; iMeth++ ) - aMacroBox.InsertEntry( aMacros.GetObject( iMeth )->GetName() ); + for ( list< SbMethod* >::iterator itr = aMacros.begin(); itr != aMacros.end(); ++itr ) + aMacroBox.InsertEntry( (*itr)->GetName() ); aMacroBox.SetUpdateMode( TRUE ); if ( aMacroBox.GetEntryCount() ) -- cgit