[Libreoffice-commits] .: basctl/source UnoControls/source

Joseph Powers jpowers at kemper.freedesktop.org
Fri Dec 10 20:42:18 PST 2010


 UnoControls/source/controls/progressmonitor.cxx |   18 +++++----
 basctl/source/basicide/macrodlg.cxx             |   45 +++++++++++-------------
 2 files changed, 31 insertions(+), 32 deletions(-)

New commits:
commit eb25b726257745ffbb7bf3f0cc451155f2902863
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Fri Dec 10 20:42:06 2010 -0800

    Remove DECLARE_LIST( MacroList, SbMethod* ) & Cleanup previous patch

diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx
index 1e16eba..997c62a 100644
--- a/UnoControls/source/controls/progressmonitor.cxx
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -43,7 +43,7 @@
 #include <cppuhelper/typeprovider.hxx>
 #include <tools/debug.hxx>
 #include <tools/solar.h>
-
+#include <algorithm>
 //____________________________________________________________________________________________________________
 //	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 01e33f2..ab17abc 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -56,12 +56,12 @@
 #include <com/sun/star/script/XLibraryContainer2.hpp>
 #include <com/sun/star/document/MacroExecMode.hpp>
 
+#include <list>
+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 ) ),
@@ -120,7 +120,7 @@ MacroChooser::MacroChooser( Window* pParnt, BOOL bCreateEntries ) :
     aMacroBox.SetSelectHdl( LINK( this, MacroChooser, MacroSelectHdl ) );
 
     aBasicBox.SetMode( BROWSEMODE_MODULES );
-    aBasicBox.SetWindowBits( WB_HASLINES | WB_HASLINESATROOT | 
+    aBasicBox.SetWindowBits( WB_HASLINES | WB_HASLINESATROOT |
                              WB_HASBUTTONS | WB_HASBUTTONSATROOT |
                              WB_HSCROLL );
 
@@ -389,13 +389,13 @@ SbMethod* MacroChooser::CreateMacro()
                 aModName = aModName.GetToken( 0, ' ', nIndex );
             }
             pModule = pBasic->FindModule( aModName );
-        }    
+        }
         else if ( pBasic->GetModules()->Count() )
             pModule = (SbModule*)pBasic->GetModules()->Get( 0 );
 
         if ( !pModule )
         {
-            pModule = createModImpl( static_cast<Window*>( this ), 
+            pModule = createModImpl( static_cast<Window*>( this ),
                 aDocument, aBasicBox, aLibName, aModName );
         }
 
@@ -421,7 +421,7 @@ void MacroChooser::SaveSetCurEntry( SvTreeListBox& rBox, SvLBoxEntry* pEntry )
 
 void MacroChooser::CheckButtons()
 {
-    SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();    
+    SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
     BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
     SvLBoxEntry* pMacroEntry = aMacroBox.FirstSelected();
     SbMethod* pMethod = GetMacro();
@@ -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() )
@@ -832,7 +829,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
         ScriptDocument aDocument( aDesc.GetDocument() );
         String aLibName( aDesc.GetLibName() );
         String aModName;
-        createModImpl( static_cast<Window*>( this ), aDocument, 
+        createModImpl( static_cast<Window*>( this ), aDocument,
             aBasicBox, aLibName, aModName, true );
     }
     else if ( pButton == &aOrganizeButton )


More information about the Libreoffice-commits mailing list