[Libreoffice-commits] .: vcl/source

Joseph Powers jpowers at kemper.freedesktop.org
Thu Feb 17 08:35:47 PST 2011


 vcl/source/control/morebtn.cxx |   41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

New commits:
commit d56053e397b11ba0adc34328717c73d74a0c07fd
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Thu Feb 17 08:34:25 2011 -0800

    Remove DECLARE_LIST( ImplMoreWindowList, Window* )

diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx
index 8371187..bd77f04 100644
--- a/vcl/source/control/morebtn.cxx
+++ b/vcl/source/control/morebtn.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
@@ -31,12 +31,11 @@
 #include <vcl/morebtn.hxx>
 
 #include <tools/rc.h>
-
-
+#include <vector>
 
 // =======================================================================
 
-DECLARE_LIST( ImplMoreWindowList, Window* )
+typedef ::std::vector< Window* > ImplMoreWindowList;
 
 struct ImplMoreButtonData
 {
@@ -149,7 +148,6 @@ void MoreButton::Click()
 {
     Window* 	pParent = GetParent();
     Size		aSize( pParent->GetSizePixel() );
-    Window* 	pWindow = (mpMBData->mpItemList) ? mpMBData->mpItemList->First() : NULL;
     long		nDeltaPixel = LogicToPixel( Size( 0, mnDelta ), meUnit ).Height();
 
     // Status aendern
@@ -164,10 +162,10 @@ void MoreButton::Click()
     if ( mbState )
     {
         // Fenster anzeigen
-        while ( pWindow )
-        {
-            pWindow->Show();
-            pWindow = mpMBData->mpItemList->Next();
+        if ( mpMBData->mpItemList ) {
+            for ( size_t i = 0, n = mpMBData->mpItemList->size(); i < n; ++i ) {
+                (*mpMBData->mpItemList)[ i ]->Show();
+            }
         }
 
         // Dialogbox anpassen
@@ -194,10 +192,10 @@ void MoreButton::Click()
         pParent->SetSizePixel( aSize );
 
         // Fenster nicht mehr anzeigen
-        while ( pWindow )
-        {
-            pWindow->Hide();
-            pWindow = mpMBData->mpItemList->Next();
+        if ( mpMBData->mpItemList ) {
+            for ( size_t i = 0, n = mpMBData->mpItemList->size(); i < n; ++i ) {
+                (*mpMBData->mpItemList)[ i ]->Hide();
+            }
         }
     }
 }
@@ -207,9 +205,9 @@ void MoreButton::Click()
 void MoreButton::AddWindow( Window* pWindow )
 {
     if ( !mpMBData->mpItemList )
-        mpMBData->mpItemList = new ImplMoreWindowList( 1024, 16, 16 );
+        mpMBData->mpItemList = new ImplMoreWindowList();
 
-    mpMBData->mpItemList->Insert( pWindow, LIST_APPEND );
+    mpMBData->mpItemList->push_back( pWindow );
 
     if ( mbState )
         pWindow->Show();
@@ -221,8 +219,17 @@ void MoreButton::AddWindow( Window* pWindow )
 
 void MoreButton::RemoveWindow( Window* pWindow )
 {
-    if ( mpMBData->mpItemList )
-        mpMBData->mpItemList->Remove( pWindow );
+    if ( mpMBData->mpItemList ) {
+        for ( ImplMoreWindowList::iterator it = mpMBData->mpItemList->begin();
+              it < mpMBData->mpItemList->end();
+              ++it
+        ) {
+            if ( *it == pWindow ) {
+                mpMBData->mpItemList->erase( it );
+                break;
+            }
+        }
+    }
 }
 
 // -----------------------------------------------------------------------


More information about the Libreoffice-commits mailing list